Home > Software design >  How to get the black solid object alone ignoring white island using python
How to get the black solid object alone ignoring white island using python

Time:07-21

After Appling image processing technics i got the input image, now i need the out put as shown in attachment:

Image

How can i deleted all the white island and keep only solid black object Any techniques available, please do suggest.

CodePudding user response:

To get rid of single pixels or small clusters, you can use morphological operations. The opencv opening function removes small objects.

dst=open(src,element)=dilate(erode(src,element))

where element is the kernel for the dilation and erosion and src the source image.

The opencv tutorial is very helpful on this.

To find closed contours, you could use the findContours function after the morphological operations. Tutorial

  • Related