This site is being phased out.

Dilation and erosion

From Mathematics Is A Science
Jump to navigationJump to search

Dilation is an operation that makes black each pixel adjacent to black. Erosion makes white each pixel adjacent to white. By adjacent pixel we understand one that shares an edge with the given pixel.

The original image with pixels as squares.
The result of dilation: the white pixels adjacent to the black pixels 1-4 turned black.
The result of erosion: the white pixels adjacent to the white pixels 5-8 turned white.














Dilation illustrated.jpg

Alternatively, it may be a pixel that shares a vertex. In case of a single erosion or dilation the difference may be ignored because pixels are small. In case of multiple application of these operations using the distance function may be preferable (the n-th round turns all white pixels within n-pixel distance from the "seed", black.).

The effect of multiple erosions on a test image is illustrated below:

Original
One erosion
Two erosions
Three erosions













Thus, dilation and erosion expand and shrink objects in a binary image, respectively. In the context of this site, these operations may be used to reveal “large” features of the image. If a feature disappears after several applications of one of these operations, it is “small” and should be ignored. For example, an object may disappear after a few rounds of erosions. A hole or a tunnel may close after several dilations. Therefore, the number of times it takes to destroy a feature may serve as a measure of its importance. In computational topology, this number is commonly called the persistence of the feature, see Robustness of topology. Robustness of measurements is discussed under Robustness of geometry.

Erosion and dilation are two elementary examples of cellular automata. Unfortunately, after multiple dilations even a round figure will become more and more square. As a result, these operations can't be used for modeling physical processes. An alternative may be discrete exterior calculus.

Dilation and erosion are found in Pixcavator under Tools.