EP04_06 — 🧩 Morphological Closing (Filling of Gaps)
4.9.6 EP04_06 🧩 Morphological Closing (Filling of Gaps)
In fingerprint digitalization, skin ridges sometimes become interrupted by dirt or dryness, creating small gaps in the continuous curve that should exist. Closing — dilation followed by erosion with the same structuring element — is the dual operator of opening: it fills small holes and narrow indentations, without significantly altering the external contour of the object. It is the standard step before extracting the skeleton of a fingerprint. See Figure 4.35 for a simulation of this EP.
4.9.6.1 📋 Implementation Guidelines
Image dimensions: Read the integers \(L\) (rows) and \(C\) (columns) from \(f\).
Dimensions of \(B\): Read the integers \(L_B\) (rows) and \(C_B\) (columns) of the structuring element.
Structuring element: Read the matrix \(B\) with values \(0\) or \(1\), row by row.
Data: Read the binary matrix \(f\) (values \(0\) or \(1\)), row by row.
Dilation: Compute \(d = f \oplus B\), using exactly the algorithm from EP04_03 (reflecting \(B\), without padding).
Erosion: Compute \(g = d \ominus B\), using exactly the algorithm from EP04_04 (without reflecting \(B\), without padding) — now applied to \(d\), not to \(f\).
Output: Display the resulting matrix \(g\) (the closing of \(f\) by \(B\)) with dimensions \(L \times C\).
4.9.6.2 📌 Computational Constraints
Fixed order: It is always dilation first, then erosion — the reverse order corresponds to the opening from EP04_05.
Same \(B\): The structuring element used in the dilation and in the erosion must be identical.