how to know the number of regions of the image?
3 views (last 30 days)
Show older comments
Hi! I have a color segmented image. i need to know the number of regions of the image , and the size of each region. Can anyone help me please?
Answers (2)
Guillaume
on 17 Jul 2017
Edited: Guillaume
on 17 Jul 2017
You use regionprops on your segmented image. The number of elements in the structure array it returns is the number of regions. The Area field or the BoundingBox field of the structure gives you the size, depending on what you call size.
3 Comments
Guillaume
on 17 Jul 2017
Edited: Guillaume
on 17 Jul 2017
I'm not sure what an inverse wavelet transform of a labeled image gives you. If it's still a label image then you can use regionprops on it. If it's not, then you need to segment it again using an appropriate method, possibly another watershed.
I don't really understand why you'd want to apply an inverse wavelet transform to the result of a watershed segmentation.
Image Analyst
on 27 Jul 2017
Use bwlabel() on your segmented (binary) image - that's one way.
[~, numRegions] = bwlabel(segmentedImage);
8 Comments
See Also
Categories
Find more on Image Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!