Ask Your Question

Revision history [back]

Eliminating small blobs leaving bigger ones intact

DISCLAIMER: I can NOT use morphological (i.e. erosions) operations or drawContours to solve this problem.

I'm trying to find an efficient solution to eliminate most small blobs in this image, leaving the big blobs absolutely intact.

Blobs

The first thing that comes to my mind is to create a custom 7x7 or 9x9 filter that identifies small isolated blobs, but I never had the need to use such kind of specific technique, so I don't know how I would build and apply such a filter. Any ideas will be welcomed.

DISCLAIMER: I can NOT use morphological (i.e. erosions) operations or drawContours to solve this problem.

Eliminating small blobs leaving bigger ones intact

DISCLAIMER: I can NOT use morphological (i.e. erosions) operations or drawContours to solve this problem.

I'm trying to find an efficient solution to eliminate most small blobs in this image, leaving the big blobs absolutely intact.

Blobs

The first thing that comes to my mind is to create a custom 5x5 or 7x7 or 9x9 filter that identifies small isolated blobs, but I never had the need to use such kind of specific technique, so I don't know how I would build and apply such a filter. filter.

EXAMPLE: If I have the following custom filter:

F = [-1 -1 -1 -1 -1 
     -1 25 25 25 -1
     -1 25 100 25 -1
     -1 25 25 25  -1
     -1 -1 -1 -1 -1]

Theoretically, if I pass this filter in an isolated 3x3 squared white blob, the value on that coordinate will be 25 + 25 + 25 + 25 + 100 + 25 + 25 + 25 = 300. So, where in the resulting matrix I have the value 300, I know that I have a 3x3 square white blob. But I'm trying to generate a more robust filter to handle all kind of small blobs (as you can see in the image bellow).

Any ideas will be welcomed. welcomed.

DISCLAIMER: I can NOT use morphological (i.e. erosions) operations or drawContours to solve this problem.