Morphological Reconstruction

Morphological reconstruction can be thought of conceptually as repeated dilations of an image, called the marker image, until the contour of the marker image fits under a second image, called the mask image. In morphological reconstruction, 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 is based on morphological dilation, but note the following unique properties:

  • Processing is based on two images, a marker and a mask, rather than one image and a structuring element.

  • Processing is based on the concept of pixel connectivity, rather than a structuring element.

  • Processing repeats until stability; i.e., the image no longer changes.

Understanding the Marker and Mask

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.

    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
    
  2. 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)

Finding Peaks and Valleys

Grayscale images can be thought of in three dimensions: the x- and y-axes represent pixel positions and the z-axis represents the intensity of each pixel. In this interpretation, the intensity values represent elevations, as in a topographical map. The areas of high intensity and low intensity in an image, peaks and valleys in topographical terms, can be important morphological features because they often mark relevant image objects.

For example, in an image of several spherical objects, points of high intensity could represent the tops of the objects. Using morphological processing, these maxima can be used to identify objects in an image.

This section covers these topics:

Terminology

This section uses the following terms.

Term

Definition

global maxima

Highest regional maxima in the image. See the entry for regional maxima in this table for more information.

global minima

Lowest regional minima in the image. See the entry for regional minima in this table for more information.

regional maxima

Connected set of pixels of constant intensity from which it is impossible to reach a point with higher intensity without first descending; that is, a connected component of pixels with the same intensity value, t, surrounded by pixels that all have a value less than t.

regional minima

Connected set of pixels of constant intensity from which it is impossible to reach a point with lower intensity without first ascending; that is, a connected component of pixels with the same intensity value, t, surrounded by pixels that all have a value greater than t.

Understanding the Maxima and Minima Functions

An image can have multiple regional maxima or minima but only a single global maximum or minimum. Determining image peaks or valleys can be used to create marker images that are used in morphological reconstruction.

This figure illustrates the concept in 1-D.

Finding Areas of High or Low Intensity

The toolbox includes functions that you can use to find areas of high or low intensity in an image:

  • The imregionalmax and imregionalmin functions identify all regional minima or maxima.

  • The imextendedmax and imextendedmin functions identify regional minima or maxima that are greater than or less than a specified threshold.

The functions accept a grayscale image as input and return a binary image as output. In the output binary image, the regional minima or maxima are set to 1; all other pixels are set to 0.

For example, this simple image contains two primary regional maxima, the blocks of pixels containing the value 13 and 18, and several smaller maxima, set to 11.

The binary image returned by imregionalmax pinpoints all these regional maxima.

B = imregionalmax(A)

You might want only to identify areas of the image where the change in intensity is extreme; that is, the difference between the pixel and neighboring pixels is greater than (or less than) a certain threshold. For example, to find only those regional maxima in the sample image, A, that are at least two units higher than their neighbors, use imextendedmax.

B = imextendedmax(A,2)

Suppressing Minima and Maxima

In an image, every small fluctuation in intensity represents a regional minimum or maximum. You might only be interested in significant minima or maxima and not in these smaller minima and maxima caused by background texture.

To remove the less significant minima and maxima but retain the significant minima and maxima, use the imhmax or imhmin function. With these functions, you can specify a contrast criteria or threshold level, h, that suppresses all maxima whose height is less than h or whose minima are greater than h.

Note

The imregionalmin, imregionalmax, imextendedmin, and imextendedmax functions return a binary image that marks the locations of the regional minima and maxima in an image. The imhmax and imhmin functions produce an altered image.

For example, this simple image contains two primary regional maxima, the blocks of pixels containing the value 14 and 18, and several smaller maxima, set to 11.

To eliminate all regional maxima except the two significant maxima, use imhmax, specifying a threshold value of 2. Note that imhmax only affects the maxima; none of the other pixel values are changed. The two significant maxima remain, although their heights are reduced.

B = imhmax(A,2)

This figure takes the second row from the sample image to illustrate in 1-D how imhmax changes the profile of the image.

Imposing a Minimum

You can emphasize specific minima (dark objects) in an image using the imimposemin function. The imimposemin function uses morphological reconstruction to eliminate all minima from the image except the minima you specify.

To illustrate the process of imposing a minimum, this code creates a simple image containing two primary regional minima and several other regional minima.

mask = uint8(10*ones(10,10));
mask(6:8,6:8) = 2;
mask(2:4,2:4) = 7;
mask(3,3) = 5;
mask(2,9) = 9;
mask(3,8) = 9;
mask(9,2) = 9;
mask(8,3) = 9

Creating a Marker Image

To obtain an image that emphasizes the two deepest minima and removes all others, create a marker image that pinpoints the two minima of interest. You can create the marker image by explicitly setting certain pixels to specific values or by using other morphological functions to extract the features you want to emphasize in the mask image.

This example uses imextendedmin to get a binary image that shows the locations of the two deepest minima.

marker = imextendedmin(mask,1)

Applying the Marker Image to the Mask

Now use imimposemin to create new minima in the mask image at the points specified by the marker image. Note how imimposemin sets the values of pixels specified by the marker image to the lowest value supported by the data type (0 for uint8 values). imimposemin also changes the values of all the other pixels in the image to eliminate the other minima.

I = imimposemin(mask,marker)
I =
    11    11    11    11    11    11    11    11    11    11
    11     8     8     8    11    11    11    11    11    11
    11     8     0     8    11    11    11    11    11    11
    11     8     8     8    11    11    11    11    11    11
    11    11    11    11    11    11    11    11    11    11
    11    11    11    11    11     0     0     0    11    11
    11    11    11    11    11     0     0     0    11    11
    11    11    11    11    11     0     0     0    11    11
    11    11    11    11    11    11    11    11    11    11
    11    11    11    11    11    11    11    11    11    11

This figure illustrates in 1-D how imimposemin changes the profile of row 2 of the image.

Imposing a Minimum

Related Topics