Morphology Overview
Overview
This document describes morphological operations, which are used in the process of segmenting images. Image segmentation refers to the process of finding regions in an image that represent objects or meaningful parts of objects. Common applications of morphological operators include filling small holes in objects, separating adjacent or slightly overlapping objects, and joining broken boundaries into continuous segments. The concept of a structuring element is discussed; it must be defined for any morphological operation to make sense. Then we describe the four most basic operations: dilation, erosion, opening, and closing. Opening and closing are accomplished through combinations of dilation and erosion. Many more complex operations can be also defined based on various combinations of multiple applications of dilation and erosion.
2.4.6 Morphological Filtering
Morphology relates to the structure or form of objects. Morphological filtering simplifies a segmented image to facilitate the search for objects of interest. This is done by smoothing out object outlines, filling small holes, eliminating small projections, and using other similar techniques. Even though this section will focus on applications to binary images, the extension of the concepts to gray-level images will also be discussed. We will look at the different types of operations available and at some examples of their use.
The two principal morphological operations are dilation and erosion. Dilation allows objects to expand, thus potentially filling in small holes and connecting disjoint objects. Erosion shrinks objects by etching away (eroding) their boundaries. These operations can be customized for an application by the proper selection of the structuring element, which determines exactly how the objects will be dilated or eroded.
The dilation process is performed by laying the structuring element on the image and sliding it across the image in a manner similar to convolution. The difference is in the operation performed. It is best described in a sequence of steps:
- If the origin of the structuring element coincides with a '0' in the image, there is no change; move to the next pixel.
- If the origin of the structuring element coincides with a T in the image, perform the OR logic operation on all pixels within the structuring element.
An example is shown in Figure 2.4-11. Note that with a dilation operation, all the '1' pixels in the original image will be retained, any boundaries will be expanded, and small holes will be filled. The erosion process is similar to dilation, but we turn pixels to '0', not '1'. As before, slide the structuring element across the image and then follow these steps:
- If the origin of the structuring element coincides with a '0' in the image, there is no change; move to the next pixel.
- If the origin of the structuring element coincides with a '1' in the image, and any of the '1' pixels in the structuring element extend beyond the object ('1' pixels) in the image, then change the '1' pixel in the image to a '0'.

Figure 2.4-11 Dilation: A) Original image, B) Structural element; x = origin, C) Image after dilation; original in dashes.
In Figure 2.4-12, the only remaining pixels are those that coincide to the origin of the structuring element where the entire structuring element was contained in the existing object. Because the structuring element is 3 pixels wide, the 2-pixel-wide right leg of the image object was eroded away, but the 3-pixel-wide left leg retained some of its center pixels.

Figure 2.4-12 Erosion: A) Original Image, B) Structural element; x = origin, C) Image after erosion; original in dashes.
These two basic operations, dilation and erosion, can be combined into more com-plex sequences. The most useful of these for morphological filtering are called opening and closing. Opening consists of an erosion followed by a dilation and can be used to eliminate all pixels in regions that are too small to contain the structuring element. In this case the structuring element is often called a probe, because it is probing the image looking for small objects to filter out of the image. See Figure 2.4.13 for an example of opening.

Figure 2.4-13 Opening: A) Original Image, B) Structural element; x = origin, C) Image after opening; erosion followed by dilation.
Closing consists of a dilation followed by erosion and can be used to fill in holes and small gaps. In Figure 2.4-14 we see that the closing operation has the effect of fill-ing in holes and closing gaps. Comparing Figure 2.4-14 to Figure 2.4-13, we see that the order of operation is important. Closing and opening will have different results even though both consist of an erosion and a dilation.

Figure 2.4-14 Closing: A) Original Image, B) Structural element; x = origin, C) Image after closing; dilation followed by erosion; original in dashes.
Another approach to binary morphological filtering is based on an iterative approach. The usefulness of this approach lies in its flexibility. It is based on a definition of six-connectivity, in which each pixel is considered connected to its horizontal and ver-tical neighbors but to only two diagonal neighbors (the two on the same diagonal). This connectivity definition is equivalent to assuming that the pixels are laid out on a hexag-onal grid, which can be simulated on a rectangular grid by assuming that each row is shifted by half a pixel (see Figure 2.4-15). With this definition a pixel can be surrounded by 14 possible combinations of 1's and 0's, as seen in Figure 2.4-16; we call these differ-ent combinations surrounds. For this approach to morphological filtering, we define:
- The set of surrounds S, where a = 1.
- A logic function, L(,a, b), where b is the current pixel value, specifies the output of the morphological function.
- The number of iterations n.
The function L( ) and the values of a and b are all functions of the row and col-umn, (r, c), but for concise notation this is implied. Set S can contain any or all of the 14 surrounds denned in Figure 2.4-16. L(a, b) can be any logic function, but it turns out that the most useful are the AND and OR functions. The AND function tends to etch away at object boundaries (erosion), and the OR function tends to grow objects (dilation).

Figure 2.4-15 Hexagonal Grid: A) Rectangular image grid with every other row shifted by one-half pixel, B) Hexagonal grid

Figure 2.4-16 Surrounds for Iterative Morphological Filtering
EXAMPLE 2-9
Let S = {2, 3, 4, 5, 6} and L = a + b (+ = OR). Because L(a, b) is an OR operation, all pixels that are 1 in the original will remain 1. The only pixels that will change are those that are 0 in the original image and have a surround that is S (this means that a = 1). If we examine the set S, we see that this set contains all pixels that are surrounded by a connected set of 1's. This operation will expand the object, but because the surrounds of disconnected 1 pixels are not included in S, disjoint objects will not connect.
We can see from this example that this method- is more flexible than the methods described earlier. We can use this technique to define methods for dilation, erosion, opening, and closing, as well as others. For this technique the selection of the set S is comparable to defining the structuring element in the previously described approaches, and the operation L(a, b) defines the type of filtering that occurs (see Computer Vision Lab Exercise #4 in Chapter 8 for examples of iterative morphological filtering).
The morphological operations described (dilation, erosion, opening, and closing) can be extended to gray-level images in different ways. The easiest method is to sim-ply threshold the gray-level image to create a binary image and then apply the exist-ing operators. For many applications this is not desired because too much information is lost during the thresholding process. Another method that allows us to retain more information is to treat the image as a sequence of binary images by operating on each gray level as if it were the 1 value and assuming everything else to be 0. The resulting images can then be combined by laying them on top of each other and "promoting" each pixel to the highest gray-level value coincident with that location.
An example of results from gray-level morphological filtering is shown in Figure 2.4-17. For this application an opening operation followed by a closing operation was performed. A circular structuring element was used, as the object of interest was the tumor border. The opening procedure served to smooth the contours of the object, break narrow isthmuses, and eliminate thin protrusions and small objects. Next, the closing was performed to fill in gaps and eliminate small holes. To understand gray-level morphology fully, we must remember that with two adjacent gray levels, the brighter one is considered to be the object (the equivalent of '1' in a binary image), and the darker one is the background (the '0' equivalent in binary morphology). In this fig-ure we see the tremendous data reduction achieved, thus simplifying the process of identifying the tumor features of interest.

Figure 2.4-17 Gray-Level Morphological Filtering: A) Original segmented tumor image, B) Image (a) after mophological opening using a 5x5 circular structuring element, C) Image (b) after morphological closing using a 5x5 circular structuring element.
Reader Comments | Submit a comment »
Legal
Excerpt from the book published by Prentice Hall Professional (http://www.phptr.com).
Copyright Prentice Hall Inc., A Pearson Education Company, Upper Saddle River, New Jersey 07458.
This material is protected under the copyright laws of the U.S. and other countries and any uses not in conformity with the copyright laws are prohibited, including but not limited to reproduction, DOWNLOADING, duplication, adaptation and transmission or broadcast by any media, devices or processes.
