How could I remove small noises?

Is there some kind of filter that I can remove these noises circled in red in my image?

how did those happen? show untouched input data

Agree on showing the input image - there is a good chance you can improve the first image processing stage and reduce/eliminate that artifact.

If not, a median filter might work for you while (mostly) preserving the shape of the blobs you want to keep. Median filters tend to be computationally expensive, particularly as they get larger.

Possibly finding connected components and filtering by size (area / number of pixels) and/or some function of the perimeter and area of the contour. For example, assume the contour is a circle, compute the implied radius based on the perimeter, and then an implied circumference…and compare that to the actual perimeter. If it’s not within some “reasonable” range, discard it.


But start with improving the first step in the image processing pipeline.