Mathematical morphology is a set-theoretical approach to multi-dimensional digital signal or image analysis, based on shape. The signals are locally compared with so-called structuring elements S of arbitrary shape with a reference point R, e.g.:
The aim is to transform the signals into simpler ones by removing irrelevant information. Morphological operations can be applied to binary and greylevel signals. The most basic building blocks for many morphological operators are erosion and dilation. We will define these operations without any mathematical rigour, and will therefore restrict ourselves to relatively simple structuring elements like the first four above. For a binary image we will define:
The eroded image of an object O with respect to a structuring element S with a reference point R, File:Hepa img706.gif , is the set of all reference points for which S is completely contained in O.
The dilated image of an object O with respect to a structuring element S with a reference point R, File:Hepa img707.gif , is the set of all reference points for which O and S have at least one common point.
Opening is defined as an erosion, followed by a dilation: File:Hepa img708.gif .
Closing is defined as a dilation, followed by an erosion: File:Hepa img709.gif .
In the following figure we show the sequence of opening and closing with a square structuring element, with the reference point in the centre.
The examples show that erosions and dilations shrink and expand objects, respectively; they remove and add parts of objects, and in general cannot be inverted. The choice of the structuring element is of extreme importance, and depends on what should be extracted or deleted from the image. For shapes one wants to keep, the choice must be a structuring element and an invertible sequence of morphological operators The morphological operators can easily be extended to greylevel images. Erosion and dilation will be replaced by the maximum/minimum operator ( Rank Filter).
The following one-dimensional example shows how opening can be used to remove impulse noise:
In the next figure, it is the signal which is ``spiky and must be extracted; the signal and the result of the four basic morphological operations are shown. The second row shows how the difference between the original and the opened signal, the ``top hat transform, can be used for contrast stretching and peak detection. In the middle, the original signal is plotted with the opened signal and with a signal that was first closed and then opened. The last plot illustrates the better performance if one uses this upper ``noise envelope.
Morphological operations can also be used for edge detection. It might seem that the simple difference between a dilated and an eroded signal could define an edge, but this method is very noise sensitive. In Lee86 it is recommended to smooth first the original signal and then use the operator File:Hepa img713.gif , where s is the smoothed original, and d and e are the dilated and eroded versions of s, respectively:
Good introductions to mathematical morphology are e.g.: Dougherty92, Haralick87, Maragos87. The more mathematically inclined reader may consult Serra80.