Computer Vision: Morphological Image Processing

Preliminaries

Morphology provides a unified and powerful approach to various image processing problems.

  • The language of mathematical morphology is set theory.
  • We consider thresholded images containing only black and white pixels.
  • The “set of white pixels” contains the complete morphological description of the image.
  • These sets are subsets of where each vector expresses coordinates of white (or black) pixels.

Set Translation

The translation of a set by point , denoted , is defined as:

If is the set of pixels representing an object in an image, then is the set of points in whose coordinates have been replaced by .

Set Reflection

The reflection of a set , denoted , is defined as:

The reflection of is composed of the points whose coordinates are replaced with .

Structuring Elements

Morphological operations are based on structuring elements (SEs):

SEs are small sets or subimages used to probe an image under study for properties of interest.

Non-rectangular SEs are padded with background values (zeros).

Erosion

With and as sets in , the erosion of by , denoted , is defined as:

In words, the erosion of by is the set of all points such that , translated by , is contained in (the intersection between and the complement of is empty).

Erosion Example

The document provides a series of images to illustrate the concept of erosion.

Dilation

With and as sets in , the dilation of by , denoted , is defined as:

The dilation of by is the set of all displacements such that the reflection of and overlap by at least one element.

The basic process of flipping about its origin and then successively displacing it so that it slides over set (image) is analogous to spatial convolution.

One of the simplest applications of dilation is for bridging gaps.

Opening and Closing

Given an image and a SE :

  • Opening: Erosion followed by a dilation.
  • Closing: Dilation followed by an erosion.

Opening

  • Smoothes the contour of an object.
  • Breaks narrow isthmuses.
  • Eliminates thin protrusions.

Closing

  • Smooth sections of contours.
  • Fuses narrow breaks and long thin gulfs.
  • Eliminates small holes.
  • Fills gaps in the contour.

Opening and Closing Examples

The document provides a series of images to illustrate the effects of opening and closing operations on noisy images and images with breaks/ridges.

Hole Filling

A hole may be defined as a background region surrounded by a connected border of foreground pixels.

Given an initial point inside a hole, the goal is to fill the hole with 1s.

Let be the initial array with the same size as , filled with 0s except at the location of a given point in each hole.

The following iterative procedure fills all holes with 1s: (The specific iterative procedure is not defined in the text).

Connected Components

Let be the initial array with the same size as , filled with 0s except at the location of a known point in each region.

The following iterative procedure fills the connected component with 1s: (The specific iterative procedure is not defined in the text).

Boundary Extraction

The boundary of a set can be obtained by first eroding by and then performing the set difference between and its erosion:

Moore Boundary Tracking

Several algorithms require extracting an ordered sequence of foreground boundary points from a region.

Assumptions:

  1. We are working with binary thresholded images: 0: background, 1: foreground.
  2. Images are padded with a border of 0s so that no foreground region touches the image border.

Algorithm:

  1. Let the starting point, , be the uppermost, leftmost point in the image that is labeled 1.
    • Let be the west neighbor of .
  2. (Initialization) Examine the 8-neighbors of , starting at and proceeding in a clockwise direction.
    • Let denote the first neighbor encountered whose value is 1.
    • Let be the (background) point immediately preceding in the sequence.
  3. Let and .
  4. Let the 8-neighbors of , starting at and proceeding in a clockwise direction, be denoted by . Find the first labeled 1.
  5. Let , .
  6. Repeat Steps 3 and 4 until and the next boundary point found is . The sequence of points found when the algorithm stops constitutes the set of ordered boundary points.

The document includes a series of diagrams illustrating the steps of the Moore boundary tracking algorithm.

Gray-Scale Morphology

So far, we considered thresholded images to derive a set of morphological operations using set theory.

Erosion, dilation, opening, and closing can also be defined for grayscale images.

The structuring element is used as a “probe” to examine a given image for specific properties. Can be non-flat or flat (more common).

Erosion

The erosion of by a flat structuring element at any location is defined as the minimum value of the image in the region defined by when the origin of is at :

The operation is conceptually similar to convolution. The structuring element is shifted at every pixel location of the image, and the minimum operation is performed among all the pixels in the region coincident with .

Dilation

The dilation of by a flat structuring element at any location is defined as the maximum value of the image in the region defined by the reflection of when the origin of it is at .

Note the negative sign of the displacement resulting from the relation.

Effect of Erosion

Since erosion computes minimum intensity values over every neighborhood of , the resulting image is darker, and the size of bright features is, in general, reduced.

Effect of Dilation

Dilation gives opposite results with respect to erosion. The resulting image is brighter, bright features are thickened, and the intensities of the dark features are reduced.

Opening and Closing

The expressions for opening and closing gray-scale images have the same form as their binary counterparts.

Geometric Interpretation:

Suppose that and are 3D surfaces.

  • The opening of by is like pushing the structuring element up from below against the undersurface of .
  • The closing operation is like pushing down the structuring element on top of the curve while being translated to all locations.

Effect of Opening

Opening attenuates bright features and has a negligible effect on the dark features and the background of the image.

Effect of Closing

Closing attenuates dark features and has a negligible effect on the bright features and the background of the image.

Morphological Smoothing

Because opening suppresses bright details, and closing suppresses dark details, they are often used in combination for image smoothing and noise removal.

Morphological Gradient

The dilation thickens regions in an image, and the erosion shrinks them. Their difference is an operation with the effect of emphasizing the boundaries between regions.

The net result is an image in which the edges are enhanced, and the contribution of the homogeneous areas is suppressed, thus producing a “derivative-like” (gradient) effect.

Top-Hat, Bottom-Hat

The top-hat transformation of a grayscale image is defined as minus its opening:

The bottom-hat transformation of is defined as the closing of minus :

Goal: Select objects from an image by using a structuring element in the opening or closing operation that does not fit the objects to be removed. The difference then removes just the selected objects.

Top-Hat to Correct Illumination

If images exhibit uneven illumination, a global thresholding operation may fail in some areas.

The document mentions using a top-hat transformation to correct illumination issues, followed by Otsu thresholding for improved results.


Citations:
[1] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/52995484/64e1ec0b-878e-4bab-9956-a19c703835b8/6_Morphological_image_processing.pdf