bwlabel (Bw) function return Wrong number of Connected Objects
Show older comments
i use bwlabel(Bw) function to returns n, the number of connected objects found in Bw on the following image :

the n that will be returned should be 4 but actually 261 is return and i don`t know why
when i use the code below on the img simillar to the above but there is no rotation in any object it works fine
but in the case of the above image (there is a rotation in one or more object in the image) it not works correctlly
the code :
inputImg = input("one-rotated.jpg")
c = im2gray(inputImg);
figure , imshow(c) , title("gray Image");
z = 255-c;
q = imfill(z,'holes');
figure , imshow(q) , title("binary Image");
[l, n]=bwlabel(q);
Accepted Answer
More Answers (0)
Categories
Find more on Image Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
