Need help in detecting multiple blobs

159 views Asked by At

i have applied thresholding on series of Dicom images , now my problem is i have different blobs with area 50,315,1054, 22724 and i want to display multiple blobs, for one blob it works fine but when areas are set to detect multiple blobs its gives an error Matrix dimensions must agree. here is matlab code

LB = 1050;
UB = 22724;
L = bwlabeln(bw);
stats = regionprops(L,'Area','Centroid');
A = [stats.Area]
mul_blob = find(A >= LB & A<=UB) ;
mriAdjust(L  ~= mul_blob) = 1; %mriAdjust is stack of dicom images 
imA = imadjust(mriAdjust(:,:,17));
imshow(imA) `
1

There are 1 answers

0
ipa On

If you want to filter by using the area (or also other regionproperties) you can use the bwpropfilt function. There you can filter your BW image based on different criterias (also Area).

LB = 1050;
UB = 22724;
bwFiltered = bwpropfilt(bw, 'Area', [LB, UB]);
imshow(bwFiltered);

http://ch.mathworks.com/help/images/ref/bwpropfilt.html