Erosion (usually represented by ⊖) is one of two fundamental operations (the other being
dilation
Dilation (or dilatation) may refer to:
Physiology or medicine
* Cervical dilation, the widening of the cervix in childbirth, miscarriage etc.
* Coronary dilation, or coronary reflex
* Dilation and curettage, the opening of the cervix and surgic ...
) in
morphological image processing
Mathematical morphology (MM) is a theory and technique for the analysis and processing of geometrical structures, based on set theory, lattice theory, topology, and random functions. MM is most commonly applied to digital images, but it can be empl ...
from which all other morphological operations are based. It was originally defined for
binary image
A binary image is one that consists of pixels that can have one of exactly two colors, usually black and white. Binary images are also called ''bi-level'' or ''two-level'', Pixelart made of two colours is often referred to as ''1-Bit'' or ''1b ...
s, later being extended to
grayscale
In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an ''amount'' of light; that is, it carries only intensity information. Graysca ...
images, and subsequently to
complete lattice
In mathematics, a complete lattice is a partially ordered set in which ''all'' subsets have both a supremum (join) and an infimum (meet). A lattice which satisfies at least one of these properties is known as a ''conditionally complete lattice.'' ...
s. The erosion operation usually uses a
structuring element for probing and reducing the shapes contained in the input image.
Binary erosion
In binary morphology, an image is viewed as a
subset
In mathematics, Set (mathematics), set ''A'' is a subset of a set ''B'' if all Element (mathematics), elements of ''A'' are also elements of ''B''; ''B'' is then a superset of ''A''. It is possible for ''A'' and ''B'' to be equal; if they are ...
of a
Euclidean space
Euclidean space is the fundamental space of geometry, intended to represent physical space. Originally, that is, in Euclid's Elements, Euclid's ''Elements'', it was the three-dimensional space of Euclidean geometry, but in modern mathematics ther ...
or the
integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
grid
Grid, The Grid, or GRID may refer to:
Common usage
* Cattle grid or stock grid, a type of obstacle is used to prevent livestock from crossing the road
* Grid reference, used to define a location on a map
Arts, entertainment, and media
* News g ...
, for some dimension ''d''.
The basic idea in binary morphology is to probe an image with a simple, pre-defined shape, drawing conclusions on how this shape fits or misses the shapes in the image. This simple "probe" is called
structuring element, and is itself a binary image (i.e., a subset of the space or grid).
Let ''E'' be a Euclidean space or an integer grid, and ''A'' a binary image in ''E''.
The erosion of the binary image ''A'' by the structuring element ''B'' is defined by:
::
,
where ''B''
''z'' is the translation of ''B'' by the vector z, i.e.,
,
.
When the structuring element ''B'' has a center (e.g., a disk or a square), and this center is located on the origin of ''E'', then the erosion of ''A'' by ''B'' can be understood as the locus of points reached by the center of ''B'' when ''B'' moves inside ''A''. For example, the erosion of a square of side 10, centered at the origin, by a disc of radius 2, also centered at the origin, is a square of side 6 centered at the origin.
The erosion of ''A'' by ''B'' is also given by the expression:
, where ''A
−b'' denotes the translation of ''A'' by ''-b''.
Example
Suppose A is a 13 x 13 matrix and B is a 3 x 3 matrix:
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
Assuming that the origin B is at its center, for each pixel in A superimpose the origin of B, if B is completely contained by A the pixel is retained, else deleted.
Therefore the Erosion of A by B is given by this 13 x 13 matrix.
0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 0 0 1 1 1 1 0
0 1 1 1 1 0 0 0 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0
This means that only when B is completely contained inside A that the pixels values are retained, otherwise it gets deleted or eroded.
Properties
* The erosion is
translation invariant
In geometry, to translate a geometric figure is to move it from one place to another without rotating it. A translation "slides" a thing by .
In physics and mathematics, continuous translational symmetry is the invariance of a system of equat ...
.
* It is
increasing
In mathematics, a monotonic function (or monotone function) is a function between ordered sets that preserves or reverses the given order. This concept first arose in calculus, and was later generalized to the more abstract setting of order ...
, that is, if
, then
.
* If the origin of ''E'' belongs to the structuring element ''B'', then the erosion is ''anti-extensive'', i.e.,
.
* The erosion satisfies
, where
denotes the
morphological dilation.
* The erosion is
distributive over
set intersection
In set theory, the intersection of two sets A and B, denoted by A \cap B, is the set containing all elements of A that also belong to B or equivalently, all elements of B that also belong to A.
Notation and terminology
Intersection is writt ...
Grayscale erosion
In
grayscale
In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an ''amount'' of light; that is, it carries only intensity information. Graysca ...
morphology, images are
functions mapping a
Euclidean space
Euclidean space is the fundamental space of geometry, intended to represent physical space. Originally, that is, in Euclid's Elements, Euclid's ''Elements'', it was the three-dimensional space of Euclidean geometry, but in modern mathematics ther ...
or
grid
Grid, The Grid, or GRID may refer to:
Common usage
* Cattle grid or stock grid, a type of obstacle is used to prevent livestock from crossing the road
* Grid reference, used to define a location on a map
Arts, entertainment, and media
* News g ...
''E'' into
, where
is the set of
reals,
is an element larger than any real number, and
is an element smaller than any real number.
Denoting an image by ''f(x)'' and the grayscale structuring element by ''b(x)'', where B is the space that b(x) is defined, the grayscale erosion of ''f'' by ''b'' is given by
::