Watershed segmentation
Watershed is a segmentation method that is known for its efficiency. The method essentially starts from user-specified starting (seed) points from which regions grow. Assuming that good starting seeds can be provided, the resulting segmentations are useful for many purposes.
Note
For more details and examples about the watershed transform for image segmentation, see http://cmm.ensmp.fr/~beucher/wtshed.html.
The function watershed(InputArray image, InputOutputArray markers)
accepts a 3-channel input image and an image called markers
with the seeds. The latter has to be a 32-bit single-channel image. Seeds may be specified in markers
as connected components with positive values (0 cannot be used as a value for seeds). As an output argument, each pixel in markers
will be set to a value of the seed components or -1
at boundaries between the regions. OpenCV includes a watershed example ([opencv_source_code]/samples/cpp/watershed.cpp
) in which the user has to draw the seed...