How to remove areas above a certain size after measure.label?

Sample image and/or macro code



Hi, so i have applied measure.label on my image, and am almost satisfied with it. I would like for the end result to only contain the 2 crescents seen in the image, and to remove the other noise and squarish shape in the centre. How would I go about doing that? Let’s assume the noise is above 400 pixels in area.

Analysis goals

  • What information are you interested in getting from this image?


I am able to get out the list of shapes of the subshapes in the image, but am unsure how to weed out the smaller ones.

Hi @GeNiaaz welcome to the forum! You have the morphology.remove_small_objects function of scikit-image ( which does exactly what you’re asking for: remove objects below a given size.

1 Like

THANKS SO MUCH!!! I was searching around everywhere for solutions, gosh I just had to read their API more closely. Again, I very much appreciate your help!

1 Like