PANDORE Version 6 GREYC-IMAGE

pwatershed



Performs the watershed on image.



Synopsis

pwatershed [-m mask] [rg_in|-] [im_pot|-] [rg_out|-]

Description

pwatershed segments images into watershed regions and their boundaries. Considering the input image im_pot as a surface, each seeds of the input region rg_in can be thought of as the point to which water falling on the surrounding region drains. The boundaries of the watersheds lie on the tops of the ridges. This operator labels each watershed region with a unique index, and sets the boundaries to zero.

If the potential image im_pot is an image of gray levels. Each pixel value corresponds to the potential value of the point. For example, an image of distance to the objects borders or directly the image of the gray levels are acceptable potential images.
If the potential image im_pot is a color image, then the value of potential is the Euclidean distance between the color of the point and the average color of the area.

The principle of the algorithm is to label all the pixels that touch a seed area while beginning by those which have the lowest potential value. For that, one manages a priority file.

Note: To obtain an acceptable result, it is necessary that the seeds are minima of the potential image. For that, it can be necessary to reverse the image of potentials (see pinverse).

Inputs

Outputs

Result

Returns SUCCESS or FAILURE.

Examples

See also

Morphology

C++ prototype

Errc PWatershed( const Reg2d &rg_in, const Img2duc &im_pot, Reg2d &rg_out );

Author: Abderrahim Elmoataz, Olivier Lezoray