PANDORE Version 6 | GREYC-IMAGE |
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).
Returns SUCCESS or FAILURE.
pbinarization 100 1e30 examples/tangram.pan i1.pan pdistance i1.pan i2.pan plabeling 8 i1.pan i3.pan pwatershed i3.pan i2.pan i4.pan pboundary 8 i4.pan out.pan
Author: Abderrahim Elmoataz, Olivier Lezoray