Você está na página 1de 4

Morphological Image Processing

Overview
Morphological image processing is a tool for extracting or modifying information
on the shape and structure of objects within an image. Morphological operators,
such as dilation, erosion and skeletonization, are particularly useful for the
analysis of binary images, although they can be extended for use with grayscale
images. Morphological operators are non-linear, and common usages include
filtering, edge detection, feature detection, counting objects in an image, image
segmentation, noise reduction, and finding the mid-line of an object.

9.1 Mathematical Morphology


The field of mathematical morphology contributes a wide range of operators to
image processing, all based around a few simple mathematical concepts from
set theory and, in the case of binary images, (Boolean) logic operations such as
AND, OR, XOR (exclusive OR) and NOT. The union operation, AB, for
example, is equivalent to the OR operation for binary images; and the
intersection operator, AB, is equivalent to the AND operation for binary
images (Appendix B).
9.1.1 Connectivity
In binary images an object is defined as a connected set of pixels. With twodimensional images connectivity can be either 4-connectivity or 8-connectivity
(Fig. 9.1). In 4-connectivity, each pixel (P) has four connected neighbors (N)
top, bottom, right and left. The diagonally touching pixels are not considered to
be connected. In 8-connectivity, each pixel (P) has eight connected neighbors (N)
including the diagonally touching pixels. For three-dimensional images
neighborhoods can be 6-connected, 18-connected or 26-connected.
140

Figure 9.1 Connectivity in two-dimensional images. (i) 4-connectivity - each pixel


(P) has four connected neighbors () (ii) 8-connectivity - each pixel (P) has eight
connected neighbors ().
This leads to different ideas of distance. In a 4-connected neighborhood, N4, the
distance is known as the city-block, taxicab or Manhattan distance by analogy
with a city based on an orthogonal grid of roads. It is the distance a taxicab would
drive in Manhattan (if there were no one way streets!). The distance in a 4connected neighborhood is given by
d 4 ( x, y ) x 1 y 1 x 2 y 2

(9.1)

A diagonal step has a distance of two since it requires a horizontal and a vertical
step. Equal distances from a certain position would form diamonds centered on
it. In an 8-connected neighborhood, N8, the distance is known as the Chebyshev
or chessboard distance, by analogy with the moves available to a king in chess.
The distance in an 8-connected neighborhood is given by
d8 ( x, y ) max x 1 y 1 , x 2 y 2

(9.2)

141

A diagonal step has a distance of one, the same as a horizontal or vertical step.
Equal distances from a certain position would form squares centered on it.
Neither is the same as Euclidean distance, which is given by

(9.3)

d( x,y ) ( x 1 y 1 ) 2 ( x 2 y 2 ) 2

A diagonal step is given by a distance of 1/2, and equal distances from a certain
position form circles centered on it. In physical space the Euclidean distance is
the most natural distance, because the length of a rigid body does not change
with rotation. Alternating the two metrics (N 4-N8 or N8-N4) is an approximation to
Euclidean distance.

9.2 Morphological Operators


There are a number of morphological operators, but two most fundamental
operations are dilation and erosion; all other morphological operations are built
from a combination of these two.
9.2.1 Dilation and Erosion
In binary images dilation is an operation that increases the size of foreground
objects, generally taken as white pixels although in some implementations this
convention is reversed. It can be defined in terms of set theory, although we will
use a more intuitive algorithm. The connectivity needs to be established prior to
operation, or a structuring element defined (Fig. 9.2).

142

Figure 9.2 Structuring elements corresponding to (i) 4-connectivity (ii) 8connectivity.

143

Você também pode gostar