How to count blobs with a given threshold in an image

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

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

Community Treasure Hunt

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

Start Hunting!