| Image Processing Toolbox | ![]() |
Dilation- and Erosion-Based Functions
This section describes two common image processing operations that are based on dilation and erosion:
This table lists other functions in the toolbox that perform common morphological operations that are based on dilation and erosion. For more information about these functions, see their reference pages.
| Function |
Morphological Definition |
bwhitmiss |
Logical AND of an image, eroded with one structuring element, and the image's complement, eroded with a second structuring element. |
imbothat |
Subtracts the original image from a morphologically closed version of the image. Can be used to find intensity troughs in an image. |
imclose |
Dilates an image, and then erodes the dilated image using the same structuring element for both operations. |
imopen |
Erodes an image and then dilates the eroded image using the same structuring element for both operations. |
imtophat |
Subtracts a morphologically opened image from the original image. Can be used to enhance contrast in an image. |
Skeletonization
To reduce all objects in an image to lines, without changing the essential structure of the image, use the bwmorph function. This process is known as skeletonization.
Figure 9-5: Circbw.tif Before and After Skeletonization
Perimeter Determination
The bwperim function determines the perimeter pixels of the objects in a binary image. A pixel is considered a perimeter pixel if it satisfies both of these criteria:
For example, this code finds the perimeter pixels in a binary image of a circuit board.
Figure 9-6: Circbw.tif Before and After Perimeter Determination
| Combining Dilation and Erosion | Morphological Reconstruction | ![]() |