• No results found

Chapter 1 Introduction

3.2 Grey-Level Co-occurrence Matrices

A very well-known and established statistical method of examining texture is use of the Grey-Level Co-occurrence Matrix (GLCM), sometimes known as the grey-tone spatial-dependence matrix. Introduced by Haralick and others (1973), a GLCM of an image is a concise summary of the frequencies at which grey levels (pixel intensities) in an image occur at a specified displacement from each other, thus encapsulating the spatial relationships between pixels in an image. Statistical texture features are then extracted based on one or more GLCMs of an image.

3.2.1 GLCM calculation

Natural greyscale images usually contain many grey levels, the most common being 8-bit images with 28= 256 pixel intensities or grey levels (each grey level 𝑔 is in the range 0 ≀ 𝑔 ≀ 255, 𝑔 ∈ β„•). However, in GLCM calculation a fairly low number of grey levels (𝐺) is often used, which reduces computation time and acts as noise reduction. The greyscale image 𝐼𝐺 is therefore first scaled so that each grey level 𝑔 is scaled to lie between 0 and 1:

where 𝑔max and 𝑔min are the maximum and minimum grey levels in the original image, respectively. Then, the β€œimage” from which the GLCM is calculated becomes:

where βŒŠβˆ™βŒ‹ denotes the flooring operator and 𝐽 is a matrix of ones with the same dimensionality as the image. 𝐼𝐺𝐿𝐢𝑀 will have grey levels 1 ≀ 𝑔 ≀ 𝐺, 𝑔 ∈ β„•. A popular value for 𝐺 is 8, but the hyperparameter should ideally be optimised since a trade-off exists between the benefits of noise reduction and the loss of original image information (Clausi, 2002).

Formally, the definition of the GLCM is as follows. Let us denote a GLCM of image 𝐼 as 𝑃𝐼(𝑑, 𝐺), where 𝑑 = (𝑑π‘₯, 𝑑𝑦) is a chosen displacement between each pair of two pixels and 𝐺 is the number of grey levels in 𝐼𝐺𝐿𝐢𝑀. Then each entry 𝑝𝑖,𝑗 of the 𝐺 Γ— 𝐺 sized GLCM is the number of times that the grey level pair (𝑔𝑖, 𝑔𝑗) occurs at a displacement of exactly 𝑑 apart in 𝐼𝐺𝐿𝐢𝑀. This method therefore uses pixel pairs as the pixel neighbourhood.

Figure 3-1 (a) shows an example displacement, 𝑑 = (𝑑π‘₯, 𝑑𝑦) = (3,2). Also indicated on this figure are the standard directions of the π‘₯-axis and 𝑦-axis in an image, which differs from the Cartesian convention.

𝐼

𝑆𝑐

=

𝐼

𝐺

βˆ’ 𝑔

min

𝑔

max

βˆ’ 𝑔

min

+ 1

(3-1)

Chapter 3 – Texture analysis 32

As an example of GLCM calculation, figure 3-2 shows a 5 x 5 image (with 𝐺 = 4 grey levels) on the left, with its GLCM on the right. The displacement chosen in this example is (0, 1), which means that horizontally adjacent pixel pairs are considered. Entry (1, 1) of the GLCM has a value of 1 because there is only one instance of horizontally adjacent pixels with grey levels 1 and 1. Entry (2, 1) has a value of 2 because there are two instances of horizontally adjacent pixels with grey levels 2 and 1. In a similar fashion, the entire GLCM is calculated.

Figure 3-2: [Left] A 5 x 5 image with four grey levels, and [right] its GLCM for 𝒅 = (𝟎, 𝟏)

It should be noted that in this example the ordering of grey levels in the pixel pairs was taken into account, yielding a non-symmetric matrix. However, many implementations do not take order into account, for instance there would be no differentiation between grey level pair (1, 2) and (2, 1). This would result in a symmetric co-occurrence matrix.

Figure 3-1: (a) Example of displacement 𝒅 = (πŸ‘, 𝟐). (b) The four directions for which GLCMs are commonly calculated.

Chapter 3 – Texture analysis 33

As a final step, the GLCM is normalised so that the sum of its elements is equal to 1, which means that the GLCM becomes a probability matrix of joint pixel occurrences. The normalised GLCM 𝑃̂𝐼 is given by:

Since the GLCM obtained is a function of 𝐺 and 𝑑, it is possible to calculate more than one GLCM for each image. The most popular choice (originally proposed by Haralick et al., 1973 and subsequently used by most studies) seems to be to fix 𝐺 and calculate GLCMs for four different displacements: (0, 𝐷), (βˆ’π·, 𝐷), (βˆ’π·, 0) and (βˆ’π·, βˆ’π·), corresponding to directions 0Β°, 45Β°, 90Β° and 135Β°. 𝐷 is a hyperparameter affecting the size of the displacement 𝑑, often fixed at 𝐷 = 1. The four directions in which the GLCMs are usually calculated are depicted in figure 3-1 (b).

3.2.2 Feature extraction from GLCMs

Once a set of GLCMs has been calculated, features may be extracted from them. A very well-known feature set has been proposed by Haralick and others (1973), which consists of 14 features that express the contrast, orderliness and other statistical properties of the image. However, many of these features are highly correlated among themselves (Haralick et al., 1973), which is why Haralick (1979) later reduced this set to only five features: energy (angular second moment), entropy, contrast, correlation and homogeneity (inverse difference moment). Maillard (2003) reviewed the work of many authors that have used GLCM features and concluded that these five features were overall the most popular, although all five were not always used together.

Energy and entropy are both measures of the uniformity of the GLCM. In a thorough study of feature correlations, it was found that these two features are highly correlated and that there is no need to include both features (Clausi, 2002). Excluding entropy (since this feature seems to be less popular than energy), the four features left are energy, contrast, correlation and homogeneity. These features are summarised in table 3-1. In the formulas for the features:

ο‚· 𝑝̂𝑖,𝑗 represents the entry in row 𝑖 and column 𝑗 of the normalised GLCM 𝑃̂𝐼, ο‚· πœ‡π‘– and πœ‡π‘— are the means of the row 𝑖 and column 𝑗 of the GLCM, respectively, and ο‚· πœŽπ‘– and πœŽπ‘— are the standard deviations of row 𝑖 and column 𝑗 of the GLCM, respectively. After extracting these four features, each image is represented by 4 Γ— 𝑁𝑑 features, where 𝑁𝑑 is the number of displacements considered. The standard procedure for producing a feature vector from these features is as follows. For each feature and GLCM calculated at a specified distance, the average and standard deviation across all orientations are calculated (Haralick, 1979). This ensures a degree of rotational invariance while still accounting for anisotropic effects (effects that differ according to the direction of the measurement). The length of the feature vector then becomes 4 Γ— 2 = 8.

𝑃̂

𝐼

=

𝑃

𝐼

Chapter 3 – Texture analysis 34

Table 3-1: Features extracted from a GLCM

3.2.3 Applications in the process industries

In the original work on GLCMs by Haralick (1973), different types of sandstone were classified, among others. This is related to the field of surface inspection in the process industries, for example the quality grading of steel surfaces using GLCM and various other textural features (Bharati et al., 2004a).

There are numerous applications of GLCMs in the fields of mining and minerals processing. Bartolacci and others (2006) used GLCM and wavelet features extracted from flotation froth image data to build PCA models for the monitoring of a zinc froth flotation system. No conclusion was drawn as to which feature set was more appropriate. In a platinum group metal flotation system, GLCM features were compared to spectral and physical froth features for the estimation of the platinum grade in the froth by using a neural network classifier (Marais & Aldrich, 2011). GLCMs have been extended to include colour information, and a qualitative relationship between colour GLCM features and the grades of bauxite flotation froths was established (Gui et al., 2013). Kernel- based discriminant analysis with GLCM features as input was used by Aldrich and others (2010) to classify the fraction of particulate fines in coal on conveyor belts. Later, wavelet decomposition followed by GLCM feature extraction was used for the same coal fines fraction classification problem and also extended to fines estimation in iron ore (Amankwah & Aldrich, 2011).

Description Formula

1. Energy (also known as angular second moment or uniformity) is simply the sum of the squared elements in the GLCM. It is a measure of uniformity or pixel-pair repetitions. When all the pixel values in an image are similar, the energy of the GLCM is high (for a constant image, energy is equal to 1, its maximum).

𝐸𝑁𝐸 = βˆ‘ 𝑝̂𝑖,𝑗2 𝑖,𝑗

2. Contrast (also known as variance or inertia) measures the average grey level difference between pixel neighbours.

A large value of GLCM contrast indicates a texture with large local variations. Contrast and homogeneity are somewhat correlated, but the use of both features remains popular.

𝐢𝑂𝑁 = βˆ‘|𝑖 βˆ’ 𝑗|2 𝑝̂ 𝑖,𝑗 𝑖,𝑗

3. Correlation is a measure of how related a pixel is to its

neighbour over the whole image. The correlation measure here is slightly different to the original Haralick correlation (Haralick et al., 1973), since it has been normalised.

𝐢𝑂𝑅 = βˆ‘(𝑖 βˆ’ πœ‡π‘–)(𝑗 βˆ’ πœ‡π‘—)𝑝̂𝑖,𝑗 πœŽπ‘–πœŽπ‘—

𝑖,𝑗

4. Homogeneity (also called inverse difference moment) measures the closeness of the distribution of elements in the GLCM to the GLCM diagonal. High values of homogeneity mean that the differences between grey levels of pixel pairs are small.

𝐻𝑂𝑀 = βˆ‘ 𝑝̂𝑖,𝑗 1 + |𝑖 βˆ’ 𝑗| 𝑖,𝑗

Chapter 3 – Texture analysis 35

In a very early application to defect detection for an automated lumber processing system, GLCM features combined with simple first-order statistics were used (Conners et al., 1983). MÀenpÀÀ and others (2003a) compared various texture analysis algorithms and found that GLCM features yielded the best results when applied to the detection and classification of defect types on wooden surfaces. In the food processing industry, GLCM and wavelet features were extracted from ultrasound images of live cattle. These features were used as combined input to a regression model predicting the intramuscular fat content, which is a strong indicator of the meat grade (Kim et al., 1998). In this case the wavelet features outperformed the GLCM features. In another meat grading application, very good results were achieved by Shiranita and others (1998) using GLCMs directly as features for classification (instead of extracting Haralick texture features). Several feature sets, including GLCM features, were tested by using regression models for the prediction of important variables in the syneresis of cheese curd (Fagan et al., 2008). In this case GLCMs were among the worst of the methods that were tested.

GLCM and wavelet features are often combined or compared, and thus more studies that make use of GLCM features are discussed in the section on wavelet applications in the process industries (section 3.3.5, p. 43).

From literature reviewed here it can be concluded that GLCMs are a very popular method for texture analysis within the process industries, considering how many diverse applications of this method has been found. In most of the studies where the extraction of GLCM features was the only approach considered, the authors concluded that GLCM features were well suited to their particular application (Shiranita et al., 1998; Aldrich et al., 2010; Gui et al., 2013). However, when other features were also considered, these features have often outperformed the GLCM features (Kim et al., 1998; Fagan et al., 2008; Marais & Aldrich, 2011). This suggests that, for many applications, GLCM features may not be the optimal texture analysis method.