Operators |
This chapter describes operators of gray value morphology.
Gray value morphology provides a set of operators that allow the non-linear manipulation of gray values in an image, depending on their pixel neighborhood. For instance, morphological gray value operators can be used to smooth or emphasize structural features in images. Unlike the binary operations in Morphology / Region, morphological gray value operators deal with input images that contain pixels with a range of more than one bit. Therefore gray value morphology can be seen as a generalization of region morphology. In the following paragraphs, we will take a closer look at the morphological gray value operators.
To perform a dilation or erosion, each pixel of the image is assigned a gray value depending on its neighborhood. Area and shape of the neighborhood affecting each pixel are defined by the chosen structuring element with the current pixel being the reference point. Implementing a dilation, every pixel of the input image is assigned the maximum gray value of its neighborhood, respectively the minimum gray value for an erosion. Accordingly, bright areas of the input image are enlarged by gray value dilation, whereas gray value erosion emphasizes dark areas.
(1) | (2) | (3) | (4) |
These operators can be used to dilate or erode an image:
Morphological Operator | Structuring Element | |
---|---|---|
gray_dilation | gray_erosion | arbitrary |
gray_dilation_rect | gray_erosion_rect | rectangular |
gray_dilation_shape | gray_erosion_shape | rhombus/rectangle/octagon |
Morphological grayscale operations are often part of the preprocessing of images before information can be extracted properly. The following example displays a case where a gray value erosion is necessary to read data code symbols. In order to fit a data model used for decoding, the gaps between the code elements in the image need to be reduced by enlarging local minima in a square shape. Therefore a gray value erosion is performed, using an adequately sized rectangle as the structuring element. The rectangle size depends on the data model created with create_data_code_2d_model, where the acceptable module gap size is determined.
(1) | (2) | (3) |
Gray value opening and gray value closing operators each are a combination of the operators explained above. Closing is a dilation followed by an erosion, while for an opening an erosion precedes a dilation operation. As seen in the example images, gray_closing reduces or even removes parts of the image that are darker than their neighborhood whereas gray_opening reduces lighter areas. Furthermore, using a suited structuring element you can preserve shapes while removing unwanted image artifacts.
(1) | (2) | (3) | (4) |
To take a closer look at areas that are affected by gray value opening or closing, you can perform a gray_tophat or gray_bothat transformation. The resulting image displays the difference between the original image and the opening respectively closing of an image. You can also use these operators to detect structures that match the shape of the structuring element.
The gray_range_rect operator gives you the opportunity to detect fine structures on homogeneous surfaces by visualizing the extent of local variations in pixel values.
(1) | (2) | (3) |
By applying the gray_range_rect operator you can perform a mitigated form of a gray value opening or closing operation. You can control the transformation by adjusting the parameter ModePercent .
(1) | (2) | (3) | (4) | (5) |
In the following list, the most important terms that are used in the context of Morphology are described.
Operator which does not necessarily preserve structures of the input image
Region which is used to scan the input image.
Operators |