In mathematical morphology, the closing of a set (binary image) A by a structuring element B is the erosion of the dilation of that set,
A\bulletB=(A ⊕ B)\ominusB,
where
⊕
\ominus
In image processing, closing is, together with opening, the basic workhorse of morphological noise removal. Opening removes small objects, while closing removes small holes.
Perform Dilation (
A ⊕ B
Suppose A is the following 11 x 11 matrix and B is the following 3 x 3 matrix:
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 1 1 1 0 1 1 1 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
For each pixel in A that has a value of 1, superimpose B, with the center of B aligned with the corresponding pixel in A.
Each pixel of every superimposed B is included in the dilation of A by B.
The dilation of A by B is given by this 11 x 11 matrix.
A ⊕ B
Now, Perform Erosion on the result: (
A ⊕ B
\ominusB
A ⊕ B
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 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
Assuming that the origin B is at its center, for each pixel in
A ⊕ B
Therefore the Erosion of
A ⊕ B
(
A ⊕ B
\ominusB
Therefore Closing Operation fills small holes and smoothes the object by filling narrow gaps.
(A\bulletB)\bulletB=A\bulletB
A\subseteqC
A\bulletB\subseteqC\bulletB
A\subseteqA\bulletB