How to count blobs with a given threshold in an image

3 views (last 30 days)
Hi everyone, I need to count the number of blobs with a given threshold in an image? Can somebody please help me there.

Accepted Answer

Akira Agata
Akira Agata on 24 May 2018
One possible solution would be like this:
% Read sample image
I = imread('coins.png');
% Threshold
th = 100;
% Blobs where I > th
BW = I > th;
% Count number of blobs
s = regionprops(BW);
numBlob = numel(s);
Result:
>> numBlob
numBlob =
10

More Answers (1)

Image Analyst
Image Analyst on 24 May 2018

Community Treasure Hunt

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

Start Hunting!