MATLAB: How to remove unwanted small blob

blobImage Processing Toolboximage segmentation

I want to remove the small blob and only keep the largest connected blob.
How can I do it?

Best Answer

First of all, don't use watershed or whatever to break up the blobs into sub-blobs. Then use imclearborder() to get rid of blobs touching the borders, then use bwareafilt(binaryImage, 1) to get just the largest blob.
Related Question