image - How to find the number of black pixels which connect together in MATLAB? -


Let's say I have a black and white picture. There are some irregular shapes (black) on the picture (white background). I should know the size of each shape by counting how many shapes and black pixels in that picture Any easy way to do this ??

function. Assuming your image, a binary matrix is ​​stored in the form of img :

  cc = bevanon comp (img); Num = cc.numObjects; Size = selphan (@ lambi, cc pixel eyedlist);    

Comments