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

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


Unknown said... Reply to comment


Yuhandri Yunus said... Reply to comment

hai..thanks you, i answer for you

There are 5 patterns in 1 fabric, 2 the same pattern, the same pattern again 2 and 1 different patterns, how to compress the same pattern in figure 1 so as to produce a 3 figure

Enjoyed Reading? Share Your Views

Previous Post Next Post Home
Related Posts Plugin for WordPress, Blogger...
Google ping Hypersmash.com