Skip to content

Morphological Reconstruction

Ordinary morphological operations transform an image according to a structuring element. Morphological reconstruction adds another idea: a transformation evolves from a starting set, but a second image constrains where that evolution is allowed.

Reconstruction is based on two sets: a marker \(M\), which provides the starting locations, and a mask \(X\), which determines where the marker is allowed to propagate.

1. Why Reconstruction?

Ordinary dilation grows a set according to a structuring element. Ordinary erosion shrinks a set according to a structuring element.

Morphological reconstruction adds a second constraint: the transformation is not free to propagate everywhere.

Ordinary Morphology

Image + Structuring Element

The transformation is determined by the local morphological condition.

Morphological Reconstruction

Marker + Mask + Neighborhood

A marker evolves only through locations permitted by a mask.

Reconstruction is a form of constrained morphological propagation.

2. Marker and Mask

For reconstruction by dilation, let \(M\) be the marker and \(X\) be the mask. The marker must initially be contained in the mask:

\[ M\subseteq X. \]
The Marker Begins Inside the Mask
Mask X
Marker M

Marker \(M\)

The marker contains the locations from which reconstruction begins.

Starting Set

Mask \(X\)

The mask defines the region through which the marker is allowed to propagate.

Allowed Region
Think of \(M\) as a set of seed pixels. The mask \(X\) determines which locations those seeds are allowed to reach.

3. Geodesic Dilation

A single geodesic dilation first dilates the marker and then restricts the result to the mask:

\[ \delta_X^{(1)}(M) = (M\oplus B)\cap X. \]
Start with Marker \(M\)
↓
Dilate: \(M\oplus B\)
↓
Restrict the Result with Mask \(X\)
↓
\(\delta_X^{(1)}(M)\)
Dilation attempts to expand the marker. The intersection with \(X\) prevents that expansion from leaving the mask.

4. Reconstruction by Dilation

A single geodesic dilation normally reaches only the immediate neighborhood of the current marker. The operation is therefore repeated.

\[ \delta_X^{(n)}(M) = \delta_X^{(1)} \left( \delta_X^{(n-1)}(M) \right). \]
The Mask Stays Fixed While the Marker Propagates
\(M^{(0)}\)
Initial Marker
\(M^{(1)}\)
One Geodesic Step
\(M^{(2)}\)
Further Propagation
\(M^{(k)}=R_X^\delta(M)\)
No Further Change

The blue mask remains unchanged throughout the process. Only the current reconstruction expands.

At convergence, the marker has reached every location in the mask that is reachable from the initial marker under the chosen neighborhood.

\[ R_X^\delta(M) = \delta_X^{(k)}(M) \] when \[ \delta_X^{(k+1)}(M) = \delta_X^{(k)}(M). \]

5. Convergence

It is useful to describe reconstruction using a sequence of intermediate marker sets.

\[ M^{(0)}=M \] \[ M^{(n+1)} = \delta_X^{(1)} \left( M^{(n)} \right). \]
\(M^{(0)}=M\)
↓
\(M^{(1)}=\delta_X^{(1)}(M^{(0)})\)
↓
\(M^{(2)}=\delta_X^{(1)}(M^{(1)})\)
↓
\(\cdots\)
↓
\(M^{(k+1)}=M^{(k)}\)

Every step can add only pixels belonging to \(X\). Because a digital image contains a finite number of pixels, the sequence eventually stops changing.

Reconstruction has converged when another geodesic step produces exactly the same set.

6. Connected-Component Extraction

Reconstruction provides a direct connection to connected components.

Suppose the mask is a binary set \(X\), and the marker contains only one foreground pixel \(p\in X\):

\[ M=\{p\}. \]

Then

\[ R_X^\delta(\{p\}) \]

reconstructs the portion of \(X\) that can be reached from \(p\) using the neighborhood chosen for geodesic propagation.

1

Choose a Seed

Place the marker inside the foreground component that you want to recover.

2

Propagate Inside \(X\)

Geodesic dilation can move only through locations allowed by the mask.

3

Recover the Component

Disconnected foreground components without a marker remain absent.

The result depends on the neighborhood used for propagation. Pixels connected under 8-connectivity may not be connected under 4-connectivity.

7. Opening by Reconstruction

Opening by reconstruction begins with erosion, but instead of using an ordinary dilation to rebuild the result, the eroded image becomes the marker.

\[ M = X\ominus B. \]

The original image \(X\) becomes the mask:

\[ \gamma_R(X) = R_X^\delta(M) = R_X^\delta(X\ominus B). \]
Original Image \(X\)
↓
Erode to Form Marker \(M=X\ominus B\)
↓
Use Original \(X\) as the Mask
↓
Reconstruct \(M\) Inside \(X\)
↓
Opening by Reconstruction
Erosion determines which structures retain a marker. Reconstruction then restores the portions of those surviving structures that remain connected to the marker.

8. Ordinary Opening vs. Opening by Reconstruction

○

Ordinary Opening

\[ X\circ B = (X\ominus B)\oplus B \]

Erosion is followed by ordinary dilation.

The boundaries of structures that survive the erosion are rebuilt according to the structuring element.

R

Opening by Reconstruction

\[ \gamma_R(X) = R_X^\delta(X\ominus B) \]

Erosion is followed by constrained propagation under the original image.

A surviving marker can recover the connected portion of the original structure allowed by the mask.

Ordinary opening uses dilation to rebuild an eroded image. Opening by reconstruction instead uses the original image as a geometric constraint.

9. Geodesic Erosion

Reconstruction also has a dual form based on erosion.

For reconstruction by erosion, the mask \(X\) must initially be contained in the marker \(M\):

\[ X\subseteq M. \]

One geodesic erosion is

\[ \varepsilon_X^{(1)}(M) = (M\ominus B)\cup X. \]
Start with Marker \(M\)
↓
Erode: \(M\ominus B\)
↓
Union with Mask \(X\)
↓
\(\varepsilon_X^{(1)}(M)\)
Erosion attempts to shrink the marker. The union with \(X\) prevents it from shrinking below the mask.

10. Reconstruction by Erosion

Geodesic erosion is repeatedly applied:

\[ M^{(0)}=M \] \[ M^{(n+1)} = \varepsilon_X^{(1)} \left( M^{(n)} \right). \]

At convergence:

\[ R_X^\varepsilon(M) = \varepsilon_X^{(k)}(M) \] where \[ \varepsilon_X^{(k+1)}(M) = \varepsilon_X^{(k)}(M). \]
Reconstruction by dilation grows from a marker while remaining inside a mask. Reconstruction by erosion shrinks a marker while never shrinking below the mask.

11. Closing by Reconstruction

Closing by reconstruction uses the dual construction.

First create a marker by dilation:

\[ M = X\oplus B. \]

Then reconstruct the marker by erosion using \(X\) as the mask:

\[ \phi_R(X) = R_X^\varepsilon(M) = R_X^\varepsilon(X\oplus B). \]
Original Image \(X\)
↓
Dilate to Form Marker \(M=X\oplus B\)
↓
Use Original \(X\) as the Mask
↓
Reconstruct \(M\) by Geodesic Erosion
↓
Closing by Reconstruction
Opening by reconstruction begins with erosion and reconstructs by dilation. Closing by reconstruction begins with dilation and reconstructs by erosion.

12. Hole Filling with Reconstruction

Reconstruction can also distinguish background connected to the image border from background enclosed inside an object.

Let \(\Omega\) be the finite image domain. Use the background image \(X^c\) as the mask and create a marker containing only background pixels on the border:

\[ M = X^c\cap\partial\Omega. \]

Reconstruct the border-connected background:

\[ R = R_{X^c}^{\delta}(M). \]

Background holes are not connected to the border marker, so they are absent from \(R\). Complementing the result fills those holes:

\[ X_{\mathrm{filled}} = R^c. \]
M

Mark Border Background

Marker pixels are placed only in background regions touching the image border.

R

Reconstruct Background

Reconstruction propagates through all background that is connected to those marker pixels.

✓

Complement

Enclosed background regions become foreground, filling the holes.

13. What Does Reconstruction Preserve?

Reconstruction is strongly influenced by connectivity because propagation occurs from the marker through locations permitted by the mask.

Question Reconstruction Behavior
Can propagation leave the mask? No. Every geodesic dilation step is restricted to the mask.
Can an unmarked disconnected component appear? No. A component must be reachable from a marker under the chosen connectivity.
Does 4- vs. 8-connectivity matter? Yes. The chosen neighborhood determines which mask pixels are reachable from the marker.
Does opening by reconstruction behave like ordinary opening? Not exactly. Ordinary opening rebuilds the eroded set using ordinary dilation, while reconstruction allows surviving markers to propagate through the original mask.
Can reconstruction create arbitrary new structures? No. The mask constrains the locations available to the reconstruction.
The central idea is reachability under a constraint: the marker tells reconstruction where to begin, and the mask tells it where it may propagate.

14. Interactive Reconstruction Explorer

The visualizer below focuses on the reconstruction process rather than repeating the moving-structuring-element demonstration used on the earlier morphology page.

Geodesic Reconstruction

Edit the mask \(X\) and marker \(M\) directly.

Choose reconstruction by dilation or erosion and use Step, Auto, or Finish to watch the current reconstruction evolve until convergence.

You can also compare 4- and 8-connectivity.

Opening / Closing by Reconstruction

Edit the original binary image \(X\).

The tool automatically constructs the marker and compares ordinary opening or closing with the reconstruction-based version.

15. Summary

Concept Definition
Marker \(M\): starting set from which reconstruction begins.
Mask \(X\): set that constrains the reconstruction.
Geodesic Dilation \( \delta_X^{(1)}(M) = (M\oplus B)\cap X \)
Reconstruction by Dilation Repeat geodesic dilation until the marker stops changing.
Opening by Reconstruction \( \gamma_R(X) = R_X^\delta(X\ominus B) \)
Geodesic Erosion \( \varepsilon_X^{(1)}(M) = (M\ominus B)\cup X \)
Reconstruction by Erosion Repeat geodesic erosion until the marker stops changing.
Closing by Reconstruction \( \phi_R(X) = R_X^\varepsilon(X\oplus B) \)
Component Extraction A marker seed reconstructs the portion of the mask reachable from that seed.
Hole Filling Reconstruct border-connected background and complement the result.

Reconstruction Method
Connectivity
Mask X
Blue = mask X, which constrains propagation.
Marker M
Orange = initial marker M.
Iteration 0
Current Pixels 0
Changed Last Step 0
Mask X Initial Marker M Current Reconstruction
Operation
Connectivity
Initial Morphology Steps
Source Image
Click the Source X grid below to edit the original binary image.
Source X
Editable original image and reconstruction mask.
Marker M
Initial reconstruction marker.
Ordinary Opening
Result without reconstruction.
Reconstruction Result
Current reconstruction from marker M.
Reconstruction Iteration 0
Current Pixels 0
Changed Last Step 0
Ready.

Published inDigital Image Processing

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *