## 2 Material and Method
### Gray Level Co-Occurrence Matrix  
Selecting GLCM features is important to improve sample differentiation [51]. GLCM is a texture analysis tool used in digital image processing. It identifies the spatial relationship between the pixel intensities of a grayscale image to extract information about its pattern and texture. GLCM measures the frequency at which pairs of pixels with a given intensity appear together at a certain distance and direction. By calculating this matrix and analyzing meat texture images, many statistics can be generated, such as energy, contrast, correlation, homogeneity, and entropy. For GLCM elements \(C(i,j)\) with horizontal, vertical, and diagonal directions at a distance of 1, the general formula will depend on the definition of the GLCM and the specific directions used. Assuming that we are working with grayscale images at intensity levels between 0 and \(L-1\), where L is the number of intensity levels, the general formula for calculating GLCM elements \(C(i,j)\) with horizontal, vertical, and diagonal directions at a distance of 1 is  
\[C(i,\,j)=\sum_{m=1}^{M-1}\sum_{n=1}^{N}\delta(I(m,n)=i\,\,\text{and}\,\,I\,(m+ 1,n=j) \tag{4}\]  
\[C(i,\,j)=\sum_{m=1}^{M-1}\sum_{n=1}^{N-1}\delta(I(m,n)=i\,\,\text{and}\,\,I\,( m+1,n+1=j) \tag{5}\]  
where  
* \(I(m,n)\) is the intensity of the image pixel at coordinates \((m,\,n)\). * \(\delta(. )\) returns one if the parenthetical statement is accurate, and 0 if otherwise. Figure 3: Haar wavelet approximation on images of fresh meat types and their histograms. \(M\) is the number of image rows. * \(N\) is the number of image columns. Basic GLCM calculations for horizontal, vertical, and diagonal directions at a distance of 1 from the grayscale image are as follows: \[ \begin{bmatrix}1,&1,&2,&3\end{bmatrix}\begin{bmatrix}2,&2,&3,&4\end{bmatrix} \begin{bmatrix}1,&1,&2,&2\end{bmatrix}\begin{bmatrix}3,&4,&4,&4\end{bmatrix} \] The steps of calculation are as follows: 1. Select horizontal, vertical, and diagonal directions at a distance of 1. 2. Count the pairs of pixels that occur together: * Scan the image to identify pairs of pixels with matching intensities. * Pairs of pixels that occur together include horizontal (1, 1), (1, 2), (2, 3), (3, 4), (2, 2), (3, 3), (4, 4), (1, 1), (1, 2), (2, 3), (3, 4), (2, 2), (3, 3), (4, 4), vertical (1, 1), (2, 2), (1, 1), (3, 4), (2, 2), (1, 1), (4, 4), (2, 2), (2, 2), (3, 3), (4, 4), (2, 2), (2, 2), (4, 4) and diagonals (1, 1), (1, 1), (2, 2), (3, 3), (2, 2), (3, 3), (4, 4), (1, 1), (1, 1), (2, 2), (3, 3), (2, 2), (3, 3), (4, 4). 3. Create a GLCM * Count the occurrences of pixel pairs and insert them into the GLCM. \( \begin{bmatrix}2,&3,&2,&1\\ 1,&2,&2,&3\\ 0,&1,&2,&2\\ 1,&0,&0,&3\end{bmatrix} \) \( \begin{bmatrix}3,&1,&3,&0\\ 0,&4,&0,&2\\ 2,&1,&2,&1\\ 0,&2,&0,&2\end{bmatrix} \) \( \begin{bmatrix}3,&0,&0,&0\\ 0,&4,&0,&0\\ 0,&0,&3,&0\\ 0,&0,&0,&3\end{bmatrix} \) 4. GLCM Normalization: Normalize the matrix to obtain a probability distribution. \( \begin{bmatrix}0.1,&0.15,&0.1,&0.05\\ 0.05,&0.1,&0.1,&0.15\\ 0,&0.05,&0,&0.15\\ 0,&0.05,&0,&0.15\\ 0,&0,&0.15\\ (Horizontal)&\end{bmatrix} \) \( \begin{bmatrix}0.1875,&0.625,&0.1875,&0\\ 0,&0.25,&0,&0.125\\ 0.125,&0.0625,&0.125,&0.0625\\ (Vertical)&\end{bmatrix} \) \( \begin{bmatrix}0.375,&0,&0,&0\\ 0.05,&0,&0\\ 0,&0.375,&0\\ (Diagonal)\end{bmatrix} \) Based on the probability distribution matrix presented in (Figure 4), it is important to prepare fresh, frozen, and rotten meat images in the grayscale format before calculating the GLCM. Horizontal GLCM involves calculating the occurrence of pairs of gray values horizontally, while vertical and diagonal GLCM involves calculating gray values vertically and diagonally. Thereafter, researchers can create a GLCM histogram for each direction, representing the frequency distribution of pairs of gray values. By performing these steps, fresh, frozen, and rotten meat images can be analyzed using GLCM histograms.