MATLAB: How to count blobs with a given threshold in an image

blobsimage processing

Hi everyone, I need to count the number of blobs with a given threshold in an image? Can somebody please help me there.

Best 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