GLCM: The GLCM
is a tabulation of how often different combinations of pixel brightness values
(grey levels) occur in an image.
Framework for the GLCM:
Spatial relationship between two pixels:
GLCM texture considers the relation between two pixels
at a time, called the reference and the neighbour pixel.
In the illustration below, the neighbor pixel is chosen to be the one to the
east (right) of each reference pixel. This can also be expressed as a (1,0)
relation: 1 pixel in the x direction, 0 pixels in the y direction.
Each pixel within the window becomes the reference
pixel in turn, starting in the upper left corner and proceeding to the lower
right. Pixels along the right edge have no right hand neighbour, so they are
not used for this count.
Test Image :
0 0 1 1
0 0 1 1
0 2 2 2
2 2 3 3
Separation between two pixels:
If
the window is large enough, using a larger offset is perfectly possible. There
is no difference in calculation method. The sum of all the entries in the GLCM
(i.e. the number of pixel combinations) will just be smaller for a given window
size.
Combinations of the grey levels that are possible for
the test image, and their position in the matrix.
This is the only time that the labels in the top row
and left column will be shown. All further representations of the GLCM include
only the 16 data cells.
neighbour pixel value ->
ref pixel value:
|
0
|
1
|
2
|
3
|
0
|
0,0
|
0,1
|
0,2
|
0,3
|
1
|
1,0
|
1,1
|
1,2
|
1,3
|
2
|
2,0
|
2,1
|
2,2
|
2,3
|
3
|
3,0
|
3,1
|
3,2
|
3,3
|
How to read the matrix framework:
The top left cell will be filled with the number of
times the combination 0,0 occurs, i.e. how many times within the image area a
pixel with grey level 0 (neighbour pixel) falls to the right of another pixel
with grey level 0 (reference pixel).
A different co-occurrence matrix exists for each
spatial relationship
3
|
0
|
2
|
0
|
0
|
2
|
2
|
0
|
0
|
0
|
1
|
2
|
0
|
0
|
0
|
0
|
Transposing: making the matrix symmetrical around the
diagonal
The east matrix counted each reference pixel with the
neighbour to its right (east). If counting is done this way, using one
direction only, then the number of times the combination 2,3 occurs is not the
same as the number of times the combination 3,2 occurs (for example 3 may be to
the right of 2 three times, but to the left of 2 only once). However, symmetry
will be achieved if each pixel pair is counted twice: once "forwards"
and once "backwards" (interchanging reference and neighbour pixels
for the second count).
Symmetry also means that when considering an eastern
(1,0) relation, a western (-1,0) relation is also counted. This could now be
called a "horizontal" matrix.
Count
(south)
matrix
+ Transpose
north)
= Symmetrical
(vertical)
3
|
0
|
2
|
0
|
|
3
|
0
|
0
|
0
|
|
6
|
0
|
2
|
0
|
0
|
2
|
2
|
0
|
|
0
|
2
|
0
|
0
|
|
0
|
4
|
2
|
0
|
0
|
0
|
1
|
2
|
|
2
|
2
|
1
|
0
|
|
2
|
2
|
2
|
2
|
0
|
0
|
0
|
0
|
|
0
|
0
|
2
|
0
|
|
0
|
0
|
2
|
0
|
Normalization: The GLCM expressed as a probability
After making the GLCM symmetrical, there is still one
step to take before texture measures can be calculated. The measures require
that each GLCM cell contain not a count, but rather a probability.
.250
|
0
|
.083
|
0
|
0
|
.167
|
.083
|
0
|
.083
|
.083
|
.083
|
.083
|
0
|
0
|
.083
|
0
|
Calculating texture measures from the GLCM
Most texture calculations are weighted
averages of the normalized GLCM cell contents.
A weighted average multiplies each value to be used by
a factor (a weight) before summing and dividing by the number of values. The
weight is intended to express the relative importance of the value.
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.
Example: For a 5x5 window, the outer 2 rows and columns of the image receive the
texture values calculated in row 3 (top edge), column 3 (left edge), row L-2
(bottom edge) and column P-2 (right edge) where P,L are the dimensions in
pixels and lines of the original image. For the illustrated image, L=P=10, so
values are calculated from row 3 and column 3 through row 8 and column 8.
Edge of image problems Each cell in a window must sit over an occupied image cell. This
means that the centre pixel of the window cannot be an edge pixel of the image.
If a window has dimension N x N, a strip (N-1)/2 pixels wide around the image
will remain unoccupied. The usual way of handling this is to fill in these edge
pixels with the nearest texture calculation.
Groups of texture measures
1. Contrast group: Measures related to contrast use weights
related to the distance from the GLCM diagonal.
2. Measures related to orderliness
3. Group using descriptive statistics of the GLCM texture
measures
Contrast (CON) (this is also called "sum
of squares variance"):
Contrast equation
Calculation example: for the
horizontal GLCM, Contrast equals
Contrast
weights: X
horizontal GLCM
= multiplication
result
0
|
1
|
4
|
9
|
|
0.166
|
0.083
|
0.042
|
0
|
|
0
|
0.083
|
.168
|
0
|
1
|
0
|
1
|
4
|
|
0.083
|
0.166
|
0
|
0
|
|
0.083
|
0
|
0
|
0
|
4
|
1
|
0
|
1
|
|
0.042
|
0
|
.249
|
0.042
|
|
.168
|
0
|
0
|
.042
|
9
|
4
|
1
|
0
|
|
0
|
0
|
0.042
|
0.083
|
|
0
|
0
|
.042
|
0
|
Sum of all elements in the multiplication result table = 0.586
In detail:
.166*(0-0)2 + .083*(0-1)2 + .042*(0-2)2 +
0*(0-3)2 +
.083*(1-0)2 + .166*(1-1)2 + 0*(1-2)2 +
0*(1-3)2 +
.042*(2-0)2 + 0*(2-1)2 + .250*(2-2)2 +
.042*(2-3)2 +
0*(3-0)2 + 0*(3-1)2 + .042*(3-2)2 +
.083*(3-3)2
= .166(0) + .083(1) + .042(4) + .083(1) + .166(0) + .042(4) + .25(0) +
.042(1) + .042(1) + .083(0)
= .083 + .168 + .083 + .168 + .042 + .042
= .586
Dissimilarity (DIS)
In the Contrast measure, weights increase
exponentially (0, 1, 4, 9, etc.) as one moves away from the diagonal. However
in the dissimilarity measure weights increase linearly (0, 1, 2,3 etc.).
No comments:
Post a Comment