Especially during cell analysis, it can be important to know the growth stages of cell particles. Using the image processing erosion and dilation operations, you can view the possible growth stages of these particles.
Erosion operations peel off layers from objects or particles, removing extraneous pixels and small particles from the image.
Dilation operations add layers to objects or particles, enlarging any particle. Dilation can return eroded particles to their original size (but not necessarily to their exact original shape).
Erosion and dilation are neighborhood operations that determine each pixel's value according to its geometric relationship with neighborhood pixels, and as such, are part of a group of operations known as morphological operations. This section describes basic erosion and dilation performed using MimErode() and MimDilate(). Both these functions use predefined kernels to perform operations. For a description of advanced erosion and dilation, performed by MimMorphic(), see the Custom morphological operations section of Chapter 4: Advanced image processing.
They are also the basic operations used to perform the opening and closing operations discussed in the following section.
Note, zero pixels are considered background, while non-zero pixels are considered foreground and part of objects.
You can perform a basic erosion operation on 3 by 3 neighborhoods, using MimErode().
If the erosion mode is set to M_BINARY, any pixel whose neighborhood is not completely white (any non-zero pixel is considered white) is changed to black (0 is considered black).
If the erosion mode is set to M_GRAYSCALE, each pixel is replaced with the minimum value in its neighborhood.
You can use the iteration parameter of MimErode() to perform an erosion on larger neighborhoods. Iterating the erosion is the equivalent to performing an erosion on a (1 + (2* i)) by (1 + (2* i)) neighborhood where i is the number of iterations. For example, two iterations of a 3x3 erosion is equivalent to a 5x5 erosion, and three iterations is equivalent to a 7x7 erosion.
You can perform a basic dilation operation on 3 by 3 neighborhoods, using MimDilate().
If the dilation mode is set to M_BINARY, any pixel that has one or more white pixels (any non-zero pixel is considered white) in its neighborhood is set to white (0xff in an 8-bit image).
If the dilation mode is set to M_GRAYSCALE, each pixel is replaced with the maximum value in its neighborhood.
The MimDilate() function is similar to the MimErode() function in that iterating it will effectively cause a dilation on larger neighborhoods. Iterating the dilation is the equivalent to performing a dilation on a (1 + (2* i)) by (1 + (2* i)) neighborhood where i is the number of iterations. For example, two iterations of a 3x3 dilation is equivalent to a 5x5 dilation, and three iterations is equivalent to a 7x7 dilation.
You can use erosion or dilation to find the perimeter of objects. Erode or dilate a binary image and `XOR' the result with the original image, using MimArith().
The following example shows how to obtain the exoskeletons of objects in an image.