MATLAB: Number of spot in binary image

fill holeshole fillingimage processingImage Processing Toolbox

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

Best Answer

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