I'm trying to filter off little black spots on my processed image after blob formation. I got some help and came up with this but it doesnt work. Please help as it is quite urgent. My image is "map".
COdes:
% Thresholding
map = DM > 5;
% Form blobs
ccamap = bwlabel(map);
maxlabel = max(max(ccamap));
bufmap = zeros(ImgHeight,ImgWidth);
% Remove small regions
newlabel=1;
for i=1:maxlabel
fInd=[]; fInd = find(ccamap==i);
sizeregion = length(fInd);
if sizeregion>500
bufmap(fInd) = newlabel;
newlabel = newlabel+1;
end
end
ccamap = bufmap;
imshow(ccamap);
COdes:
% Thresholding
map = DM > 5;
% Form blobs
ccamap = bwlabel(map);
maxlabel = max(max(ccamap));
bufmap = zeros(ImgHeight,ImgWidth);
% Remove small regions
newlabel=1;
for i=1:maxlabel
fInd=[]; fInd = find(ccamap==i);
sizeregion = length(fInd);
if sizeregion>500
bufmap(fInd) = newlabel;
newlabel = newlabel+1;
end
end
ccamap = bufmap;
imshow(ccamap);