MATLAB: Bwconncomp, use the ids assigned by Matlab in a image.

bwconncompuse the ids assigned by matlab in a image

Hi, when I use bwconncomp function, this create a cc 1×1 struct
Connectivity 8 ImageSize [145 145] NumObjects 7 PixelIdxList 1×7 cell
is there a way to get the numobjects value using a function to can use this one to create others functions or tasks?

Best Answer

You can use bwlabel instead. Is this what you mean?
[labeledImage numberOfObjects] = bwlabel(binaryImage);
or maybe you want the labelmatrix() function?