How to find the area of each of the blobs in the image and create a histogram of the number of blobs in each size range

13 views (last 30 days)
Hi! I am trying to find the number of pixels in each of the blobs in the image and create a histogram that shows the number of blobs in each size range ( 0%-10% of the biggest blob size, 10%-20% of biggest blob size ... 90%-100% of the biggest blob size).
I've able to find the total number of pixels in all the blobs altogether but I am having trouble finding the number of blobs present and also the individual numbers of pixels within each blob. Would appreciate any help
Thanks!

Accepted Answer

Image Analyst
Image Analyst on 14 Jun 2022
It does all that. Just change it to use your image instead of the demo image. Key points would be
mask = grayImage < someValue;
props = regionprops(mask, 'Area');
numBlobs = numel(props)
allAreas = [props.Area]
edges = linspace(0, max(allAreas), 11);
histogram(allAreas, edges);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!