Watershed algorithm for image segmentation

1, Principle:
Any one can be regarded as a grayscale image plane topology, high gray scale value region may be regarded as
Peaks, the low tone value area may be seen as valleys. We fill a different color to each of the valley
water. With increasing bit water, which will meet different convergence valley, the valley of the water in order to prevent various
Convergence, we need to build the dam at the confluence of the local water. Stop irrigation, stop building dams to know
Road all peaks have been flooded. We build good dams is divided on the image. This is the watershed
Philosophy behind the ridge algorithm. You can be on watershed by visiting the website CMM webpage
Deepen their understanding.
But this approach usually results obtained over-segmentation, which is the noise or other image
Irregular factors caused. To reduce this effect, OpenCV using a mask-based watershed
Algorithm, this algorithm we have to set those valley points will converge, those who do not. This is an interactive
Type image segmentation. We have to do is give us the known objects marked with different labels. If a
Regional certainly foreground or object, use one color (or grayscale value) label tag it. If a
The region is certainly not an object but a color background to use another label mark. While the remaining can not be determined
The region is on the foreground or the background with the 0 mark. This is our label. Then implement watershed algorithm.
Every irrigation, our label will be updated when the two labels of different colors meet on the construction of embankment
Dam until all drowned mountains, boundary objects (dams) Finally, we get a value of -1.
 
2, the function: cv2.watershed ()
 

Guess you like

Origin www.cnblogs.com/h694879357/p/12272999.html