Question

I am writing a code for watershed in OpenCV.

But i want the watershed boundaries to be 4 point connected and not 8 point.

Currently this is the interface:

void watershed(InputArray image, InputOutputArray markers)

Does anybody have any solution for this?

Also, is there any simple way to perform morphological watershed in opencv for automatic over-segmentation, the current one takes user input?

Was it helpful?

Solution

OpenCV help for watershed does not explicitly explain the connectivity used in the function. It just refers to the paper MEYER, Fernand. Color image segmentation. In: Image Processing and its Applications, 1992., International Conference on. IET, 1992. p. 303-306.

Maybe you have to implement your own watershed algorithm, starting from the one available in OpenCV (OpenCV 2.4 implementation is here), or creating a new one; for example the following paper describes an algorithm where the connectivity is properly highlighted:

VINCENT, Luc; SOILLE, Pierre. Watersheds in digital spaces: an efficient algorithm based on immersion simulations. IEEE transactions on pattern analysis and machine intelligence, 1991, 13.6: 583-598.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top