This site is devoted to mathematics and its applications. Created and run by Peter Saveliev.

# Dilation and erosion

### From Mathematics Is A Science

*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.

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:

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.