bwlabel (Bw) function return Wrong number of Connected Objects
古いコメントを表示
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);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

