4. Binary and Grayscale Morphological OperatorsMathematical morphology provides an approach to the processing of digital images that is based on the spatial structure of objects in a scene [2, 4, 5, 6, 7]. Unlike the linear operators discussed so far, morphological operators modify the shape of pixel groupings instead of their amplitude. The fundamental operators of binary morphology are erosion and dilation. These operators are typically defined using set-theoretic concepts, but here we restrict our discussion to their matrix formulations. In analogy with the linear operators discussed in the previous section, binary morphological operators may be implemented using convolution-like algorithms, with the fundamental operations of addition and multiplication replaced by logical OR and AND. To simplify the notation and without loss of generality we assume all arrays have square dimensions. With as an binary-valued image, as the typically small structuring element of dimensions , and as the dilation result, the matrix formulation is as follows:
with , and where and are the logical OR (union) and logical AND (intersection) operators, respectively. For the special case of a structuring element () we can write Equation (4.1) explicitly as
Equations (4.1) and (4.2) resemble the familiar convolution sum formulation with OR replacing addition and AND replacing multiplication. Thus the structuring element plays an analogous role in morphological signal processing to the FIR filter in LSI signal processing. This realization leads quickly to an implementation of erosion using Here we define an example array A.
The matrix formulation in Equation (4.1) assumes an odd-sized structuring element with the origin centered in the array. Therefore, we define a array B with an L-shaped arrangement of 1s as follows.
The binary dilation of image A by structuring element B, namely , is given by the following.
Erosion is a morphological dual to dilation. The structuring element may again be viewed as a morphologic filter that is scanned across an image. As in the case of dilation, erosion may be defined by the following correlation-like formulation. The erosion of image with structuring element , denoted , has the following matrix formulation:
with . Operators and are the logical OR (union) and logical AND (intersection) operators, respectively, and is the point-wise complement of structuring element . In effect, erosion results in a value of 1 at position in if the spatial arrangement of 1s in is a subset of the arrangement of 1s in . In particular, for the special case of a structuring element () of all 1s, we can write Equation (4.3) explicitly as
Here is the binary erosion of array A by structuring element B, namely .
Here we demonstrate the operations of binary erosion and dilation. First we threshold the example
This shows the original and the binary images.
This defines a square structuring element.
Here we show the results of dilation and erosion.
Note how dilation increases the white regions in the image, hence the use of the word dilation for this operator. The operation of erosion, on the other hand, decreases or shrinks the area occupied by white pixels. Binary morphological concepts may be extended to grayscale images. The common approach is to use a grayscale extremum operation over a small neighborhood defined by the structuring element. A typically small structuring element is scanned over an image and, at each position, the maximum of point-by-point sums of the image and the structuring element is computed. This may again be implemented as a convolution-like operation. For notational convenience we assume arrays with square dimensions. Then, given a structuring element and an image array , the dilation of by may be defined as . for all such that , with . For example, with and for all i, j, we get
Dilation tends to grow the white regions of an image. If the structuring element has positive values, the resulting image tends to be brighter. Grayscale erosion is the dual of grayscale dilation; the structuring element values are subtracted from the image during the scanning process and a minimum of each set of values is returned. This may be implemented as a correlation-like operation where the extremum operator Min and subtraction replace multiplication and addition, respectively. Given a structuring element and an image array , the dilation of by may be defined as
for all such that , with . Erosion tends to shrink the white regions of an image. If the structuring element has positive values, the resulting image tends to be darker. Here we show an example of a morphological gradient operator. The morphological boundary of image (i.e., the edges) is defined as
In Equation (4.8) symbols and are used to represent grayscale erosion and grayscale dilation, respectively. This defines a uniform 3 × 3 structuring element.
Here is the result of a morphological gradient operation on the example image using a uniform structuring element of 1s. We use
This shows the original image and its morphological gradient.
Converted by Mathematica |