Page 148 -
P. 148
122 Chapter 3 ■ Digital Morphology
like? The binary dilation spreads out the line, as determined by the locations of
the ‘‘1’’ pixels, making it three pixels wide instead of only one. The grey-level
image should have a corresponding appearance after dilation, where the
difference between the foreground and background pixels should be about
the same as in the original and the line should be about three pixels wide. An
example of how the dilated grey-level line (Figure 3.23c) might appear is given
in Figure 3.23d.
This appears to be a reasonable analogue of dilation for the grey-level case,
at least for a simple image. The image in Figure 3.23d was computed from
Figure 3.23c as follows:
(A ⊕ S)[i, j] = max{A[i − r, j − c] + S[r, c] [i − r, j − c] ∈ A,[r, c] ∈ S} (EQ 3.30)
where S is the simple structuring element and A is the grey-level image to be
dilated. This is one definition of a grey-scale dilation, and it can be computed
as follows:
1. Position the origin of the structuring element over the first pixel of the
image being dilated.
2. Compute the sum of each corresponding pair of pixel values in the
structuring element and the image.
3. Find themaximum valueofall thesesums, and set thecorresponding
pixel in the output image to this value.
4. Repeat this process for each pixel in the image being dilated.
The values of the pixels in the structuring element are grey levels as well,
and can be negative. Because negative-valued pixels can’t be displayed there
are two possible ways to deal with negative pixels in the result: they could be
set to 0 (underflow), or the entire image could have its levels shifted so that
the smallest became 0 and the rest had the same values relative to each other
as they did before. We choose the former approach for simplicity.
Given the definition of dilation in Equation 3.30, a possible definition for
grey-scale erosion would be:
(A S)[i, j] = min{A[i − r, j − c] − S[r, c] [i − r, j − c] ∈ A,[r, c] ∈ S} (EQ 3.31)
This definition of erosion works because it permits the same duality between
erosion and dilation that was proved in section 3.2.3.
Figure 3.24 shows an application of grey-scale erosion and dilation to the
image of keys first seen in Figure 3.20. The structuring element was simple,
made into grey levels. While it is not immediately clear why this operation
is useful, the parallel with binary dilation and erosion is plain enough. Note,