How to delete small objects using bwareaopen?

I have an image and I want to remove the black pixels that are on large white objects. I use the function bwareaopen(BW,P), but only removes hole objects, not black pixels. I tried different values P, but failed again.

Why bwareopencan't remove black pixels on white objects and how to remove them?

Picture:

enter image description here

+4
source share
1 answer

bwareaopen()removes white areas smaller in size p. If you want to remove black holes inside your white areas, you must use the function imfill().

: , bwareaopen() , 1-Im

+5

Source: https://habr.com/ru/post/1544287/


All Articles