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 employed as well on graphs, surface meshes, solids, and many other spatial structures. Topological and geometrical continuous-space concepts such as size, shape, convexity, connectivity, and geodesic distance, were introduced by MM on both continuous and discrete spaces. MM is also the foundation of morphological image processing, which consists of a set of operators that transform images according to the above characterizations. MM was originally developed for binary images, and was later extended to grayscale functions and images. The subsequent generalization to complete lattices is widely accepted today as MM's theoretical foundation.
Binary morphology
In binary morphology, an image is viewed as a subset of an Euclidean space or the integer grid , for some dimension d.
Structuring element 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).
Basic operators
The basic operations are shift-invariant (translation invariant) operators strongly related to Minkowski addition.
Let E be a Euclidean space or an integer grid, and A a binary image in E.
Erosion
The erosion of the binary image A by the structuring element B is defined by:
,
where Bz is the translation of B by the vector z, i.e., , .
When the structuring element B has a center (e.g., B is a disk or a square), and this center is located on the origin of E, then the erosion of A by