Ask Your Question

Revision history [back]

How to ignore background within objects

I use the distance transform + watershed algorithm to segment objects in images. For that I use this example code: docs.opencv.org/3.1.0/d2/dbd/tutorial_distance_transform.html

Like in the example above in some cases there is background surrounded by objects which leads to mistakes. I want this pieces of background to be ignored from the algorithm. Is there any possibilty to archieve that? Every pixel of the image with the values 0/0/0 should be ignored.