Sie sind auf Seite 1von 58

Pattern Recognition

Professor Sayed Fadel Bahgat

Lecture 6, lecture 7

Pattern Recognition

Professor Sayed Fadel Bahgat

Lecture 6, lecture 7

Prof. Dr Sayed Fadel Bahgat


Sayed_fadel2006
Sayed_fadel
2006@yahoo.com
@yahoo.com

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Chapter two

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Homogeneity (HOM)
(also called
"Inverse Difference Moment")

Homogeneity weights values by the inverse of


the Contrast weight, with weights decreasing
exponentially away from the diagonal:

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Homogeneity equation =

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise:
Calculate the homogeneity value for the
horizontal GLCM and compare it with the
Dissimilarity value.
Homogeneity calculation:
Homogeneity weights X horizontal GLCM

Homogeneity equation =

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+(i-j)2)-1
1

0.5

0.2

0.1

0.5

0.5

0.2

0.2

0.5

0.5

0.1

0.2

0.5

Lecture 6, lecture 7

Sayed
Fadel

Professor
Bahgat

Pattern Recognition

Pij

(1+(i-j)2)-1

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Normalized symmetrical horizontal


GLCM matrix
0.166

0.083

0.042

0.083

.166

0.042

0.25

0.042

.042

0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+(i-j)2)-1
1

0.5

0.2

0.1

0.166 0.083 0.042

0.5

0.5

0.2

0.083

.166

0.2

0.5

0.5 X

0.042

0.25 0.042

0.1

0.2

0.5

.042 0.083

0.166

0.042

1
.008

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+(i-j)2)-1
1

0.5

0.2

0.1

0.166 0.083 0.042

0.5

0.5

0.2

0.083

.166

0.2

0.5

0.5 X 0.042

0.25 0.042

0.1

0.2

0.5

.042 0.083

0.166

0.042

.008

0.042

0.166

0.008

0.25

0.021

0.021

0.083

sum of multiplication results matrix = .807


Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

sum of multiplication results matrix = .807


In non-matrix form:
0.166(1)+ 0.083(0.5)+ 0.042(0.2)+ 0(0.1) +
0.083(0.5)+ 0.166(1) + 0(0.5)+ 0(0.2) +
0.042(0.2)+ 0(0.5) + 0.250(1)+0 .042(0.5)
+0(0.1)+ 0(0.2)+0.042(0.5)

+ .083(1)1
= 0.166 + 0.042 + 0.008 + 0
+ 0.042 + 0.166 + 0
+ 0
+ 0.008 + 0
+ 0.250 + 0.021
+ 0
+ 0
+ 0.021 +0 .083
= .807
Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Simple Analysis of Texture

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Homogeneity is the most commonly used


measure that increases with less contrast
in the window.
However, it would be easy to use the
above model to construct a first degree
"similarity" measure. Write the equation
and perform the calculation for "similarity"
using the horizontal GLCM

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Homogeneity is the most commonly used


measure that increases with less contrast
in the window.
However, it would be easy to use the
above model to construct a first degree
"similarity" measure
Equation =

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise:
Calculate the similarity value for the
horizontal GLCM.
Similarity calculation:
= "Similarity weights X horizontal GLCM
= multiplication results

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+|i-j|)-1

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+|i-j|)-1
1

0.5 0.333

0.5

0.333

0.5

0.25 0.333

0.5

0.25

0.5 0.333
0.5 X
1

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Normalized symmetrical horizontal


GLCM matrix
0.166

0.083

0.042

0.083

.166

0.042

0.25

0.042

.042

0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+|i-j|)-1
1

0.5 0.333

0.5

0.333

0.5

0.25 0.333

0.5

0.166

0.25

0.5 0.333

0.042

0.5 X
1

.014

0.166 0.083 0.042

0.083

.166

0.042

0.25 0.042

.042 0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Pij

(1+|i-j|)-1
1

0.5 0.333

0.5

0.333

0.5

0.25 0.333

0.5

0.166 0.083 0.042

0.083

.166

0.042

0.25 0.042

.042 0.083

0.25

0.5 0.333
0.5 X

0.166

0.042

.014

0.042

0.166

0.014

0.25

0.021

0.021

0.083

sum of multiplication results matrix = .807


Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

sum of multiplication results matrix = .807


In non-matrix form:
0.166(1)+ 0.083(0.5)+ 0.042(0.333)+ 0(0.25) +
0.083(0.5)+ 0.166(1) + 0(0.5)+ 0(0.333) +
0.042(0.333)+ 0(0.5) + 0.250(1)+0 .042(0.5)
+0(0.25)+ 0(0.333)+0.042(0.5) + .083(1)
= 0.166 + 0.042 + 0.014 + 0
+ 0.083 + 0.166 + 0
+ 0
+ 0.014 + 0
+ 0.250 + 0.021
+ 0
+ 0
+ 0.021 + 0 .083
= .804

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Simple Analysis of Texture

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Simple Analysis of Texture

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Angular Second Moment (ASM) and


Energy (also called Uniformity)
ASM and Energy use each Pij as a weight
for itself. High values of ASM or Energy
occur when the window is very orderly.

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

ASM equation =
The square root of the ASM is sometimes
used as a texture measure, and is called
Energy.

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Normalized symmetrical horizontal


GLCM matrix
0.166

0.083

0.042

0.083

.166

0.042

0.25

0.042

.042

0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise: Perform the ASM calculation


for the horizontal GLCM.
Answer.
matrix of ( Pij )2:
0.027

0.007

0.002

0.007

0.028

0.002

0.0625

0.002

0.002

0.007

summed = 0 .145
Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Simple Analysis of Texture

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Simple Analysis of Texture

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Simple Analysis of Texture

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Entropy equation =

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Entropy =
ln(Pij)* horizontal GLCM * (-1)
=
multiplication results

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Normalized symmetrical horizontal


GLCM matrix

(Pi,j)
0.166

0.083

0.042

0.083

.166

0.042

0.25

0.042

.042

0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

ln ( Pi,j)
-1.7957

-2.4889

-3.1700

-2.4889

-1.7957

-3.1700

-1.38

-3.1700

-3.1700

-2.4889

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

-ln ( Pi,j)

Pi,j
0.166 0.083 0.042

0.083

.166

0.042

0.25 0.042

.042 0.083

0.2980 0.2065
0.2065 0.2980

1.7957

2.4889

3.1700

2.4889

1.7957

3.1700

1.38

3.1700

0 3.1700

2.4889

0.1331
0

0
0

0.1331

0 0.3465

0.1331

0 0.1331

0.2065

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Entropy = sum of product


0.2980

0.2065

0.1331

0.2065

0.2980

0.1331

0.3465

0.1331

0.1331

0.2065

sum of multiplication results matrix = 2.0951


Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

GLCM Mean
GLCM Mean Equations

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

The left hand equation calculates the


mean based on the reference pixels, i. It
is also possible to calculate the mean
using the neighbor pixels, j, as in the right
hand equation.
For the symmetrical GLCM, the two
values i and j are identical.

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise:
For test image,
Calculate the mean of symmetrical
horizontal and Vertical GLCM.

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Normalized symmetrical horizontal


GLCM matrix

(Pij)
0.166

0.083

0.042

0.083

.166

0.042

0.25

0.042

.042

0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

for the test image, calculate the Mean of


symmetrical horizontal GLCM :
i = 0* ( 0.166 + 0.083 + 0.042 + 0 ) +
1* ( 0.083 + 0.166 + 0 + 0 ) +
2* ( 0.042 + 0 + 0.250 + 0.042) +
3* ( 0 + 0 + 0.042 + 0.083)

= 0.249 + 2(0.334) + 3(0.125)

= 0.249 + 0.668 + 0.375

= 1.292 = j
Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Normalized symmetrical Vertical GLCM


matrix
(Pi,j)
0.250

0.083

0.167

.083

0.083

0.083

0.083

0.083

0.083

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

for the test image, calculate the Mean of


symmetrical vertical GLCM
i = 0*(0.250 + 0 + .083+ 0 ) +
1*( 0 + 0.167 + 0.083 + 0 ) +
2*(0.083 + 0.083 + 0.083 + 0.083) +
3*( 0 + 0 + 0.083 + 0 )
=1.162 = j

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

the mean for the original values in the


window (not the GLCM mean) is 1.25.
0

This clearly demonstrates that the GLCM


Mean and the "ordinary" mean are not the
same measure.

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

The "ordinary mean would be a first-order


"texture" measure,
it is difficult to see how it could be called
texture in any practical sense.
The first-order standard deviation,
however, is commonly used as a texture
measure.
remember, all GLCM texture is secondorder (concerning the relationship between
two pixels).
Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise: Calculate the Variance texture for


both the horizontal and vertical GLCM of the
test image.
GLCM Variance (GLCM Standard Deviation)
Variance equation =

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Standard deviation equation

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Properties of Variance
Variance is a measure of the dispersion of
the values around the mean.
It is similar to entropy. It answers the
question "What is the dispersion of the
difference between the reference and the
neighbor pixels in this window?"

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise: Calculate the Variance texture for both the


horizontal and vertical GLCM of the test image.

i= 1.292

0.166 0.083 0.042


0
0.083 .166
0
0
0.042
0 0.25 0.042
0
0 .042 0.083

Variance (horizontal) =
0.166(0-1.292)2 + 0.083(0-1.292)2 + 0.042(0-1.292)2 + 0
+ 0.083(1-1.292)2 + 0.166((1-1.292)2 + 0
+0
+ 0.042(2-1.292)2 + 0
+ .250(2-1.292)2 + .042(21.292)2
+0
+0
+ .042(3-1.292)2 + .083(31.292)2
= 1.039067
Lecture
6, lecture 7 Professor Sayed Fadel Bahgat
Pattern Recognition

j= 1.162

Variance (vertical) =

0.250
0 0.083
0
0 0.167 .083
0
0.083 0.083 0.083 0.083
0
0 0.083
0

0.250(0 -1.162)2 + 0 + .083(0 -1.162)2 + 0 +


0 + 0.166(1 -1.162)2 + .083(1 -1.162)2 + 0 +
0.083(2 -1.162)2 + 0.083(2 -1.162)2 + 0.083(2 -1.162)2 + .083(21.162)2
+ 0 + 0 + 0.083(3 -1.162)2 + 0
=0.969705
Variance calculated on the original image values rather than on the
GLCM = 1.030776

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

GLCM Correlation
The Correlation texture measures the
linear dependency of grey levels on those
of neighboring pixels.
GLCM Correlation equation:

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Exercise: Calculate the Correlation


measure for the horizontal test image.
this is easier if you do the GLCM Mean
and Variance exercises first and use their
results

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Correlation (horizontal GLCM):


Let A = 1/ [(1.039067)(1.039067)] .5
0.166 (0-1.292) (0-1.292)A + 0.083(0-1.292)(1-1.292)A
+ 0.042(0-1.292)(2-1.292)A + 0
+ 0.083 (1-1.292)(0-1.292) A + 0 .166 (1-1.292)(1-1.292)A + 0+ 0
+ 0.042(2-1.292)(0-1.292)A + 0
+ 0.250(2-1.292)(2-1.292)A + 0 .042 (2-1.292)(3-1.292)A
+ 0 + 0 + 0.042 (3-1.292)(2-1.292)A +.083 (3-1.292)(3-1.292)A =
= 0.7182362

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Creating a texture image


The result of a texture calculation is a
single number representing the entire
window.
This number is put in the place of the
centre pixel of the window, then the
window is moved one pixel and the
process is repeated of calculating a new
GLCM and a new texture measure. In this
way an entire image is built up of texture
values
Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Example: For a 5x5 window,

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Lecture 6, lecture 7

Professor Sayed Fadel Bahgat

Pattern Recognition

Das könnte Ihnen auch gefallen