Page 127 -
P. 127

Chapter 3 ■ Digital Morphology   101


                                 00 0
                                 11 1
                                 00 0
                                 00 0
                                 00 0
                                 11 1

                                 This file will be called elise_se.pbm. To perform the dilation seen in
                               Figure 3.9, the call to BinErode would be:


                                 BinErode
                                 Enter input image file name:               elise.pbm
                                 Enter structuring element file name:       elise_SE.pbm
                                 Enter output filename:                     out1.pbm

                               where the elise.pbm file contains the image 3.8a, and out1.pbm will be the
                               file into which the dilated image will be written (Figure 3.9c). The C function
                               bin_erode is implemented in a very similar manner to bin_dilate,and
                               appears in Figure 3.10.


                               3.3.5 Opening and Closing
                               The application of an erosion immediately followed by a dilation using the
                               same structuring element is referred to as an opening operation. The name
                               opening is a descriptive one, describing the observation that the operation
                               tends to ‘‘open’’ small gaps or spaces between touching objects in an image.
                               This effect is most easily observed when using the simple structuring element.
                               Figure 3.11 shows an image having a collection of small objects, some of them
                               touching each other. After an opening using simple, the objects are better
                               isolated and might now be counted or classified.
                                 Figure 3.11 also illustrates another, and quite common, use of opening: the
                               removal of noise. When a noisy grey-level image is thresholded some of the
                               noise pixels are above the threshold, and result in isolated pixels in random
                               locations. The erosion step in an opening will remove isolated pixels as well as
                               boundaries of objects, and the dilation step will restore most of the boundary
                               pixels without restoring the noise. This process seems to be successful at
                               removing spurious black pixels, but does not remove the white ones.
                                 The example in Figure 3.9 is actually an example of opening, albeit with
                               a more complex structuring element. The image was eroded, leaving only a
                               horizontal line, and then dilated by the same structuring element, which is
                               certainly an opening. What is being eroded in this case is all portions of the
                               image that are not staff lines, which the dilation subsequently restores. The
                               same description of the process applies to Figure 3.11; what is being eroded is
                               all parts of the image that are not small black squares, which are restored by
                               the dilation thus removing everything except that in which we are interested.
   122   123   124   125   126   127   128   129   130   131   132