Page 112 -
P. 112
86 Chapter 3 ■ Digital Morphology
matching a given pattern are deleted from the image, and dilation,in which a
small area about a pixel is set to a given pattern. However, depending on the
type of image being processed (bi-level, grey-level, or color), the definition of
these operations changes, so each must be considered separately.
3.2 Connectedness
Underlying most of digital morphology are the concepts of connectedness and
connected regions among sets of pixels. These are defined on bi-level images,
which is the usual domain of morphology. On a standard raster grid, each
pixel has a set of neighbors, or pixels that are thought to be ‘‘touching’’ it or
‘‘next to’’ it. Given that the coordinates of a pixel P are (i, j), the candidates for
its neighbors are:
(i − 1, j − 1) (i − 1, j)(i − 1, j + 1)
(i, j − 1) (i, j) (i, j + 1)
(i + 1, j − 1) (i + 1, j)(i + 1, j + 1)
The pixels that are different from (i, j) by one in either index would appear
to certainly be neighbors. They are the nearest pixels, being a distance of one
unit from P either horizontally or vertically. There are four of these, and so
they can be called 4-neighbors. The pixels diagonally next to P,those that differ
by one in both coordinates, can also be considered to be neighbors. Treating a
raster grid as a chessboard, these pixels are also one unit (square) away from
P, and there seems to be a natural neighbor relation between them. There are
eight of these pixels, and so they are called 8-neighbors of P.
A 4-connected region (or 4-region) is a set of pixels that are 4-connected to
each other. It consists of all pixels that are 4-connected, not just a subset, and
any pixel in that region is 4-connected to all the rest. Similarly, an 8-connected
region (or 8-region) is a set of pixels in which all pixels are 8-connected to each
other. Such regions within an image tend to represent objects that have been
scanned by a camera and processed into bi-level areas for processing — for
example, text on a page. Thus, it is important to find these, count them, smooth
them, and otherwise process them.
Figure 3.1 shows the difference between 4-connected and 8-connected
regions. Note that in some of these examples changing a single pixel from
black to white changes the number of regions in the image. This illustrates
some of the power of digital morphology, and foreshadows the discus-
sion that will take place. Regions can be linked by small numbers of pixels
that, when removed according to a set or carefully defined rules, yields a
different set of regions that have a clearer meaning or a different meaning
altogether.