Image Processing Toolbox User's Guide

Morphological reconstruction processes one image, called the marker, based on the characteristics of another image, called the mask. The high points, or peaks, in the marker image specify where processing begins. The processing continues until the image values stop changing.

To illustrate morphological reconstruction, consider this simple image. It contains two primary regions, the blocks of pixels containing the values `14` and `18`. The background is primarily all set to `10`, with some pixels set to `11`.

To morphologically reconstruct this image, perform these steps:

1. Create a marker image. As with the structuring element in dilation and erosion, the characteristics of the marker image determine the processing performed in morphological reconstruction. The peaks in the marker image should identify the location of objects in the mask image that you want to emphasize.
1. One way to create a marker image is to subtract a constant from the mask image, using `imsubtract`.

• ```marker = imsubtract(A,2)
marker =
8     8     8     8     8     8     8     8     8     8
8    12    12    12     8     8     9     8     9     8
8    12    12    12     8     8     8     9     8     8
8    12    12    12     8     8     9     8     9     8
8     8     8     8     8     8     8     8     8     8
8     9     8     8     8    16    16    16     8     8
8     8     8     9     8    16    16    16     8     8
8     8     9     8     8    16    16    16     8     8
8     9     8     9     8     8     8     8     8     8
8     8     8     8     8     8     9     8     8     8
```
1. Call the `imreconstruct` function to morphologically reconstruct the image. In the output image, note how all the intensity fluctuations except the intensity peak have been removed.
• ```recon = imreconstruct(marker, mask)

```

Understanding Morphological Reconstruction

Morphological reconstruction can be thought of conceptually as repeated dilations of the marker image until the contour of the marker image fits under the mask image. In this way, the peaks in the marker image "spread out", or dilate.

This figure illustrates this processing in 1-D. Each successive dilation is constrained to lie underneath the mask. When further dilation ceases to change the image, processing stops. The final dilation is the reconstructed image. (Note: the actual implementation of this operation in the toolbox is done much more efficiently. See the `imreconstruct` reference page for more details.) The figure shows the successive dilations of the marker.

Repeated Dilations of Marker Image, Constrained by Mask

 Morphological Reconstruction Pixel Connectivity