Cơ sở dữ liệu hình ảnh - Chương 5 - Pdf 20

5. MORPHOLOGICAL AND OTHER AREA
OPERATIONS
5.1 Morphology Defined
The word morphology means "the form and structure of an object", or the arrangements
and interrelationships between the parts of an objects. Morphology is related to shape, and
digital morphology is a way to describe or analyze the shape of a digital (most often
raster) object.
5.2 Basic Morphological Operations
Binary morphological operations are defined on bilevel images; that is, images that consist
of either black or white pixel only. For the purpose of beginning, consider the image seen
in Figure 5.1a. The set of black pixels from a square object. The object in 5.1b is also
square, but is one pixel lager in all directions. It was obtained from the previous square by
simply setting all white neighbors of any black pixel to black. This amount to a simple
binary dilation, so named because it causes the original object to grow larger. Figure 5.1c
shows the result of dilating Figure 5.1b by one pixel, which is the same as dilating Figure
5.1a by two pixels, this process could be continued until the entire image consisted
entirely of black pixels, at which point the image would stop showing any change.
Figure 5.1 The effects of a simple binary dilation on a small object. (a) Original image.
(b) Dilation of the original by 1 pixel, (c) Dilation of the original by 2 pixels (dilation of
(b) by 1.
5.1.2 Binary dilation
Now some definition of simple set operations are given, with the goal being to define
dilation in a more general fashion in terms of sets. The translation of the set A by the point
x is defined, in set notation, as:
{ }
Aa,acc)A(
x
∈−==
For example, if x were at (1, 2) then the first (upper left) pixel in (A)
x
would be (3,3) +

It is now possible to define more formally what is meant by a dilation. A dilation of the set
A by the set B is:
{ }
Bb,Aa,baccBA ∈∈+==⊕
where A represents the image being operated on, and B is a second set of pixels, a shape
that operates on the pixels of A to produce the result; the set B is called a structuring
element, and its composition defines the nature of the specific dilation.
To explore this idea, let A be the set of Figure 5.1a, and let B be the set of {(0,0)(0,1)}.
The pixels in the set C = A + B are computed using the last equation which can be
rewritten in this case as:
( ) ( )
(0,1)A(0,0)A +∪+=⊕ BA
There are four pixels in the set A, and since any pixel translated by (0,0) does not change,
those four will also be in the resulting set C after computing C = A + {(0,1)}:
(3,3) + (0,0) = (3,3) (3,4) + (0,0) = (3,4)
(4,3) + (0,0) = (4,3) (4,4) + (0,0) = (4,3)
The result A + {(0,1)} is
(3,3) + (0,1) = (3,4) (3,4) + (0,1) = (3,5)
(4,3) + (0,1) = (4,4) (4,4) + (0,1) = (4,5)
The set C is the result of the dilation of A using structuring B, and consists of all of the
pixels above (some of which are duplicates). Figure 5.2 illustrates this operation, showing
graphically the effect of the dilation. The pixels marked with an "X," either white or black,
represent the origin of each image. The location of the origin is important. In the example
above, if the origin of B were the rightmost of the two pixels the effect of the dilation
would be to add pixels to the left of A, rather than to the right. The set B in this case
would be {(0,−1)(0,0)}.
Figure 5.2. Dilation of the set A of (Figure 5.1(a)) by the set B; (a) The two sets; (b) The
set obtained by adding (0,0) to all element of A; (c) The set obtained by adding (0,1) to all
elements of A; (d) The union of the two sets is the result of the dilation.
Moving back to the simple binary dilation that was performed in Figure 5.1, one question

(A
1
)
(0,


1)
= {(1,0)(2,1)(2,2)(3,1)(3,2)(4,3)}
and the translation of A, by (0,1) yields:
(A
1
)
(0,

1)
= {(1,2)(2,3)(2,4)(3,3)(3,4)(4,5)}.
The dilation of A
1
by B
1
is the union of (A
1
)
(0,

1)
with (A
1
)
(0,1)

BBA

=⊕
This gives a clue concerning a possible implementation for the dilation operator. Think of
the structuring element as a template, and move it over the image. When the origin of the
structuring element aligns with a black pixel in the image, all of the image pixels that
correspond to black pixels in the structuring element are marked, and will later be changed
to black. After the entire image has been swept by the structuring element, the dilation
calculation is complete. Normally the dilation is not computed in place. A third image,
initially all white, is used to store the dilation while it is being computed.
5.2.2 Binary Erosion
If dilation can be said to add pixels to an object, or to make it bigger, then erosion will
make an image smaller. In the simplest case, a binary erosion will remove the outer layer
of pixels from an object. For example, Figure 5.1b is the result of such a simple erosion
process applied to Figure 5.1c. This can be implemented by marking all black pixels
having at least one white neighbor, and then setting to white all of the marked pixels. The
structuring element implicit in this implementation is the same 3 x 3 array of black pixels
that defined the simple binary dilation.

Figure 5.4 Dilating an image using a structuring element. (a) The origin of the structuring
element is placed over the first black pixel in the image, and the pixels in the structuring
element are copied into their corresponding positions in the result image. (b) Then the
structuring element is placed over the next black pixel in the image and the process is
repeated. (c) This is done for every black pixel in the image.
In general, the erosion of image A by structuring element B can be defined as:
( )
{ }
ABcBA
c
⊆=Θ

members of A, and so those pixels will appear in the erosion of A by B. This example is
illustrated in Figure 5.5.
(a) (b)

(c) (d)
Figure 5.5 Binary erosion using a simple structuring element.
(a) The structuring element is translated to the position of a black pixel in the image. In
this case all members of the structuring element correspond to black image pixels so the
result is a black pixel.
(b) Now the structuring element is translated to the next black pixel in the image, and there
is one pixel that does not match. The result is a white pixel.
(c) At the next translation there is another match so, again the pixel in the output image
that corresponds to the translated origin of the structuring element is set to black.
(d) The final translation is not a match, and the result is a white pixel. The remaining
image pixels are white and could not match the origin of the structuring element; they
need not be considered.
Now consider the structuring element B
2
= {(1,0)}; in this case the origin is not a member
of B
2
. The erosion AΘ B can be computed as before, except that now the origin of the
structuring element need not be correspond to a black pixel in the image. There are quite a
few legal positions, but the only ones that result in a match are:
B
(2,3)
= {(3,3)}
B
(2,4)
= {(3,4)}

z
⊆=Θ
so the complement of the erosion is:
( ) ( )
{ }
c
z
c
ABzBA ⊆=Θ
If (B)
z
is a subset of A, then the intersection of (B)
z
with A is not empty:
( ) ( )
( )
{ }
c
z
c
0ABzBA ≠∩=Θ
but the intersection with A
c
will be empty:
( )
( )
{ }
c
c
z

{ }
Bb,Aa,bazz
c
∈∈−==
which is the definition of
^
c
BA ⊕
The erosion operation also brings up an issue that was not a concern at dilation; the idea of
a "don't care" state in the structuring element. When using a strictly binary structuring
element to perform an erosion, the member black pixels must correspond to black pixels in
the image in order to set the pixel in the result, but the same is not true for a white (0)
pixel in the structuring element. We don't care what the corresponding pixel in the image
might be when the structuring element pixel is white.
5.2 Opening and Closing Operators
Opening
The application of an erosion immediately followed by a dilation using the same
structuring element is refined to as an opening operation. The name opening is a
descriptive one, describing the observation that the operation tends to "open" small gaps or
spaces between touching objects in an image. This effect is most easily observed when
using the simple structuring element. Figure 5.6 shows image having a collection of small
objects, some of them touching each other. After an opening using simple the objects are
better isolated, and might now counted or classified.
Figure 5.6 The use of opening: (a) An image having many connected objects, (b) Objects
can be isolated by opening using the simple structuring element, (c) An image that has
been subjected to noise, (d) The noisy image after opening showing that the black noise
pixels have been removed.
Figure 5.6 also illustrates another, and quite common, usage of opening: the removal of
noise. When a noisy gray-level image is thresholded some of the noise pixels are above
the threshold, and result in isolated pixels in random locations. The erosion step in an

approach to computing an opening of depth N is to perform N consecutive binary erosions
followed by N binary dilations. This means that computing all of the openings of an image
up to depth ten requires that 110 erosions or dilations be performed. If erosion and dilation
are implemented in a naive fashion, this will require 220 passes through the image. The
alliterative is to save each of the ten erosions of the original image, each of these is then
dilated by the proper number of iterations to give the ten opened images. The amount of
storage required for the latter option can be prohibitive, and if file storage is used the I/O
time can be large also.
A fast erosion method is based on the distance map of each object, where the numerical
value of each pixel is replaced by a new value representing the distance of that pixel from
the nearest background pixel. Pixels on a boundary would have a value of 1, being that
they are one pixel width from a background pixel; pixels that are two widths from the
background would be given a value of 2, and so on. The result has the appearance of a
contour map, where the contours represent the distance from the boundary. For example,
the object shown in Figure 5.9a has the distance map shown in Figure 5.9b. The distance
map contains enough information to perform an erosion by any number of pixels in just
one pass through the image; in other words, all erosions have been encoded into one
image. This globally eroded image can be produced in just two passes through the original
image, and a simple thresholding operation will give any desired erosion.
There is also a way, similar to that of global erosion, to encode all possible openings as
one gray-level image, and all possible closings can be computed at the same time. First, as
in global erosion, the distance map of the image is found. Then all pixels that do NOT
have at least one neighbor nearer to the background and one neighbor more distant are
located and marked: These will be called nodal pixels. Figure 5.9c shows the nodal pixels
associated with the object of Figure 5.9a. If the distance map is thought of as a three-
dimensional surface where the distance from the background is represented as height, then
every pixel can be thought of as being the peak of a pyramid having a standardized slope.
Those peaks that are not included in any other pyramid are the nodal pixels. One way to
locate nodal pixels is to scan the distance map, looking at all object pixels; find the
minimum (or MIN) and maximum (or MAX) value of all neighbors of the target pixel, and


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status