ImageGear Professional v18.2 > User Guide > Using ImageGear > Image Processing > Basic Image Processing with IGProcessingCtl > Mathematical Morphology |
The field of mathematical morphology contributes a wide range of operators to image processing, all based around a few simple mathematical concepts from set theory. The operators are particularly useful for the analysis of binary images and common usages include edge detection, noise removal, image enhancement and image segmentation.
The two fundamental operations in mathematical morphology are erosion and dilation. Both of these operators take two pieces of data as input: an image to be eroded or dilated, and a structuring element (also known as a kernel). The two pieces of input data are each treated as representing sets of coordinates in a way that is slightly different for binary and grayscale images.
For a binary image, white pixels are normally taken to represent foreground regions, while black pixels denote background. (Note that in some implementations this convention is reversed, and so it is very important to set up input images with the correct polarity for the implementation being used). Then the set of coordinates corresponding to that image is simply the set of two-dimensional Euclidean coordinates of all the foreground pixels in the image, with an origin normally taken in one of the corners so that all coordinates have positive elements.
For a grayscale image, the intensity value is taken to represent height above a base plane, so that the grayscale image represents a surface in three-dimensional Euclidean space. Then the set of coordinates associated with this image surface is simply the set of three-dimensional Euclidean coordinates of all the points within this surface and also all points below the surface, down to the base plane. Note that even when we are only considering points with integer coordinates, this is a lot of points, so usually algorithms are employed that do not need to consider all the points.
The structuring element is already just a set of point coordinates (although it is often represented as a binary image). It differs from the input image coordinate set in that it is normally much smaller, and its coordinate origin is often not in a corner, so that some coordinate elements will have negative values. Note that in many implementations of morphological operators, the structuring element is assumed to be a particular shape (e.g. a 3x3 square) and so is hardwired into the algorithm.
Binary morphology can be seen as a special case of grayscale morphology in which the input image has only two gray levels at values 0 and 1.
Erosion and dilation work (at least conceptually) by translating the structuring element to various points in the input image, and examining the intersection between the translated kernel coordinates and the input image coordinates. For instance, in the case of erosion, the output coordinate set consists of just those points to which the origin of the structuring element can be translated, while the element still remains entirely `within' the input image.
Virtually all other mathematical morphology operators can be defined in terms of combinations of erosion and dilation along with set operators such as intersection and union. Some of the more important are opening and closing.
See the following sections:
Erosion is one of the fundamental operations in the mathematical morphology. It is usually applied to black and white images, but can also be applicable to grayscale ones. The basic effect of the operation is to erode away the boundaries of regions of foreground pixels (white pixels). Thus areas of foreground pixels shrink in size, and holes within those areas become larger. Applying this to the grayscale image will make bright objects smaller, i.e., image darker.
Both erosion and dilation work by translating the structuring element to various points in the input image, and examining the intersection between the translated kernel coordinates and the input image coordinates. For instance, in the case of erosion, the output coordinate set consists of just those points to which the origin of the structuring element can be translated, while the element still remains entirely `within' the input image. In case of dilation the effect is opposite. See Erode Method.
Dilation is one of the fundamental operators in the mathematical morphology. It is usually applied to black and white images, but can also be applicable to grayscale ones. The basic effect of the operation is to gradually enlarge the boundaries of regions of foreground pixels (white pixels). Thus areas of foreground pixels grow in size while holes within those regions become smaller. Applying this to the grayscale image will make bright objects larger, i.e. image lighter.
Both erosion and dilation work by translating the structuring element to various points in the input image, and examining the intersection between the translated kernel coordinates and the input image coordinates. For instance, in the case of erosion, the output coordinate set consists of just those points to which the origin of the structuring element can be translated, while the element still remains entirely `within' the input image. In case of dilation the effect is opposite. See Dilate Method.
Opening is another operation from mathematical morphology that is derived from the fundamental operations of erosion and dilation. Like those operators it is usually applied to black and white images, but can be applicable to grayscale images as well. The basic effect of an opening is somewhat like erosion in that it tends to remove some of the foreground (bright) pixels from the edges of regions of foreground pixels. However it is less destructive than erosion in general. As with other morphological operators, the exact operation is determined by a structuring element. The effect of the operator is to preserve foreground regions that have a similar shape to this structuring element, or that can completely contain the structuring element, while eliminating all other regions of foreground pixels. See Open Method.
Closing is another operation from mathematical morphology that is derived from the fundamental operations of erosion and dilation. Like those operators it is usually applied to black and white images, but can be applicable to grayscale images as well. Closing is similar in some ways to dilation in that it tends to enlarge the boundaries of foreground (bright) regions in an image (and shrink background color holes in such regions), but it is less destructive of the original boundary shape. As with other morphological operators, the exact operation is determined by a structuring element. The effect of the operator is to preserve background regions that have a similar shape to this structuring element, or that can completely contain the structuring element, while eliminating all other regions of background pixels. See Close Method.