Page 152 -
P. 152
126 Chapter 3 ■ Digital Morphology
The first step in the inspection process is to gain a good estimate of the
location of the object being inspected. This is done by thresholding the image
and then using the thresholded image as a mask: into an all-black image,
copy those pixels from the original that correspond to a white pixel in the
thresholded image (3.26d). The masked image is then closed using a circular
structuring element with grey values. The result will be to raise the grey levels
of the pixels in the defects to near that of the surrounding pixels, giving a clear
image of the guard in the sampled orientation. When the original is subtracted
from this image, the defect will stand out in contrast to the guard (3.26f)
Thresholding will increase the contrast further, and the pixels that are white
in both this image and the original thresholded image are of special interest
(3.26h). Unfortunately, some of the pixels near the edges of the object(s) have
been blurred a little, and so any pixels near the original boundary (as found by
a morphological operation as well) are deleted, giving an image showing only
potential defects as black pixels. As confirmation of this process, the image
having no defects was also processed in the same way, and it shows no black
pixels in the final image.
Many kinds of inspection tasks can be carried out in a similar way, including
the inspection of paper for dirt, glass for bubbles, and wood and plastic for
defects.
3.4.2 Smoothing
One possible smoothing operation involves a grey-level opening followed by
a closing. This will remove excessively bright and excessively dark pixels from
the image; such pixels can be the result of a noise process, but unfortunately
might also be legitimate data values. The price to be paid for noise reduction
is a general blurring of the image.
Figure 3.28a shows an image of a disk guard that has been subjected
to Gaussian (normal distribution) noise with a standard deviation of 30.
Figure 3.28c shows the result of morphological smoothing applied to this
image; initially, it is not clear which image is to be preferred. However,
the same two images after thresholding (Figures 3.28b and 3.28d) clearly
demonstrate that the smoothing process eliminates much of the problem
noise, which now shows up as a ‘‘salt and pepper’’ effect, and which would
certainly create problems in later processing.
The structuring element used to smooth the disk guard image was simple,
but the choice would depend on the type of noise being cleaned up. One
common problem is the appearance of scan lines in an image that was obtained
by photographing a television of video screen. Figure 3.29 shows an example
of this sort of structured noise. The structuring element was constructed
by looking at the original noisy image in detail; the distance between scan
lines was about nine pixels, and the grey values in the structuring element