An image with k grey levels,
,
similarly can have its connected components labeled. A 0-pixel is
assumed to be background, while each component is the set of
like-colored connected pixels. Our algorithm for grey scale connected
components of images is based upon the binary image algorithm in the
previous section. Again, there will be three phases, an initial
labeling, a merge of subimages, and a final updating of interior
labels.