Page 130 -
P. 130
104 Chapter 3 ■ Digital Morphology
connecting the components being broken in a number of places. Closing
this image (Figure 3.12c) fixes many of these breaks, but not all of them. It
is important to realize that when using real images it is rare for any single
technique to provide a complete and perfect solution to an image processing
or vision problem. A more complete method for fixing the circuit board may
use four or five more structuring elements and two or three other techniques
outside of morphology.
Closing can also be used for smoothing the outline of objects in an image.
Sometimes digitization followed by thresholding can give a jagged appearance
to boundaries; in other cases the objects are naturally rough, and it may
be necessary to determine how rough the outline is. In either case, closing can be
used. However, more than one structuring element may be needed, because the
simple structuring element is only useful for removing or smoothing single
pixel irregularities. Another possibility is repeated application of dilation
followed by the same number of erosions; N dilation/erosion applications
should result in the smoothing of irregularities of N pixels in size.
First consider the smoothing application, and for this purpose Figure 3.12a
will be used as an example. This image has been both opened and closed
already, and another closing will not have any effect. However, the outline
is still jagged, and there are still white holes in the body of the object. An
opening of depth 2 — that is, two dilations followed by two erosions — gives
Figure 3.13a.
(a) (b) (c) (d) (e) (f)
Figure 3.13: Multiple closings for outline smoothing. (a) Glyph from Figure 3.12a after
a depth 2 closing. (b) After a depth 3 closing. (c) A chess piece. (d) Thresholded chess
piece showing irregularities in the outline and some holes. (e) Chess piece after closing.
(f) Chess piece after a depth 2 closing.
Note that the holes have been closed and that most of the outline irregular-
ities are gone. On opening of depth 3, very little change is seen (one outline
pixel is deleted), and no further improvement can be hoped for. The example
of the chess piece in the same figure shows more specifically the kind of
irregularities introduced sometimes by thresholding, and illustrates the effect
that closings can have in this case.