Xử lý hình ảnh kỹ thuật số P18

Xử lý hình ảnh kỹ thuật số P18

SHAPE ANALYSIS
Several qualitative and quantitative techniques have been developed for characterizing the shape of objects within an image. These techniques are useful for classifying objects in a pattern recognition system and for symbolically describing objects in an image understanding system. Some of the techniques apply only to binary-valued images; others can be extended to gray level images.

590 SHAPE ANALYSIS
FIGURE 18.1-1. Topological attributes.
There is a fundamental relationship between the number of connected object
components C and the number of object holes H in an image called the Euler num-
ber, as defined by
E = C–H (18.1-1)
The Euler number is also a topological property because C and H are topological
attributes.
Irregularly shaped objects can be described by their topological constituents.
Consider the tubular-shaped object letter R of Figure 18.1-2a, and imagine a rubber
band stretched about the object. The region enclosed by the rubber band is called the
convex hull of the object. The set of points within the convex hull, which are not in
the object, form the convex deficiency of the object. There are two types of convex
deficiencies: regions totally enclosed by the object, called lakes; and regions lying
between the convex hull perimeter and the object, called bays. In some applications
it is simpler to describe an object indirectly in terms of its convex hull and convex
deficiency. For objects represented over rectilinear grids, the definition of the convex
hull must be modified slightly to remain meaningful. Objects such as discretized
circles and triangles clearly should be judged as being convex even though their
FIGURE 18.1-2. Definitions of convex shape descriptors.

592 SHAPE ANALYSIS
a 2 × 2 pixel square, the object area is A O = 4 and the object perimeter is P O = 8.
An object formed of three diagonally connected pixels possesses A O = 3 and
PO = 12 .
The enclosed area of an object is defined to be the total number of pixels for
which F ( j, k ) = 0 or 1 within the outer perimeter boundary PE of the object. The
enclosed area can be computed during a boundary-following process while the
perimeter is being computed (7,8). Assume that the initial pixel in the boundary-
following process is the first black pixel encountered in a raster scan of the image.
Then, proceeding in a clockwise direction around the boundary, a crack code C(p),
as defined in Section 17.6, is generated for each side p of the object perimeter such
that C(p) = 0, 1, 2, 3 for directional angles 0, 90, 180, 270°, respectively. The
enclosed area is
PE
AE = ∑ j ( p – 1 ) ∆k ( p ) (18.2-3a)
p=1
where PE is the perimeter of the enclosed object and
p
j(p ) = ∑ ∆j ( i ) (18.2-3b)
i=1
with j(0) = 0. The delta terms are defined by
 1 if C ( p ) = 1 (18.2-4a)


∆j ( p ) =  0 if C ( p ) = 0 or 2 (18.2-4b)


 –1 if C ( p ) = 3 (18.2-4c)
 1 if C ( p ) = 0 (18.2-4d)


∆k ( p ) =  0 if C ( p ) = 1 or 3 (18.2-4e)


 –1 if C ( p ) = 2 (18.2-4f)
Table 18.2-1 gives an example of computation of the enclosed area of the following
four-pixel object:

DISTANCE, PERIMETER, AND AREA MEASUREMENTS 595
Bit quad counting provides a very simple means of determining the Euler number of
an image. Gray (9) has determined that under the definition of four-connectivity, the
Euler number can be computed as
E = 1 [ n { Q 1 } – n { Q3 } + 2n { QD } ]
--
- (18.2-9a)
4
and for eight-connectivity
E = 1 [ n { Q 1 } – n { Q3 } – 2n { Q D } ]
--
- (18.2-9b)
4
It should be noted that although it is possible to compute the Euler number E of an
image by local neighborhood computation, neither the number of connected compo-
nents C nor the number of holes H, for which E = C – H, can be separately computed
by local neighborhood computation.
18.2.2. Geometric Attributes
With the establishment of distance, area, and perimeter measurements, various geo-
metric attributes of objects can be developed. In the following, it is assumed that the
number of holes with respect to the number of objects is small (i.e., E is approxi-
mately equal to C).
The circularity of an object is defined as
4πAO
C O = -------------
- (18.2-10)
2
( PO )
This attribute is also called the thinness ratio. A circle-shaped object has a circular-
ity of unity; oblong-shaped objects possess a circularity of less than 1.
If an image contains many components but few holes, the Euler number can be
taken as an approximation of the number of components. Hence, the average area
and perimeter of connected components, for E > 0, may be expressed as (9)
AO
AA = ------
- (18.2-11)
E
PO
PA = ------
- (18.2-12)
E
For images containing thin objects, such as typewritten or script characters, the
average object length and width can be approximated by