Morphology is a part of image processing, somewhat different from earlier topics discussed in this course, although we have touched upon it earlier. It involves non-linear operators operating on objects in an image, and is useful in many aspects such as 1

  • image preprocessing,
  • enhancing object structure,
  • object segmentation,
  • quantitative object description.

Although morphology can be understood in the same way for both binary images and general graylevel images, it can be useful to view them separately. Most of this content can also be found in the text book 2, albeit with some different notation.

General overview

Let our image be defined as

where for a dimensional image. In a similar way, we define a function

sometimes called a structuring element, where for a dimensional structure element. From this, we can define some common morphological operators.

  • Dilation
  • Erosion
  • Opening
  • Closing

For the above operators, the following convenient relation apply

provided that .

Graylevel images

Now, our image is defined as

where the range is for a -bit image, and the discrete image has domain . The structuring element is now

where . The litterature often differentiate between a flat structuring element where for all , and a non-flat structuring element where the values vary.

Dilation is now

and erosion is given by

The equations for morphological opening in Equation \eqref{eq:opening} and morphological closing in Equation \eqref{eq:closing} still apply.

For some reason, some authors use different definitions with flat structuring elements. These definitions are as the ones above, but without adding or substracting the value of the structure element, which is equivalent to using a flat structuring element with in the definition above (Equation \eqref{eq:dilation} and Equation \eqref{eq:erosion}). Some common grey-level operations follow.

Top-hat and bottom-hat transformation

The top-hat transformation detects bright regions on a dark background

The bottom-hat detects dark regions on a bright background

Morphological filtering

To filter bright noise, apply opening followed by closing

To filter dark noise, apply closing followed by opening

The rationale is that opening smooths bright values down, and closing smooths dark values up.

Morphological gradient

Grey level dilation will under certain conditions produce an image with equal or brighter values, likewise, grey level erosion will produce an image with equal or darker values. With this we can produce an image that highlights contrast difference by looking at the difference between dilation and erosion

Binary image

In this case it is more common to use a set-theoretic (more formally, a naive-set theoretic) representation, but for consistency, we first show the functional representation.

Functional representation

Our image is defined as

and the structuring element as

Note that we have defined to only map to zero, this is in order to be consistent with what is defined as binary morphology, which sometimes only cares about restructuring the foreground and background regions of the original image. But as we shall see, this is also what happens when employing the definition above.

Dilation now becomes

and erosion is given by

Set representation

Let our image be represented on a two-dimensional lattice, where each pixel has a position and a value (either foreground or background). Let be the set of foreground elements of in some image region , and be the set of background elements. They make up a partition of such that and . For some set , let us write and , then the foreground elements of the dilation and erosion operator becomes

where . This shows the relationship between the functional notation we used for graylevel images, and the notation we will use below, which is most common for binary images.

Dilation of an object with and object becomes

and erosion of by is given by

Opening and closing are still defined in the same way from dilation and erosion, and we have that

analogous to the relation in Equation \eqref{eq:relation}.

The other operations given above is also valid (and more or less useful) for binary images using the diation and erosion operators defined. Some additional operations and applications is also worth mentioning.

Edge detection

The dilated edge of by is given by

while the eroded edge is given by

where denotes the relative compliment (set-theoretic difference) of the set in , .

Hit-or-miss transformation

This is used to detect the location of a given object in an object . Often and is a set of foreground elements, and is a set of bacground elements. So this hit-or-miss-transformation gives the locations of the origin of in where and .

where is the compliment of , .

Convex hulls

The convex hull of is the smallest convex set covering . This can be found with morphology in the following way.

Define four structuring elements, where the idea of a foreground and background part from the hit-or-miss transformation apply. In the following, the non-zero elements of the structuring element superscripted with hit must match the pattern of , while the non-zero elements in the structuring element superscirpted with miss must match the pattern of .

For each , apply hit-or-miss on with until no changes occur, and let . Then, is a convex region covering , but it is not necesseraly the smallest one.

To get a smaller one, we intersect this with the rectangle element which is the smallest rectangle region covering , i.e.

where

Finally, .

Extracting connected components

This is used to detect, or extract a connected component . The idea is to grow a region until all connected components of are accounted for. First set equal to a point . Dilate with either a square- or a plus-shaped structuring element , and let be the intersection of this dilated region and the original region .

This continues iteratively until we see no change, i.e. is the first iteration where .

This can be seen as region growing, and applied to the compliment it can be used to fill holes.

Thinning and thickening

Thinning a region with an object can be defined as

But a more useful approach is a sequential thinning with multiple structuring elements, which, when defined with the hit-or-miss notation above are

Following this pattern, where is rotated clockwise w.r.t. , we continue this until

With this, we apply the iteration

for iterations until and we terminate with as the result of the thinning.

In the same manner, we define the dual operator thickening

which also can be defined as a sequential operation analogous to thinning.

Skeleton

The skeleton of can be obtained via a structuring element as

with

where denote successive erosions of with

and is the last iteration before is eroded to the empty set

It can be shown that can be reconstructed from this skeleton via

References

  1. Milan Sonka, Vaclav Hlavac, Roger Boyle. Image Processing, Analysis, and Machine Vision. 2008. 

  2. Rafael C. Gonzalez, Richard E. Woods. Digital Image Processing. 3rd ed. 2008.