Number of spot in binary image

how i can find the spot of binary imagr,
the result of binary image below must be = 4
how i can find it?????

 Accepted Answer

bw = im2bw(imread('image.jpeg'));
[~, numspots] = bwlabel( imclearborder(~bw) );

1 Comment

Many thanks dear Walter Roberson,
your answer is very fast and helpful

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!