## The Watershed Transformation

One of the most powerful tools for image segmentation in mathematical morphology is the watershed transformation [7]. A gray-level image f is interpreted as a topographic surface and a flooding process is simulated starting from the

(a) Starting with the local minima

(b) Two meeting lakes

Figure 7.7: The watershed transformation.

(a) Starting with the local minima

(b) Two meeting lakes w

(c) Watershed transformation

Figure 7.7: The watershed transformation.

local minima ("sources"). The flooding level s is the same for the whole image; all pixels with a gray level value lower than s belong therefore to a "lake" (see Fig. 7.7(a)). When two lakes meet, a "wall" is built between the two lakes, i.e., the pixel where the two lakes meet forms part of the watershed line WS(f) (see Fig. 7.7(b)). The whole image is flooded in this way giving an image that contains the watershed line WS(f) and as many regions as local minima in the original image f (see Fig. 7.7(c)). These regions are called catchment basins CBi in analogy to their topographic interpretation.

The presence of many minima dues to the noise present in real images results in over-segmentation. The number of minima can be reduced before calculating the watershed transformation by means of the morphological reconstruction. Therefore, we calculate a marker image m, which takes the value f (x) for all the "marked pixels" and imax elsewhere (see Fig. 7.8(a)). Then, we calculate the reconstruction by erosion Ry (m), i.e., we remove ("fill") all not marked minima (Fig. 7.8(a)). For this modified image, the watershed transformation gives a more persistent result (Fig. 7.8(b)).

(a) An image f, a marker m (in gray), (b) The watershed transformation and the reconstruction by erosion

Figure 7.8: The watershed transformation controlled by a marker m

(a) An image f, a marker m (in gray), (b) The watershed transformation and the reconstruction by erosion

Figure 7.8: The watershed transformation controlled by a marker m

0 0