This is an old revision of the document!
Morphological Image Analysis – Principles and Applications, Pierre Soille
The first question that may arise when we probe a set with a structuring element is “Does the structuring element fit the set?” The eroded set is the locus of points where the answer to this question is affirmative.
The eroded value at a given pixel $x$ is the minimum value of the image in the window defined by the structuring element when its origin is at $x$: $$[\varepsilon_{B}(f)](x) = \min_{b \in B} f(x+b)$$
81, 82
The dilation is the dual operator of the erosion and is based on the following question: “Does the structuring element hit the set?” The dilated set is the locus of points where the answer to this question is affirmative.
the dilated value at a given pixel $x$ is the maximum value of the image in the window defined by the structuring element when its origin is at $x$: $$[\delta{B}(f)](x) = \max_{b \in B} f(x+b)$$
83, 84
Only symmetric structuring elements containing their origin are considered. By doing so, we make sure that the arithmetic difference is always nonnegative.
The choice between internal or external gradient depends on the geometry and relative brightness of the objects to be extracted. For instance, an external gradient applied to a two or one pixel thick dark structure will provide a thin edge following the structure whereas an internal gradient will output a double edge (one on each side of the structure).
102
If the size of the SE is greater than 1, morphological gradients are referred
to as thick gradients: $$\rho_{nB} = \delta_{nB} - \varepsilon_{nB}$$.
Thick gradients give the maximum variation of the function in a neighbourhood
of size $n$. If the size $n$ equals the width $e$ of the transition between regions of homogeneous grey level, the thick gradient will output the contrast value $h$ between these regions. These gradients are therefore recommended when the transitions between objects are smooth. However, thick gradients output thick edges.
88
A combination of thick gradients of increasing size avoiding thick edges is presented in Sec. 4.6.
The opening $\gamma$ of an image $f$ by a structuring element $B$ is denoted by $\gamma_{B}(f)$ and is defined as the erosion of $f$ by $B$ followed by the dilation with the reflected SE $B$: $$\gamma_{B}(f) = \delta_{\check{B}}[\varepsilon_{B}(f)]$$
It is essential to consider the reflected SE for the dilation. Indeed, an erosion corresponds to an intersection of translations. It follows that a union of translations in the opposite direction (i.e., a dilation by the reflected SE) must be considered when attempting to recover the original image.
Geometric formulation in terms of SE fit using the question already introduced for the erosions: “Does the structuring element fit the set?” Each time the answer to this question is affirmative, the whole SE must be kept (for the erosion, it is the origin of the SE that is kept).
120, 121
The shape and size of the structuring element must be set according to the image structures that are to be extracted. For instance, if we are interested in removing all elongated objects while keeping disc shaped objects, the appropriate structuring element is a disc having a diameter larger than the width of the elongated objects.
The closing of an image $f$ by a structuring element $B$ is denoted by $\phi_{B}(f)$ and is defined as the dilation of $f$ with a structuring element $B$ followed by the erosion with the reflected structuring element $\check{B}$: $$\phi_{B}(f) = \varepsilon_{\check{B}}[\delta_{B}(f)]$$
Using set formalism, we have the following question for defining a closing: “Does the BE fit the background of the set?” If yes, then all points of the SE belong to the complement of the closing of the set.
123, 124
area opening – Removing all connected components whose area in number of pixels is smaller than a given threshold value $\lambda$: $$\gamma_{\lambda} = \bigvee_{i} \{ \gamma_{B_i} \text{is connected and } \text{card}(B_i) \geq \lambda \}$$
area closing – dual to area opening: $$\gamma_{\lambda} = \bigwedge_{i} \{ \phi_{B_i} \text{is connected and } \text{card}(B_i) \geq \lambda \}$$
128