Follow by Email

Lets Learn together... Happy Reading

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

Recent Posts

Auto Cropping- Based on labeling the connected components

                                                     This post is about labeling the connected components in a binary image and crop the connected components based on the label. The main two functions used for this simple operation are ‘bwlabel’ and ‘regionprops’.
                                                     I used ‘bwlabel’ to label the connected components.  After labeling, I used ‘regionprops’ function to find the rectangle containing the region.  To find the rectangle points, I used ‘BoundingBox’ property.
                                                    Then the labeled components are automatically cropped and the image is displayed. To crop an image, ‘imcrop’ function is used.


figure,imshow(A); title('Original Image');


%Convert the Image to binary
%Fill the holes
%Label the connected components
figure,imshow(C); title('Labelled Image');

%Rectangle containing the region
%Crop all the Coins 
for i=1:Total
    Name=strcat('Object Number:',num2str(i));
    figure,imshow(Img); title(Name);

Another Example:


Labeled Image

like button Like "IMAGE PROCESSING" page
Previous Post Next Post Home
Related Posts Plugin for WordPress, Blogger...
Google ping