Lec02 FeatureExtraction
Lec02 FeatureExtraction
Pattern Classification
Lecture 02: Feature Extraction
Kundan Kumar
[Link]
Topics to be covered
Boundary Representation
Boundary (Border) following
Chain codes
Polynomial Approximation
Signatures
Boundary Segments
Skeletons
Boundary Descriptors
Some Simple Descriptors
Shape Numbers
Fourier Descriptors
Statistical Moments
Regional Descriptors
Texture: Moment Invariants
Texture: GLCM, LBP
Transformed domain features
2D-Gabor filter features
1/61 Kundan Kumar Pattern Classification
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
x x
x
xx x
x x x x
x xx
xx x x
x x
x
Feature separability
x x
xx x x
x x x x
x xx
xx x x
x x
x
x x
x x x
xx xx xx
x x x
xx
x
x xx
xx x xx x xx
x x
x x x x x x
x x
Linear Non-linear Highly
Multi-modal
separability separability correlated
Labeled features
f1
f2 ∈ C1
f3
f4
f5
∈ C2
f6
f7
The mapping from pattern to features that is unique whereas mapping from feature
vector to pattern is not immediate.
So many patterns may be matched to the same feature of vector.
In pattern recognition, we never talk about a single pattern. We always talk about
feature vector.
Boundary Representation
I I. il
FAX
''
n .
L l
Binary Images
c c
1 1 1 1 c0 b0 1 1 1
a b c d e
b 1 1 b 1
1 1 1 1 1 FIGURE
1 11.11 Illustration
1 of the first few steps in the boundary-following algorithm
1 1 1 1 1 point
1 1
to be processed 1 next is labeled in black, the points yet to be processed are
1 1 1 1 1 1 the points
and 1 found 1by the algorithm are labeled as gray squares.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
†
As you will see later in this chapter, the uppermost, leftmost point in a boundary has the impo
a b c d e property thatKumar
11/61
Figure: Illustration of the Kundan
first fewasteps
polygonal approximation to the boundary has a convex vertex
in the boundary-following algorithm at that
Pattern location. Als
Classification
left and north neighbors of the point are guaranteed to be background points. These properties m
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
1. Let the starting point, b0 be the uppermost, leftmost point in the image that is labeled 1. Denote
by c0 the west neighbor of b0 . Clearly, c0 always is a background point. Examine the 8-neighbors
of b0 , starting at c0 and proceeding in a clockwise direction. Let b1 denote the first neighbor
encountered whose value is 1, and let c1 be the (back-ground) point immediately preceding b1 in
the sequence. Store the locations of b0 and b1 for use in Step 5.
2. Let b = b1 and c = c1 .
3. Let the 8-neighbors of b, starting at c and proceeding in a clockwise direction, be denoted by
n1 , n2 , . . . , n8 . Find the first nk labeled 1.
4. Let b = nk and c = nk−1
5. Repeat Step 3 and 4 until b = b0 and the next boundary point found in b1 . The sequence of b
points found when the algorithm stops constitutes the set of ordered boundary points.
1 c0 b0 c
1 1 1 1 1 b
1 1 1
1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
Figure:
a b cIllustration of an erroneous result when the stopping rule is such that boundary-following stops when the
starting point, b0 , is encountered again
FIGURE 11.2 Illustration of an erroneous result when the stopping rule is such that
boundary-following stops when the starting point, b0, is encountered again.
Figure: Direction numbers for (a) 4-directional chain code, and (b) 8-directional chain code
Direction 11.1 ■ Representation 799
to remove small detail
numbers for along the boundary
2 0 4 0
(a) 4-directional
0 a b c
chain code, and
(b) 8-directional 2 5 7
7 FIGURE 11.4
chain code. 1 (a) Digital
3 66
boundary with
2 6
resampling grid
1 6 superimposed.
(b) Result of
2 6
resampling.
6 (c) 8-directional
3
chain-coded
3 5 4 boundary.
Figure: (a) Digital boundary with resampling grid superimposed, (b) Result of resampling, (c) 8-directional
chain-coded boundary.
itself. This difference is obtained by counting the number of direction
changes (in a counterclockwise direction in Fig. 11.3) that separate two adja-
Can you draw cent elements of the
4-directional code. For instance,
chain-coded the first difference of the 4-direction
boundary?
chain code 10103322 is 3133030. If we treat the code as a circular sequence to
normalize with respect to the starting point, then the first element of the dif-
ference is computed by using the transition between the last and first com-
15/61 Kundan Kumar Pattern Classification
ponents of the chain. Here, the result is 33133030. Size normalization can be
sequence of numbers forms
Feature Extraction an integer
Boundary of minimum magnitude.
Representation Boundary We can nor-
Descriptors Regional Descriptors TD Features References
malize also for rotation (in angles that are integer multiples of the directions
Boundary representation: Chain Codes
in Fig. 11.3) by using the first difference of the chain code instead of the code
Digital Image Processing, 2nd ed. [Link]
1 2
Chapter 11
3 1
5 7
3 6
0 a b c
2 7
FIGURE 11.4
1 6 (a) Digital
boundary wi
2 6
resampling g
1 6 superimpose
(b) Result of
2 6
resampling.
6 (c) 8-directio
3
chain-coded
3 5 4 boundary.
Pattern Classification
a b c
Is the differential chain code is invariant to rotation at any angle? (HW)
FIGURE 11.4
(a) Digital
boundary with
resampling grid
superimposed.
(b) Result of
Regional Descriptors
resampling.
(c) 8-directional
chain-coded
Differential chain code: 0000616077171677 (validated)
boundary.11.1 ■ Repres
0 a
2 7
d by counting the number of direction FIG
1 6 (a
rection in Fig. 11.3) that separate two adja-
Boundary Descriptors
bo
ance, the first difference of the 4-direction 2 6
re
Kundan Kumar
Can you write the Differential Chain Code?
6 su
ting point, then the first element of the dif- (b
2 6
transition between the last and first com- re
sult is 33133030. Size normalization can be 6 (c
Chain code: 0707065444442311
3
ch
e resampling grid. 3 5 4 bo
only if the boundaries themselves are in-
s that are integer multiples of the directions
Boundary Representation
19/61
respect
he to the starting
resampling grid alongpoint,
the then the first
principal axeselement of the dif-
2
utedinby
sed using11.2.2,
Section the transition
or along between the last and first com-
its eigen axes, 3
hain. Here, the result is 33133030. Size normalization can be
3
ering the size of the resampling grid.
Feature Extraction
d fragments.
scale The which
change,
itself. This objective of this
seldom
difference example
the case isby
is isobtained Freeman
in practice.
countingFor chain
thein-numb
code and some of
e,object
thechanges
integer
digitizedof in
(in minimum magnitude,
two different
a counterclockwise and will
orientations
direction have11.3)
differ-
itsinvariations.
Fig. that se
undary
shapes centofelements
in the largest
general, object
with
of the the indegree
code. Fig.
For11.5(a).
of dissimilarity
instance, being
the first difference o
Feature Extraction Boundary Representation Boundary Descriptors
11.1.3 Polygonal Approximations Using Minimum-Perimeter
Regional Descriptors TD Features References
Polygons
Polygonal Approximation A digital boundary can be approximated with arbitrary accuracy by a polygon.
For a closed boundary, the approximation becomes exact when the number of
segments of the polygon is equal to the number of points in the boundary so that
each pair of adjacent points defines a segment of the polygon. The goal of a
polygonal approximation is to capture the essence of the shape in a given bound-
A digital boundary can be approximated with arbitrary accuracy by a polygon.
ary using the fewest possible number of segments. This problem is not trivial in
general and can turn into a time-consuming iterative search. However, approxi-
mation techniques of modest complexity are well suited for image processing
In practice, the goal of polygonal approximation is to capture the “essence” of the boundary
tasks. Among these, one of the most powerful is representing a boundary by a
minimum-perimeter polygon (MPP), as defined in the following discussion.
shape with the fewest Foundation
possible polygonal segments.
Minimum-perimeter polygon
An intuitively appealing approach for generating an algorithm to compute
MPPs is to enclose a boundary [Fig. 11.6(a)] by a set of concatenated cells, as
Splitting techniquein Fig. 11.6(b). Think of the boundary as a rubber band. As it is allowed to
shrink, the rubber band will be constrained by the inner and outer walls of
a b c
Figure: (a) An object boundaryFIGURE 11.6 (a) An object boundary (black curve). (b) Boundary enclosed by cells (in gray). (c) Minimum-
(black
perimeter polygoncurve). (b) theBoundary
obtained by allowing boundary to [Link]
The vertices of theby cells
polygon (inbygray). (c) Minimum-perimeter
are created
the corners of the inner and outer walls of the gray region.
polygon obtained by allowing the boundary to shrink. The vertices of the polygon are created by the corners of
the inner and outer walls of the gray region.
a b c
Figure: (a) Region (dark gray) resulting from enclosing the original boundary by cells. (b) Convex (white dots)
and concaveFIGURE
(black11.7 (a) Region
dots) vertices(dark gray) resulting
obtained from enclosing
by following the original
the boundary boundary
of the dark by cells
gray (see Fig.
region in 11.6).
the
(b) Convex (white dots) and concave (black dots) vertices obtained by following the boundary of the dark
counterclockwise direction.
gray region (c) Concave vertices
in the counterclockwise direction.(black dots)vertices
(c) Concave displaced todots)
(black theirdisplaced
diagonalto mirror locations in the
their diagonal
outer wall ofmirror
the bounding
locations inregion; the
the outer convex
wall of the vertices
bounding are notthe
region; changed. The MPP
convex vertices are not(black boundary)
changed. The MPP is
superimposed(black
for boundary)
[Link] superimposed for reference.
a b c
a
c d
FIGURE 11.9
(a) Original
boundary. d b
(b) Boundary
divided into
segments based
on extreme c c
points. (c) Joining a a
of vertices.
(d) Resulting
polygon.
d b d b
Figure: (a) Original boundary, (b) Boundary divided into segments based on extreme points, (c) Joining of
vertices, (d) Resulting polygon
For a closed boundary, the best starting points usually are two farthest points in the
boundary.
Farthest point can be obtained by Karhunen-Loeve transform (KLT).
The maximum perpendicular distance from a boundary segment to the line joining
its two end points not exceed a preset threshold.
Splitting procedure with a threshold equal to 0.25 times the length of line ab.
Signatures
A signature is a 1-D representation of a boundary (which is a 2-D thing): it should
be easier to describe.
e.g., distance form the centroid vs angle. 11.1 ■ Representation 809
a b
FIGURE 11.10
r r
u u Distance-versus-
angle signatures.
In (a) r(u) is
constant. In
(b), the signature
A A consists of
repetitions of the
r(u) r(u) pattern
r(u) = A sec u for
2A 0 … u … p>4 and
r(u) = A csc u for
A A
p>4 6 u … p>2.
0 p p 3p 5p 3p 7p p p 3p 5p 3p 7p
p 2p 0 p 2p
4 2 4 4 2 4 4 2 4 4 2 4
u u
Signatures
Boundary Segments
Boundary Segments
Convex hull H of an arbitrary set S is the smallest convex set containing S.
segments of the boundary. A more rugged technique is to use a polygonal ap-
The set difference
proximation S istocalled
H − prior theconvex
finding the convex deficiency
deficiency of a region.D of digital
Most the set S.
boundaries of interest are simple polygons (recall from Section 11.1.3 that
Note that in principle, this scheme
these are polygons is independent
without self-intersection). Grahamof
andregion size
Yao [1983] give and
an orientation.
algorithm for finding the convex hull of such polygons.
a b
FIGURE 11.12
(a) A region, S,
and its convex
S deficiency
(shaded).
(b) Partitioned
boundary.
Figure: (a) A region, S, and its convex deficiency (shaded). (b) Partitioned boundary.
Skeletonization a distance (see Section 2.5.3). Figure 11.13 shows some examples
clidean distance. The same results would be obtained with the
ed, at which
using
maximum
8-neighbors
timethethe algorithm
Eu- terminates, yielding the skeleton of the region.
Condition (a) is violated when contour point p1 has only one or seven
valued [Link] only one such neighbor implies that p1 is the end
of Section 9.5.7. point of a skeleton stroke and obviously should not be deleted. Deleting p1 if it
had seven such neighbors would cause erosion into the region. Condition (b) is
The MAT of a region has an intuitive definition based violated on the whenso-called
it is applied to points on a stroke 1 pixel thick. Hence this condi-
One way to represent a shape is to reduce it to a graph, by obtaining its skeleton
“prairie fire concept.” Consider an image region as a prairie tionofprevents
uniform,breaking drysegments of a skeleton during the thinning operation.
Conditions (c) and (d) are satisfied simultaneously by the minimum set of val-
grass, and suppose that a fire is lit along its border. All fire fronts will advance
ues: (p4 = 0 or p6 = 0) or (p2 = 0 and p8 = 0). Thus with reference to the
via thinning (skeletonization)
into the region at the same speed. The MAT of the region isneighborhood
the set ofarrangement
points in Fig. 11.14, a point that satisfies these conditions,
as well as conditions (a) and (b), is an east or south boundary point or a north-
reached by more than one fire front at the same time. west corner point in the boundary. In either case, p1 is not part of the skeleton
MAT (Medial axis transformation) is composed by all the points which have more and should
Although the MAT of a region yields an intuitively pleasing skeleton, di- be removed. Similarly, conditions (c¿) and (d¿) are satisfied simulta-
neously by the following minimum set of values: (p2 = 0 or p8 = 0) or
rect implementation of this definition is expensive computationally. Imple-
than one closest boundary points (“prairie fire concept”)
mentation potentially involves calculating the distance from
(p4 = 0 and p6 =
southeast
everycorner
0). These correspond to north or west boundary points, or a
point. Note that northeast corner points have p2 = 0 and
interior
p4 = 0 and thus satisfy conditions (c) and (d), as well as (c¿) and (d¿). The same
is true for southwest corner points, which have p6 = 0 and p8 = 0.
FIGURE 11.16
a b c Human leg bone
and skeleton of
the region shown
FIGURE 11.13 superimposed.
Medial axes
(dashed) of three
simple regions.
(a) (b)
Figure: (a) Medial axes (dashed) of three simple regions,(b) Human leg bone and skeleton of the region
Boundary Features/Descriptors
Simple descriptors
length of a boundary is one of its simplest descriptors.
The number of pixels along a boundary gives a rough approximation of its length.
For a chain coded curve with unit spacing:
√
length = Horizontal + Vertical + 2 × Diagonal
diameter (length of the major axis)
The minor axis of a boundary is defined as the line perpendicular to the major axis.
Basic rectangle (formed by the major and the minor axis; encloses the boundary)
and its
major axis
eccentricity =
minor axis
30/61 Kundan Kumar Pattern Classification
computed by treating the chain code as a circular sequence, as discussed in
Feature Extraction Boundary Representation principal shape Regional
Boundary Descriptors features Descriptors
of the boundary. TD Features References
Section 11.1.2. Although the first difference of a chain code is independent of
An approach frequently used to circumvent these problems is to resample
rotation, in general the coded boundary depends on the orientation of the
the boundary by selecting a larger grid spacing, as Fig. 11.4(a) shows. Then, as
Shape Number grid. One way to normalize the grid orientation is by aligning the chain-code
the boundary is traversed, a boundary point is assigned to each node of the
grid with the sides of the basic rectangle defined in the previous section.
large grid, depending on the proximity of the original boundary to that node,
In practice, for a desired shape order, we find the rectangle of order n
as in Fig. 11.4(b). The resampled boundary obtained in this way then can be
whose eccentricity (defined in the previous section) best approximates that of
Shape number: the first difference as smallest magnitude (treating the chain code
represented by a 4- or 8-code. Figure 11.4(c) shows the coarser boundary
the basic rectangle and use this new rectangle to establish the grid size. For
points represented by an 8-directional chain code. It is a simple matter to
as a circular sequence) convert from an 8-code to a 4-code, and vice versa (see Problems 2.12 and 2.13).
The starting point in Fig. 11.4(c) is (arbitrarily) at the topmost, leftmost point
IGURE 11.17
Order of a shape: the number of digits in Shape number.
Order 4 Order 6 of the boundary, which gives the chain code 0766 Á 12. As might be expected,
All shapes of the accuracy of the resulting code representation depends on the spacing of
rder 4, 6, and 8. the sampling grid.
The directions are
rom Fig. 11.3(a), The chain code of a boundary depends on the starting point. However, the
nd the dot Chain code: 0 3 2 1 0 0 3 2 2 1 code can be normalized with respect to the starting point by a straightfor-
ndicates the ward procedure: We simply treat the chain code as a circular sequence of di-
tarting point. Difference: 3 3 3 3 3 0 3 3 0 3
rection numbers and redefine the starting point so that the resulting
Shape no.: 3 3 3 3 0 3 3 0 3 3 sequence of numbers forms an integer of minimum magnitude. We can nor-
malize also for rotation (in angles that are integer multiples of the directions
in Fig. 11.3) by using the first difference of the chain code instead of the code
Order 8
a b 1 2
3 1
FIGURE 11.3
Direction
numbers for 2 0 4 0
Chain code: 0 0 3 3 2 2 1 1 0 3 0 3 (a)
2 24-directional
1 1 0 0 0 3 2 2 2 1
chain code, and
Difference: 3 0 3 0 3 0 3 0 3 3 1 3 (b)
3 0 8-directional
3 0 3 0 0 3 3 0 0 3 5 7
chain code.
Shape no.: 0 3 0 3 0 3 0 3 0 3 0 3 3 1 3 3 0 0 3 3 0 0 3 3 3 6
osehe nucta ep le f o e r wn ce g
nust odr is o
of at pbefrerrelo rde
[Link] ar ligenctaitns fiirth t iffere
ohne b andalig(d).its f
conds a. 11n.d1 us ).
and use its difference compute number, shown
nu
shhm
r
o
o
hlos re c r se d w t d
cod . 11.1
chain code
gridgrid to the basic rectangle.
se
c s a asi u ne irs
Fige a 8(d
TD shape
Features number.
f
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors shape
dis- Computing References
Fig
tain
Fig. a shape
11.18(d). number of this order requires following ■ ■
the steps just
mb
pe t n st er o o f hor 1 ltinFig co . T
Fig. 11.18(d).
id
cussed. The first step is to find the basic rectangle, as shown in Fig. 11.18(b).
f
er
t n er is s fi s o 18 ba ig * Th(c) thel st e n
n
e
ShapeTheNumber
closest rectangle of order 18 is a 3 * 6 rectangle, requiring subdivision
f
e
a b a b
o
p
ss
o
Itcode
is advisable todifference
and use its first normalize the the
to compute gridshape
orientation by FIGURE
number, as shown aligning
in the chain code grid to
cif
Fig. 11.18(d).
i
in the
n
the basic rectangle. Steps in the
fo
shapeshape number.
number.
8
n
1 a b1
F
g
e
Ch
m
3FIGURE
3 11.18
ChD
.
m
ain
ainif
Steps in the
Di
he the
cod
fSfeh
fceor
generation of a
Sh
raepne
denec
e:
shape number.
ap
h ,
: e0:
cen:o
en
0
1 1
o.:
0
30
.3:
0
00
00
2 0
00
0
0
2
0
00
11
00
0
0
Ch
c
3
ChD
03
3
00
1
0
ain
0
3
ainif
33
0 1
Di
3
33
0
1
0
cod
1 0
fSfeh
fceor
1
20 2
3
Sh
3
03
0 3
raepne
edne
0
120
e:
ap
2
32
1
Chain code: 0 0 0 0 3 0 0 3 2 2 3 2 2 2 1 2 1 1
:ce0:
3
3
cen:o
en
2
Chain code:
0 00 00 00 30 03 00 30 23 22 32 23 22 22 12 21 12 11 1
3
33
2 0
Chain code:
3
3
23
o.:
3
30
.3:
00
3 1
2
0
0
2
00
0
2
0 0
ChainChain code:
0 0 00 00 30 003 03 030 200 23 032 3
22 23122 0
12 223 11 312 10 1 1
1 3
0
Difference: 3 0 0 3 1 3 0
1
code:
2
00
32
33/61
01 3Prepared3by Dr.1 Kundan
00 3Kumar Pattern Classification
0 0
Difference:
3 03 00 00 30 13Prepared
0 3by
3 0Dr.10Kundan
3 03 Kumar 0 13 31 03 0
3
0
33/61 Pattern Classification
3
Difference:
in
3
2
03
02
00
0 3
0
0
Difference:
Difference: 3 0 03 00 30 10 03 31 30 03 13 30 01 03 30 10 33 01 3 0
1
3
0
0 1
00
1 3
3 1
3
0
Shape no.: 0 0 0 3 1 0 3 3 0 1 3 0 0 3 1 3 0 3
2
0
2 1
1 0
3 1
1
3
Shape 0 00 no.:
no.:Shape
no.: 30 010 0300310300 3
03 01313
30 00110330
30 3103 3303011330 3
3 0 1303 00 30 13 31 03 30
3
Shape 0no.:
1
03
0
Shape
1 3
0 3
1 3
0
1
1
1
32
1 0
3
3
3
3
2
3
a bd
33
2 0
00
a b UR
3
3
c
cF SdtepsEr
3
2
00
3 1
3
0
FIGge pas p
IG
2
1
Stesh e
Chain code: 0 0 0 0 3 0 0Kundan
3 2 2 Kumar
3 2 2 2 1 2 1 1
2 3
1 3
32/61 Pattern Classification
1
gen
UnRe
2
2 0
3 0
sha
3
E1
2
2
0
0
i
Feature Extraction Boundary Representation P-1
Boundary Descriptors Regional Descriptors TD Features References
1
sN (k) = j2puk>P
P ua
a(u)e (11.2-5)
Fourier Descriptors =0
E 11.19 jy
tal
dary and its
sentation as
plex
Imaginary axis
nce. The
(x0, y0) and
) shown are
rarily) the y0
wo points in y1
quence.
x
x 0 x1
Real axis
Figure: A digital boundary and its representation as a complex sequence. The point (x0 , y0 ) and (x1 , y1 ) shown
are (arbitrarily) the first two points in the sequence.
Fourier Descriptors
for k = 0, 1, 2, . . . , N − 1.
The discrete Fourier transform (DFT) of s(k) is
N
X −1
a(u) = s(k)e−j2πuk/N
k=0
for u = 0, 1, 2, . . . , N − 1
a(u) are Fourier Descriptors.
g(r) a b
FIGURE 11.21
(a) Boundary
segment.
(b) Representation
as a 1-D function.
r
†
Recall from Chapter 4 that the Fourier transform of a constant is an impulse located at the origin.
Once a boundaryRecallis
alsodescribed
that the impulse isas
zero a 1-D function,
everywhere else. statistical moments (mean,
variance, and a few higher-order central moments) can be used to describe it.
N
X −1
µn (z) = (zi − m)n p(zi )
i=0
N
X −1
m= zi p(zi )
i=0
35/61 Kundan Kumar Pattern Classification
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
Regional Features/Descriptors
Liver
parenchyma
External
tissue
Liver
parenchyma
External
tissue
Region Features
Texture
An important
828 Chapter approach to and
11 ■ Representation region description is to quantify its texture content.
Description
a b c
FIGURE 11.28
The white squares
mark, from left to
right, smooth,
coarse, and
regular textures.
These are optical
microscope
images of a
superconductor,
human
cholesterol, and a
microprocessor.
(Courtesy of Dr.
Michael W.
Davidson, Florida
State University.)
Figure: The white squares mark, from left to right, smooth, coarse, and regular textures. These are optical
microscope images of a Statistical
superconductor,
approacheshuman cholesterol, and a microprocessor. (Courtesy of Dr. Michael
W. Davidson, Florida State
One ofUniversity.)
the simplest approaches for describing texture is to use statistical moments
of the intensity histogram of an image or region. Let z be a random variable de-
noting intensity and let p(zi), i = 0, 1, 2, Á , L - 1, be the corresponding his-
39/61 togram, where L is theKundan
numberKumar
of distinct intensity levels. From Eq. (3.3-17), the Pattern Classification
nth moment of z about the mean is
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
is a measure of the skewness of the histogram while the fourth moment is a measure of its
relatives flatness.
Some useful additional texture measures bases on histograms include a measure of
“uniformity”, given by
L−1
X
Uniformity = p2 (zi )
i=0
TABLE 11.2
Standard Third
Texture measures
Texture Mean deviation R (normalized) moment Uniformity Entropy
for the subimages
Smooth 82.64 11.79 0.002 -0.105 0.026 5.434 shown in Fig. 11.28
Coarse 143.56 74.63 0.079 -0.151 0.005 7.783
Regular 99.72 33.73 0.017 0.750 0.013 6.674
Image Histograms
The histogram of a digital image with intensity levels in the range [0, L − 1] is a
discrete function
h(rk ) = nk (1)
where, rk is the kth intensity value and nk is the number of pixels in the image
with intensity rk
Normalized histogram
rk
p(rk ) = for k = 0, 1, 2, . . . , L − 1. (2)
MN
p(rk ) is an estimate of the probability of occurrence of intensity level rk in an image.
0 0 0 1 2
Compute histogram
1 1 0 1 1
2 2 1 0 0
1 1 0 2 0
Compute the histogram of the given image. First find out the number graylevels in the
0 0 1 0 1
image (how many bit image?).
16
1 0 2 4 5 3 1
14
9 1 1 4 7 2 1 12
10 3 7 3 5 3 3 10
11 2 3 3 3 2 1
8
6
7 5 6 6 7 6 1
4
1 4 1 1 4 9 1 2
2 8 1 1 5 1 1 0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Above calculation is just for demonstration. For real images, GLCM matrix dimension is
L × L, where index varies as i = 0, 1, 2, . . . , L − 1, j = 0, 1, 2, . . . , L − 1.
45/61 Kundan Kumar Pattern Classification
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
GLCM Features
Maximum probability: Measure of the strongest response of G. The range of value is [0, 1].
Contrast: A measure of intensity contrast between a pixel and its neighbor over the entire image.
The range of values is 0 (When G is constant) to (L − 1)2 .
X L−1
L−1 X
Contrast = (i − j)2 pij
i=0 j=0
Inverse Element Difference Moment: A measure of intensity contrast between a pixel and its
neighbor.
X L−1
L−1 X pij
k
for i 6= j
i=0 j=0 (i − j)
GLCM Features
Uniformity/Energy: A measure of how intensities are uniformly distributed.
L−1
X L−1
X
Uniformity = pij 2
i=0 j=0
Homogeneity: Measures the spatial closeness of the distribution of elements in G to the diagonal.
The range of values is [0,1], with the maximum being achieved when G is a diagonal matrix.
L−1
X L−1
X pij
Homogeneity =
i=0 j=0
1 + |i − j|
also defined as
L−1
X L−1
X pij
Homogeneity =
i=0 j=0
1 + (i − j)2
GLCM Features
Entropy: Measures the randomness of the elements of G. The entropy is 0 when all pij ’s are 0 and
is maximum when all pij ’s are equal. The maximum value is 2 log2 L.
L−1
X L−1
X
Entropy = − pij log2 pij
i=0 j=0
Correlation: A measure of how correlated a pixel is to its neighbor over the entire image. Range of
values is 1 to −1.
L−1
X L−1X (i − mr )(j − mc )pij
Correlation =
i=0 j=0
σr σc
L−1
X L−1
X L−1
X L−1
X
mr = i pij mr = j pij
i=0 j=0 j=0 i=0
L−1
X L−1
X L−1
X L−1
X
σr2 = (i − mr )2 pij σc2 = (j − mc )2 pij
i=0 j=0 j=0 i=0
GLCM Correlation
0.4
0.3 Grass
0.5 Sky
0.2
GLCM Correlation
0.4
0.1
0.3
0.0
Original Image 0.2 2.5 5.0 7.5 10.0 12.5 15.0
0.1 GLCM Dissimilarity
0.0
Original Image 2.5 5.0 7.5 10.0 12.5 15.0
GLCM Dissimilarity
1 1 1 1 1 1 1 0 =254
10 12 9
6 7 19 1 1 1 1 1 1 0 1 =253
7 10 16 1 1 1 1 1 0 1 1 =251
am•FMqfMBdswod
LBP
1 1 1 1 0 1 1 1 =247
GEEZERS 1 1 1 0 1 1 1 1 =239
1 1 0 1 1 1 1 1 =223
6 10 12
1 0 1 1 1 1 1 1 =191
50/61 7 7 Kumar
Kundan 9 Pattern Classification
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
5 4 2 2 1 1 1 0 0 0 1 0 1
3 5 8 1 3 2
7
2
6
2
2 0
2 = 197
2 5 4 1 2 1 0 0 0 1 0 1 1
4 3 7 2 7 2
7
2
3
2
1 0
2 = 139
1 4 4 2 6 0 0 0 1 0 1 1 1
4 2 1 0
2 2 2 2 = 23
?
23
1 1 1 0 0 0 1 0
51/61 Kundan Kumar Pattern Classification
7 6 5 1
Feature Extraction Boundary Representation Boundary Descriptors Regional Descriptors TD Features References
25000
20000
2D-Gabor filters
Gabor filters are bandpass filters which are used in image processing for
feature extraction,
texture analysis, etc.
In the spatial domain, a 2D Gabor filter is a Gaussian kernel function modulated by
a sinusoidal wave.
02
x + γ 2 y 02 x0
gλ,θ,ϕ,σ,γ (x, y) = exp − exp i 2π + ϕ
2σ 2 λ
2D Gabor Functions
Complex
02
x + γ 2 y 02 x0
gλ,θ,ϕ,σ,γ (x, y) = exp − exp i 2π + ϕ
2σ 2 λ
Real
x02 + γ 2 y 02 x0
gλ,θ,ϕ,σ,γ (x, y) = exp − cos 2π + ϕ
2σ 2 λ
Imaginary
x02 + γ 2 y 02 x0
gλ,θ,ϕ,σ,γ (x, y) = exp − sin 2π + ϕ
2σ 2 λ
where
x0 =x cos θ + y sin θ
y 0 = − x sin θ + y cos θ
x0 =x cos θ + y sin θ
y 0 = − x sin θ + y cos θ
0 + 0
ian
FIGURE 11.39
Formation of
vector from
corresponding
pixels in six
images.
Spectral band 6
x1
Spectral band 5
x2
x3 Spectral band 4
x
x4 Spectral band 3
x5 Spectral band 2
x6
Spectral band 1
References
[1] Rafael C Gonzalez, Richard E Woods, et al. Digital image processing. 2002.