These definitions extend naturally to the domain of grayscale images. Indeed, the so-called gradient image (see Section 7.3 for a general discussion of edge detection) has a morphological implementation in terms of grayscale erosion and dilation operations. The morphological gradient

(A) of a grayscale image A is typically defined as

Image segmentation by connected components analysis is a partitioning scheme which assigns a unique label to each connected cluster of one-valued pixels in a binary image [Bov00,

Ros66,

Soi02]. In the function

RegionLabel, the labels are simply successive integers. The maximum value of the result is therefore a count of the number of distinct connected components in the picture. The following returns the labeled image.

The watershed transform is a popular segmentation technique based on the dual concepts of flooding and grayscale images as topographic reliefs [Mey90,

Roe00,

Soi02,

Vin91]. The flooding process forms so-called catchment basins that grow in size as the water level rises. In the field of topography the lines of separation between nearby basins are called watersheds. The construction of catchment basins and watershed lines in digital images often leads to meaningful segmentation results.