Morphological gradient
Figure 5-29: Morphological gradient applied to a simple Boolean image.
Our next available operator is the morphological gradient. For this one, it is probably easier to start with a
formula and then figure out what it means:
𝑔𝑟𝑎𝑑𝑖𝑒𝑛𝑡 𝑠𝑟𝑐 = !𝑑𝑖𝑙𝑎𝑡𝑒 𝑠𝑟𝑐 – 𝑒𝑟𝑜𝑑𝑒 𝑠𝑟𝑐 ."
As we can see in Figure 5-29, the effect of subtracting the eroded (slightly reduced) image from the dilated
(slightly enlarged) image is to leave behind a representation of the edges of objects in the original image.
Figure 5-30: Morphological gradient applied to (one-dimensional) non-Boolean image: as expected, the
operator has its highest values where the grayscale image is changing most rapidly.
With a grayscale image (
Figure 5-30), we see that the value of the operator is telling us something about how fast the image
brightness is changing; this is why the name “morphological gradient” is justified. Morphological gradient
is often used when we want to isolate the perimeters of bright regions so we can treat them as whole objects
(or as whole parts of objects). The complete perimeter of a region tends to be found because a contracted