Meat Texture Image Classification Using the Haar Wavelet Approach and a Gray-Level Co-Occurrence Matrix

: This research aims to examine the use of image processing and texture analysis to find a more reliable and efficient solution for identifying and classifying types of meat, based on their texture. The method used involves the use of feature extraction, Haar wavelet, and gray-level co-occurrence matrix (GLCM) (with angles of 0 ◦ , 45 ◦ , 90 ◦ , and 135 ◦ ), supported by contrast, correlation, energy, homogeneity


Introduction
Meat is an excellent source of animal protein.As Indonesia's population increases, there is a higher demand for meat.Unfortunately, many traders deliberately mix pork and beef to gain higher income [1].There has been a decline in beef sales in Indonesia ahead of Eid al-Fitr, due to rising prices.In anticipation, some traders combine pork and beef, as pork is cheaper, with a color and texture similar to beef.It is difficult for most people to visually differentiate between beef and pork [2].The National Standardization Agency of Indonesia (2018) states that the color, texture, tenderness, and marbling of fat and meat are the main factors for assessing the quality of beef [3].Nutrition is crucial in Indonesia for increasing human resources, and beef supplies animal protein to consumers.Healthy meat is bright red, shiny but not pale, elastic but not sticky, and possesses a distinctive aroma [4].Meat quality is determined by various factors, such as size, texture, color, and aroma.Currently, meat quality is determined by its color and shape.However, this method of identifying meat quality has shortcomings because of the subjectivity and consequent unreliability of human judgment [5].
Since food authenticity is a trending topic, food fraud is a global problem that has attracted attention in recent decades.Beef, buffalo, chicken, duck, goat, sheep, and pork are examples of popular types of meat with high economic value, as they are sources of nutrition and play important roles in culture, religion, and the economy.Both raw and processed meat are often known to be contaminated [6].People have many concerns about meat, such as religious, legal, economic, and medical issues.To protect customers from fraud and bad marketing practices, several analytical approaches have been proposed to identify meat species in separate or combined samples [7].Species substitution in meat products is a common issue documented globally.Using low-value meat resources to produce high-value meat products is considered food fraud and is usually aimed at financial gain.This phenomenon has raised financial, health, and religious issues [8].
Meat adulteration, especially for commercial gain, has become widespread and has led to significant threats to public health, besides giving rise to moral and religious offenses.A technology for fast, precise, and reliable detection is essential to efficiently track meat adulteration.Considering the importance and rapid development of meat adulteration detection technology, recent developments in this field need to be thoroughly analyzed and recommendations should be made for future progress [9].As beef, buffalo meat, and pork are sources of contamination, deep analyses can maintain social, religious, economic, and health standards [10].Selecting texture images of adequate quality is one of the main problems in texture classification [11].Whether the textural characteristics of raw meat are reliable indicators of beef tenderness is to be ascertained [12].Techniques for differentiating the value of turkey and pork ham use wavelet texture and color characteristics [13].Researchers used practical procedures to evaluate various texture analysis techniques and regression methods to predict various physico-chemical and sensory attributes of different cuts of Iberian pork.Statistical methods like Haralick descriptors, local binary patterns, fractal features, and frequency descriptors like Gabor or wavelet features are examples of texture descriptors [14].Experiments to evaluate pork quality show that the two-dimensional Gabor wavelet transform is more effective for extracting the textural properties of pork [15].
This study suggests the use of Dynamic Weighted Temporal Long Short-Term Memory (DWTLSTM) with a discrete wavelet transform to reduce noise contamination in e-nose signals during beef quality monitoring.The proposed approach performs well, with an average accuracy of 94.83% and an average F-measure of 85.05% in classifying beef quality [16].This technique is based on clustering, and the Haar filter is used to carefully extract features in the wavelet transform domain.Decomposition is performed at the first, second, and third levels in the wavelet domain, and the resulting coefficients at each level are examined to estimate the freshness of fish samples [17].Sheep muscle classification is achieved using a wavelet analysis of near-infrared (NIR) hyperspectral imaging data.Wavelet transformation is applied to determine the optimal wavelet features for classifying sheep muscles [18].
To obtain 64-dimensional characteristics with excellent quality, eight image texture features are extracted in each of the final eight wavelengths, using a two-dimensional wavelet transformation [15].Half-pig carcasses can be accurately depicted using spectral wavelet graphics called spectral weight.Further, spectral weight is applied as a prediction model to weigh different pieces of pork and determine the tissue composition [19].The use of the transformation of DWTLSTM is recommended, together with interference for preventing e-nose signal contamination to evaluate beef quality [20].To estimate TVB-N values in cooked beef during storage, this study examines the integration of spectral and image data from visible and near-infrared hyperspectral imaging.Nine ideal wavelengths are selected, using the Sequential Projection Algorithm (SPA) and Variables Without Elimination (VWE).The discrete wavelet transform (DCT) extracts 36 single values as texture features [21].
This study uses image preprocessing, dataset training, and classification to assess the quality of tuna meat classes according to color space.The three main steps in image preprocessing are cropping, converting RGB images to HSV, and extracting features using wavelets.The findings show that Symlet waves produce higher correlation coefficients among feature extraction rates than Haar waves.Wavelet Symlet and k-NN classify 65 test image datasets with a higher accuracy of 81.8% than wavelet Haar and k-NN, which is 80.3% [22].The amount of intramuscular fat (IMFAT) in beef ribeye muscle has been predicted using a multiresolution texture analysis technique, using wavelet transformation.Several features are calculated based on 2-D wavelet decomposition ultrasonic images using Haar wavelets as the basis function to create a fast wavelet transform [23].A new technique for local thresholding using weighted detail coefficients in wavelet synthesis is adopted to generate multi-scale thresholding functions for image segmentation.The fast wavelet technique can implement such a local wavelet-based thresholding method, which is adapted to the local environment and size.Researchers used X-ray imaging for this method to detect physical contamination in chicken inspections [24].
These features are extracted carefully, using a Haar filter in the form of a domain wavelet transform.Decomposition at the first, second, and third levels in the wavelet domain was performed, and the resulting coefficients at each level were examined to estimate the freshness of the fish samples [25].The amount and percentage of IMFAT are the main elements determining beef quality.Texture analysis is used on B-mode ultrasound images of live bovine cow muscle ribeye to predict its IMFAT.GLCM is applied for multiresolution analysis of textures and second-order statistics using wavelet transform (WT) [26].This research aims to distinguish between beef and pork using digital photos.For texture analysis, color features use a GLCM to calculate the first-order statistical average of color values [27].There is a technique to extract the texture of beef, which is a vital component in beef classification.Texture feature analysis extraction is carried out using the frequency domain Discrete Wavelet Transform (DWT) and GLCM statistics [28].
This research aims to examine the freshness level of chicken meat by analyzing its color and texture.GLCM is the texture property used [29].This research combines and applies contrast, energy, and homogeneity properties to CNN learning to investigate the capacity of GLCM to identify patterns with significant variance, robustness to geometric distortion, and direct transformation [30].This research aims to accurately categorize and differentiate groups of cows in large numbers.GLCM is used to extract image features [31].In this research, we used the Support Vector Machines classifier to create a system to identify the quality of beef based on its color and texture.Statistical techniques and the GLCM method are used for feature extraction [32].This research aims to determine the grade of beef for human consumption.The k-NN algorithm is used to categorize meat photos, using a co-occurrence matrix.Based on color and texture, this research can be used to differentiate between various types of meat [33].To extract texture properties (contrast, correlation, energy, and homogeneity), the GLCM is used to image the first-principle components of the hyperspectral image, which has a variance of 98.13% [34].
This research aims to evaluate the computational precision of tilapia fish using the k-NN algorithm and digital image processing techniques.Customers can use a smartphone as a visualization to ascertain whether the fish is suitable for consumption [35].This research aims to find out the freshness of fish using NB and k-NN classification techniques based on fisheye images.These findings indicate that the k-NN approach is more effective than NB, with mean values of 0.97, 0.97, 0.97, 0.97, and 0.97 for accuracy, precision, recall, specificity, and AUC, respectively [36].The goat meat image classification model is created using several practical modeling algorithms, such as k-NN, to ensure the authenticity of fresh and cooked food.Kebab is made from goat meat [37].
The use of pre-processed meat marble image segments with contrast enhancement and illumination normalization is recommended.Fat pixels are described intramuscularly, and attribute scores are determined by learning definitions of the meat standards required.The learning method used is an instance-based system that provides a score on segmentation results using the k-NN algorithm [38].This research not only identifies the type of meat but also, for the first time, differentiates body parts and types of meat.The results of the proposed approach are compared with other machine learning algorithms used in previous investigations, including k-NN and deep learning [39].Pork sausages are classified using linear and nonlinear techniques, including k-NN, to differentiate them [40].This paper results in an innovative and reliable biometrics-based method for identifying a cow's tail.Two additional classifiers, Fuzzy-k-nearest neighbor (Fk-NN) and k-NN, are used to validate the findings produced by the classifiers [41].Collecting and evaluating olfactory data, electronic noses-a non-destructive detection method-can determine the freshness of meat.Unlike traditional machine learning techniques such as k-NN, pre-drilled AlexNet, GoogLeNet, and ResNet models are re-drilled in the last three layers [42].
This study also tests how well the MicroNIR device (VIAVI, Santa Rosa, CA, USA) uses distance cluster analysis on k-NN and multivariate data analysis to coordinate the dry sausage fermentation process [43].With 97.4% accuracy, the k-NN model learns and categorizes ApSnet segmented image features [44].The first derivative spectrum is used in k-NN classification [45].The new cow recognition system uses hybrid texture and muzzle pattern features to identify and categorize cow breeds.k-NN and other classification models are used in cow classification [46].The k-NN technique is used to construct the model [47].
In this (Figure 1) Researchers consider the classification stages of meat texture images quite comprehensive.The following is an explanation of each stage: 1.
Data Collection is the first stage, representing collecting texture images of beef, buffalo meat, goat meat, horse meat, and pork, using a digital camera.

2.
Sampling is the stage where the researcher selects samples from the images collected to be used as training data.

3.
Class Division is the stage where the images are grouped into classes (fresh, frozen, and rotten) based on the texture characteristics of the meat.4.
Preprocessing is the stage before feature extraction, where the images need to be processed to remove noise or make other adjustments to produce better data.

5.
Feature Extraction is the stage that involves extracting Haar wavelet and GLCM features as input for the classification process.6.
Dataset is the stage where the processed data and the extracted features are grouped (fresh, frozen, and rotten) into a dataset ready for the classification process.7.
Classification is the stage where the classification model, such as k-NN is used to classify the images into predetermined classes.8.
Calculate Similarity Distance is a stage, which is carried out in some cases after classification, and may be necessary to determine how similar the classified image is to images in the same class.

Data Collection
This research used five types of meat: beef, buffalo meat, goat meat, horse meat, and pork.The meats were cut into 15 × 15 cm pieces by slicing lengthwise or in the direction opposite to the grain.There are three categories of each type of meat: fresh, frozen, and

Data Collection
This research used five types of meat: beef, buffalo meat, goat meat, horse meat, and pork.The meats were cut into 15 × 15 cm pieces by slicing lengthwise or in the direction opposite to the grain.There are three categories of each type of meat: fresh, frozen, and rotten.The researchers collected 50 pieces of each type of meat sample (fresh, frozen, and rotten meat), amounting to 150 pieces of samples.These 150 pieces were multiplied by five types of meat, and there were 750 pieces of different meat samples in total.Texture images of various types of meat were captured using a digital camera.Acquisition of perpendicular images was carried out by adjusting the distance at which the image was taken.The image-taking distances were 10, 20, 30, and 40 cm.Room lighting was provided by Emitting Diode (LED) lamps with wattage] of 3, 5, 7, 9, 11, and 13, respectively.

Preprocessing
The texture image characteristics of meat types were obtained using an image feature extraction approach.There were several preprocessing steps in image processing before feature extraction.GLCM was a feature used to extract meat texture images.The purpose of image cropping was to remove labels from images with a texture similar to flesh.
Extracting image properties as attributes for the classification process was the final step in the image processing process.The Wavelet Haar feature and GLCM are two examples of these features.The histogram feature consisted of the following five features: entropy, energy, contrast, homogeneity, and correlation.The five GLCM qualities used in this research were energy, contrast, correlation, homogeneity, and entropy.As many as 175 images showed various types of meat textures.Separate images of each piece of meat were taken.Each type of meat was tried fifty times, with 600 photos in the training set and 150 in the test set.The types of meat used were beef, buffalo, goat, horse, and pork.Images were taken at a resolution of 500 × 500 pixels.
The final stage of image processing was extracting image characteristics as attributes of the classification process.GLCM and Wavelet Haar are examples of this feature.The five features included in the histogram were energy, contrast, homogeneity, correlation, and entropy, which were the five GLCM properties used in this research.

k-Nearest Neighbor (k-NN)
The results showed that k-NN had the highest accuracy among algorithms for categorizing and comparing k-NN patterns, based on their accuracy [48].The k-NN method was used for data processing [49].The distance between two points in feature space can be calculated using various distance metrics, such as Euclidean distance, Manhattan distance, Minkowski distance, or other distance metrics, of which the first is the most commonly used.The distance between two points A and B in dimension n is where A i − B i is the i component of the two vectors to be compared and n is the number of dimensions (features) of each vector.
After finding the k-nearest neighbor of the point to be classified, the majority class of the k neighbor is taken as the class prediction.If k = 1, then the predicted class will be the class of the nearest neighbor.If k > 1, then class predictions are usually taken based on the majority of the class of the k-nearest neighbor.
The distance between each data point in the training dataset and the data point to be predicted was measured as part of the k-NN computation.The following are the main steps in k-NN calculations: 1.
The distance metric used to calculate the proximity between data points must be selected using the Euclidean distance.

2.
Using the Euclidean distance metric, the distance to each data point in the training dataset and each testing data point is to be determined.

3.
After calculating the distance, the next step is to find the k-NN and look at the k-NN of the test data points based on the most negligible distance value.Thereafter, the calculated distances are to be sorted and the lowest K value selected.4.
The next step is to predict the class (classification) as a class prediction for the test data points; if the task involves classification, it should be ensured that the majority class is from the k-NN.the majority of the class of the -nearest neighbor.
The distance between each data point in the training dataset and the data point to be predicted was measured as part of the k-NN computation.The following are the main steps in k-NN calculations: 1.The distance metric used to calculate the proximity between data points must be selected using the Euclidean distance.2. Using the Euclidean distance metric, the distance to each data point in the training dataset and each testing data point is to be determined.3.After calculating the distance, the next step is to find the k-NN and look at the k-NN of the test data points based on the most negligible distance value.Thereafter, the calculated distances are to be sorted and the lowest K value selected.4. The next step is to predict the class (classification) as a class prediction for the test data points; if the task involves classification, it should be ensured that the majority class is from the k-NN.The Haar wavelet is one of the easiest wavelets to understand and use due to its discrete and straightforward character.It is a local segment function often used in data compression, image processing, and image analysis because of its ability to quickly identify variations in the texture images of various types of meat.The image is separated into smaller intervals for the Haar wavelet transform, and each interval is then subjected to the Haar wavelet.This procedure enables the imaging of different signal components at various resolutions.The main advantage of Haar waves is their ability to convey high-frequency information effectively; so, they are often used in applications requiring rapid identification of edges or signal changes.Approximation coefficients and detail-based mathematical formulas can be used to describe the Haar wavelet transform.The calculation for discrete signal x [n] with a length of N, estimation coefficient A [k], and detail coefficient D [k] at level k is as follows: A. Approximation Coefficient: B. Detail Coefficient: This process can be repeated at each transformation level by replacing x [n] with A [k] for the next level.The following are the basic steps to perform the Haar wavelet transform: 1.
The intervals for texture photos of different types of meat are divided into smaller intervals.Convolution operations on adjacent intervals or the average of two consecutive values can achieve this. 2.
After separating the intervals, the approximation coefficient (A) and detail coefficient (D) are calculated.The approximation coefficient represents the finer details or lowfrequency components in the texture image of a type of meat.The detail coefficient represents high-frequency elements or information that are coarser or change more quickly.

3.
Coefficient values are normalized to suit the needs of a particular use case.Adjusting scales or assigning weights can be part of this process.
Table 1 below shows the estimated pseudocode (cA) and detail coefficients (cH, cV, and CD) calculated in the Haar wavelet transform: Table 1.Pseudocode approximation (cA) and detail coefficients (cH, cV, and cD) are calculated in the Haar wavelet transform.
In the pseudocode above, the researchers started by taking a grayscale image from the input image (if the image is in color).Thereafter, they divided the image into 2 × 2 sub-blocks.Following that, for each sub-block, they calculated the average pixel as the approximation component as well as the horizontal, vertical, and diagonal details as the detail coefficients component.After calculating all the components, the researchers combined these values to form cA, cH, cV, and cD, which, respectively, represented the approximation coefficient and detail coefficients components of the Haar wavelet transform.
In this code, the Haar coefficient is a function to calculate the approximation coefficients and details of the Haar wavelet transform for the input image.This function uses pywt.dwt2from PyWavelets to perform the Haar wavelet transform.The transformation results were then separated into approximation coefficients (cA) and detail coefficients (cH, cV, and cD), which represent coarse and detailed information from the image, respectively, for the horizontal, vertical, and diagonal dimensions.
Figure 3 shows the Haar wavelet approximation histogram is a visual representation of the energy distribution of an image or data after the Haar wavelet transformation process.Haar wavelet is a type of wavelet transform used in image analysis and image processing.The researchers can read the Haar wavelet approximation histogram through the following steps: 1.
Wavelet Haar involves the decomposition of the original image into basic parts called approximation (coarse features) and detail (fine features).

2.
The original image is divided into two equal parts, after which the difference between the two parts is calculated to obtain the detail, while the average of the two parts results in an approximation.

3.
A histogram is a visual representation of the distribution of values in the data.The approximation histogram of Haar wavelets shows the frequency of appearance of approximation values after the Haar wavelet transform.

4.
Peaks in a histogram appear due to a distinctive structure or pattern in the data.In the context of Haar wavelets, these peaks may appear due to sudden changes in approximation values, which may be indicative of significant changes in the original image.

5.
The peaks in a Haar wavelet approximation histogram can provide information about important features in the data, such as sudden changes, the presence or absence of certain patterns, and the level of roughness or smoothness in the image.By understanding the Haar wavelet approximation histogram and analyzing its peaks, researchers can gain valuable insights into the structure and characteristics of the image or data they are reviewing.

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  − 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 where Basic GLCM calculations for horizontal, vertical, and diagonal directions at a distance of 1 from the grayscale image are as follows: 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.By understanding the Haar wavelet approximation histogram and analyzing its peaks, researchers can gain valuable insights into the structure and characteristics of the image or data they are reviewing.

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 where is the intensity of the image pixel at coordinates (m, n).• δ(.) returns one if the parenthetical statement is accurate, and 0 if otherwise.
• 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: 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.

Create a GLCM
• Count the occurrences of pixel pairs and insert them into the GLCM.
An explanation of how the GLCM is used to describe the relationship between pixels in meat texture images can be found in the researcher's analysis of the GLCM computational stages.For example, I is a grayscale image with a size of M × N. The specified distance and direction are d and θ, respectively.GLCM G with a size of K × K (where K is the number of gray levels in the image) is calculated by matching each pair of pixels with a specified distance and direction.The general equation for GLCM elements is where is the GLCM element for the intensity pairs i and j at a distance of d and a direction of θ.

•
δ is the Kronecker delta function, with a value of 1 if the values in it are the same, and 0 if they are different.

•
I mn is the pixel intensity at the coordinate (m, n) in the image.• δ x and δ y is the shift in direction that determines the distance.
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.An explanation of how the GLCM is used to describe the relationship between pixels in meat texture images can be found in the researcher's analysis of the GLCM computational stages.For example,  is a grayscale image with a size of   .The specified distance and direction are  and , respectively.GLCM  with a size of   (where  is the number of gray levels in the image) is calculated by matching each pair of pixels with a specified distance and direction.The general equation for GLCM elements is where This process is repeated for each pair of pixels at the specified distance and direction, resulting in a complete GLCM.The GLCM can then be used to extract various texture features, which are useful for further analysis.The different stages of GLCM computation are as follows: 1. Direction and Distance Selection Determining direction and distance has important meaning since it affects the measurement of the relationship between pixels.This affects the texture information extracted from the image.This process is repeated for each pair of pixels at the specified distance and direction, resulting in a complete GLCM.The GLCM can then be used to extract various texture features, which are useful for further analysis.The different stages of GLCM computation are as follows: 1.

Direction and Distance Selection
Determining direction and distance has important meaning since it affects the measurement of the relationship between pixels.This affects the texture information extracted from the image.

GLCM Calculation
Counting the occurrence of a pair of pixel intensities at a given distance and direction is necessary to calculate the GLCM.The final product is a matrix that displays the frequency of certain pairs of pixels that appear together.

Matrix Normalization
Matrix normalization is applied to determine the probability distribution of the occurrence of pixel pairs.This probability distribution can calculate the probability of a pair of pixels occurring in the entire image size.

4.
Feature Extraction from Matrix Normalization After normalization, various texture properties, including energy, contrast, correlation, homogeneity, and entropy, can be extracted from the matrix.Each element offers different details of the texture characteristics of the image.

Texture Statistics and Characteristics
Energy calculation can be used to ascertain the extent to which pixel intensity approaches a certain value.The difference in intensity of neighboring pixels is called contrast.The degree of correlation between pixel brightness in a given distance and direction is reflected in the correlation.The degree of uniformity of pixel intensity distribution throughout the image is called homogeneity.The degree of uncertainty in the pixel intensity distribution is measured by entropy.
Following this procedure will produce a set of attributes to identify or describe a meat texture image more accurately.This method has several benefits in pattern recognition and image analysis, especially in image processing for the identification and classification of meat types.
Based on the classification of meat type texture images using k-NN, Haar wavelet, and GLCM approaches presented in (Figure 5), The k-NN, Haar Wavelet, and GLCM methodologies can be used to identify the different stages and procedures in classifying texture images of various types of meat.Color images of different types of beef are converted to grayscale as an initial step in the processing procedure.Image decomposition using Haar wavelets with smoothing and reduction on lines and columns is the second feature extraction stage using GLCM and Haar wavelets.We create four images: HH (detail components), LH, HL, and LL (estimated).The mean, standard deviation, and trend of each detailed element are calculated statistically on the deconstructed image.For each deconstructed image, GLCM normalization produces a normalized GLCM.GLCM analysis, or GLCM, to extract texture features or properties, including energy, contrast, correlation, homogeneity, and entropy, is the third feature extraction method of GLCM.The fourth classification procedure is sorting texture images of various types of meat into fresh, frozen, and rotten categories.Class or label predictions are made using the Euclidean matrix and confusion matrix.The final method involves assessing performance using evaluation metrics, i.e., determining how effectively the model can predict the correct class on the test data using measures such as accuracy.Accuracy is how close a prediction is to the actual or expected value.The six classification results are based on image classification.In other words, fresh, frozen, and rotten are the three categories used as a basis for dividing findings based on the texture image categories of different meat varieties.Using this method, the model can understand and identify patterns or characteristics that differentiate the texture of various types of meat in the image.Metrics, like accuracy, are used in performance evaluation to show how effectively a model predicts the right class on test data.Using the results of classification, meat varieties can then be categorized according to their condition.

Number of samples and classification
As many as 175 images showed various types of meat textures.Each type of meat had three categories: fresh, frozen, and rotten.There were 50 texture images for each class of meat and 150 images for each type of meat.

Dataset division
A total of 600 images in the training set and 150 images in the testing set formed the two main parts of the dataset.It is important to divide this dataset so that the model can be trained and its performance tested objectively.

Types of meat tested
Five different types of meat were tested: pork, goat meat, horse meat, buffalo meat, and beef.Each type of meat has three texture levels: fresh, frozen, and rotten.

Use of digital camera
A digital camera with the same light intensity and distance took images that formed a meat texture dataset.This is important to ensure constant image capture.

Image size
The image size is 500 × 500 pixels.The site offers sufficient resolution to allow detailed texture investigation.

Example of image acquisition results
Examples of texture image capture results for each class of meat are shown in Table 2.It is important to understand the range of images tested and used in the categorization process.

Distribution of GLCM Values
The distribution of GLCM values based on the image histogram of meat types is shown in (Table 2).It enables an understanding of texture characteristics that can be captured and applied to the classification process.
The implementation and testing of the meat type classification system owes its foundation to the experimental setup, which includes a well-divided dataset, consistent use of cameras, and an in-depth examination of the distribution of GLCM values.All these procedures are essential to guarantee the classification model's dependability and strong generalization on never-before-seen data (test data).
Following this procedure will produce a set of attributes to identify or describe a meat texture image more accurately.This method has several benefits in pattern recognition and image analysis, especially in image processing for the identification and classification of meat types.
Based on the classification of meat type texture images using k-NN, Haar wavelet, and GLCM approaches presented in (Figure 5), The k-NN, Haar Wavelet, and GLCM methodologies can be used to identify the different stages and procedures in classifying texture images of various types of meat.Color images of different types of beef are converted to grayscale as an initial step in the processing procedure.Image decomposition using Haar wavelets with smoothing and reduction on lines and columns is the second feature extraction stage using GLCM and Haar wavelets.We create four images: HH (detail components), LH, HL, and LL (estimated).The mean, standard deviation, and trend of each detailed element are calculated statistically on the deconstructed image.For each deconstructed image, GLCM normalization produces a normalized GLCM.GLCM analysis, or GLCM, to extract texture features or properties, including energy, contrast, correlation, homogeneity, and entropy, is the third feature extraction method of GLCM.The fourth classification procedure is sorting texture images of various types of meat into fresh, frozen, and rotten categories.Class or label predictions are made using the Euclidean matrix and confusion matrix.The final method involves assessing performance using evaluation metrics, i.e., determining how effectively the model can predict the correct class on the test data using measures such as accuracy.Accuracy is how close a prediction is to the actual or expected value.The six classification results are based on image classification.In other words, fresh, frozen, and rotten are the three categories used as a basis for dividing findings based on the texture image categories of different meat varieties.Using this method, the model can understand and identify patterns or characteristics that differentiate the texture of various types of meat in the image.Metrics, like accuracy, are used in performance evaluation to show how effectively a model predicts the right class on test data.Using the results of classification, meat varieties can then be categorized according to their condition.

Classification
The k-NN categorization results are generated based on a combination of characteristics.Table 2 shows images of the results of meat texture experiments in meat class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat, as well as the histogram distribution.
As seen in Table 2, this study collected texture image samples from five types of meat (beef, buffalo, goat, horse, and pork), each of which was available in three states: fresh, frozen, or rotten.The table analysis is explained below.Starting with beef, 150 texture image samples were available, 50 samples each representing fresh, frozen, and rotting categories.A total of 150 beef samples were used in the analysis.Second, 150 buffalo meat texture images were used, of which 50 samples each were frozen, rotten, and fresh.During the analysis, 150 buffalo meat samples were collected.Goat meat was the third type of meat tested, and 150 samples of goat meat texture images were collected, 50 of frozen and 50 of fresh.During the analysis, 150 goat meat samples were examined.There were a total of 150 texture image samples for the fourth meat sample, namely horse-50 each for fresh, frozen, and rotten categories.During the analysis, 150 horse meat samples were examined.The total of the fifth meat sample, pork, was 150 texture images, where 50 samples each belonged to the fresh, frozen, and rotten categories.A total of 150 pork samples were used in the analysis.Including 150 samples for each type of meat, the total samples for the entire study were 750.In the dataset division, there were 600 training data samples and 150 testing data samples, consisting of two parts of the dataset.This way, researchers can better describe different types and situations of meat by categorizing data.Reliable assessment of the models or techniques applied to feature extraction and analysis of meat texture images was further supported by dividing the dataset into training and testing subsets.

Histogram
The algorithm used to calculate the histogram includes ascertaining the number of pixels in the image at each intensity level.The following is the basic formula for calculating a histogram, assuming the image is monochromatic or has one intensity level: For example, n is the number of pixels in the image; L is the number of possible intensity levels (e.g., for a grayscale image, L = 256).Thus, the histogram (H) can be calculated using the following formula: where H(i) is the frequency of occurrence of the pixel intensity-i; n i is the number of pixels with intensity-i; n is the total number of pixels in the image.The calculation result above is a normalized value showing that the total of all histogram items is 1.Next, the following formula can be used to obtain the cumulative histogram: CDF(i) is the cumulative distribution function for pixel intensity-i; H(j) is the histogram value of the pixel intensity-j.The cumulative distribution function represents the total proportion of pixels with an intensity less than or equal to a certain value (PDF).Histogram computing is important in several domains, including image processing, color analysis, and image data processing.

Experiment Results
The size of each category of meat class (fresh, frozen, and rotten) was confirmed by analyzing 750 meat texture sample images from five types of meat, viz., goat meat, horse meat, buffalo meat, pork, and beef.The pixels in each meat image were unique.Without scaling when taking meat samples, pixel size variations occur between images.In particular, in high-resolution imagery, scaling can result in visual distortion, reduced image quality, and increased computational effort [52,53].Experiments were conducted to ensure that different pixel sizes for each type and quality of meat were carefully studied to provide consistency and accuracy in the test results and avoid distortion or conflict due to variations in image quality.Based on pixel intensity and pixel frequency, it is simulated that the sample size and histogram distribution in the class (a) dataset are on average more significant and dominant than in the class (b) and class (c) datasets.The frequency and intensity distribution of pixels in an image, along with the histogram distribution, determine the appearance of the image, and thus, this is the main focus of the analysis of various algorithms.

Performance Evaluation of Classification Results
Confusion matrices are a valuable tool for assessing the performance of classification models in predicting correct classes.The confusion matrix consists of four main components: False Positive (FP), True Negative (TN), True Positive (TP), and False Negative (FN).The results of texture image classification for several meat varieties in Table 1 indicate the classification performance in the form of a confusion matrix.There are four options based on Table 1 of the confusion matrix: True Positive (TP) is an instance that is positive and classified as positive; False Negative (FN) is an event classified as unfavorable.True Negative (TN) is an event that is declared hostile; False Positive (FP) is an instance that has been declared positive.

1.
True Positive (TP): The number of positive observations correctly predicted by the model.

2.
True Negative (TN): The number of negative observations correctly predicted by the model.

3.
False Positive (FP): The number of negative observations incorrectly predicted as positive by the model (Type I error).4.
False Negative (FN): The number of positive observations incorrectly predicted as negative by the model (Type II error).

Validation
The probability that an image is considered to have good quality and indeed has good quality is called sensitivity.Equation ( 9) can be used to calculate sensitivity.

Sensitivity = True Positive (TP) True Positive (TP)+ False Negative (FN)
Specificity is the probability of an image being considered to have low quality and indeed has low quality.Equation ( 10) can be used to calculate specificity.

Specificity =
True Negative (TN) True Negative (TN) + False Positive (FP) (10) By dividing the number of classifications by the number of correct classifications, as shown in Equation ( 11), the accuracy of classification success can be described.

2.
True Negative (TN) is the number of negative cases correctly identified as negative.

3.
False Positive (FP) is the number of negative cases incorrectly identified as positive.4.
True Positive (TP) is the number of positive cases correctly identified as positive.

Classification Positive Prediction Negative Prediction
Actual    This k-NN research was created using the Google Colab platform.A GPU, or graphics processing unit, was used in each experiment.Two approaches are usually adopted.In the first stage, two techniques-GLCM and the Haar wavelet algorithm-were used to extract features to identify meat images.In the second approach, the meat image was determined directly from the tracked meat features (feature extraction) using k-NN that has been trained on various image domains.This set of features was put into the k-NN model to see whether the classification performance is sufficient to separate the texture image (a) from images (b) and (c).

Feature Selection Results
Five types of meat images (beef, buffalo meat, goat meat, horse meat, and pork) were used to test the feature selection findings.Each type of meat image was divided into three classes: fresh, frozen, and rotten.A description of each meat is presented in Table 3 using GLCM metrics, including homogeneity, contrast, correlation, energy, and entropy.Importantly, each meat texture image has the same pixel size, namely 500 × 500 [55,56] sing a uniform pixel size for all meat texture images optimizes computer power: it can lower the computational load and speed up the data analysis process.However, this method has several disadvantages, including a lack of spatial resolution and difficulty in accurately capturing any scale variations between images.The texture of each meat image can still be studied more deeply using GLCM metrics, which include contrast, correlation, energy, homogeneity, and entropy.This GLCM measure can be helpful when comparing the textural properties of fresh, frozen, and rotten meat from different types of animals observed.Therefore, despite limitations in spatial resolution, GLCM analysis can still provide valuable insights into meat texture recognition and classification.It can also provide valuable insights into the detection and classification of meat texture, despite limitations in spatial resolution.
Table 5 illustrates how effectively all feature sets differentiate the three classes: (a), (b), and (c).The average percentage of fresh meat images ranges from 51.52% to 183.21%, while for frozen meat images, the range is from 78.25% to 185.75%, and for rotten meat images, the range is from 34.62% to 115.79%.The image of fresh meat shows that fresh pork has less varied textures than other meats.In contrast, the higher mean for all GLCM measurements indicates that the variation in intensity of fresh goat meat is more significant.Significant variations in the intensity and texture structure of fresh meat images from different meat varieties were demonstrated in this experiment.These differences are useful for categorizing and identifying images and understanding the textural characteristics of different types of meat.
On frozen meat images, frozen pork texture images have the lowest average.It shows that the texture of frozen pork has less variation in intensity than frozen goat meat.In contrast, frozen goat meat shows a more striking difference in intensity.These results provide a summary of the textural characteristics of frozen goat meat.This information is useful for learning more about the differences between various cuts of meat and identifying or classifying frozen beef images.
However, the images of rotten meat show that, in most cases, the textural differences between rotten pork and rotten beef are not that spoiled.The difference in intensity is more significant in rotten meat.This study expands our knowledge of the textural characteristics of rotten beef images.This information can help differentiate between states of meat and identify or classify stages of rotten meat [57,58].
Based on (Table 5), the findings show how well the features can differentiate between the three classes: (a), (b), and (c).For fresh meat, the average variation ranges from 51.52% to 183.21%, indicating that fresh pork has a less varied texture.In frozen meat, pork has the lowest average, implying that the texture of frozen pork has less variation in intensity compared to goat meat.In rotten meat, the difference in texture between pork and beef is not that noticeable, but the difference in intensity is more significant.This information can help classify and identify types of meat and understand the differences between fresh, frozen, and rotten meat.
Based on the conclusions from the analysis in (Table 5), a series of features can differentiate between images of fresh, frozen, and rotten meat.Fresh pork has less variation in texture, whereas fresh goat meat has more significant variation in intensity.In frozen meat, pork has less variation in intensity, while goat meat shows more significant differences in intensity.The difference in texture between rotten pork and beef is not significant, but the difference in intensity is more striking.This information is useful for classifying and identifying types of meat based on texture characteristics and understanding the differences between fresh, frozen, and rotten meat categories.
The validation results using k-NN classification for all features of class (a), class (b), and class (c) are presented in (Table 6) below: Fresh Meat: The model can correctly detect fresh meat images for both categories, as evidenced by (A) having the most significant proportion and being more dominant in fresh goat and fresh horse meat texture images and (B) having different quality percentages.With images with the highest accuracy for fresh meat texture, this model can correctly differentiate fresh beef from frozen or rotten beef.This shows how well the model can differentiate fresh meat images from other settings.(C) The model can classify fresh meat images correctly; the texture image of fresh beef and fresh horse meat is the most accurate.This shows how well the model can recognize fresh meat images and differentiate them from other conditions.Images of fresh beef and fresh horse meat (D) are more common in texture images and have the highest percentage (D).This shows a good agreement between the feature model and the actual classes in the fresh meat environment for the classification results.On the other hand, the percentage (D) in the texture image of fresh buffalo meat shows poor performance.Frozen Meat: The model's tendency to recognize the image of frozen pork accurately is demonstrated by the model having (A) the highest dominance percentage over the image of frozen buffalo meat texture.On the other hand, the texture image of frozen buffalo meat has the lowest (A) value, indicating problems in identifying this type of meat.The decreasing trend of the model in classifying the image of frozen buffalo meat correctly is demonstrated by (B), which displays the lowest percentage of all images of frozen buffalo meat texture.In contrast, the images of frozen beef and horse meat textures have the most significant percentage (B), indicating that the model performs better in classifying these images accurately.(C) The frozen buffalo meat texture image has the lowest accuracy, while the frozen pork texture image has the best dominant accuracy.This shows that the model classifies frozen pork images more accurately than buffalo meat images.However, this algorithm works well when classifying the image of frozen meat.When comparing the images of frozen goat meat and pork, the frozen beef percentage (D) is the highest.It shows how well and accurately the algorithm can classify the image of frozen goat meat and pork.On the other hand, the percentage (D) in the texture image of fresh buffalo meat shows poor performance.
Rotten Meat: Showing the model's excellence in identifying the image of rotten goat meat, the (A) highest percentage is more dominant in the image of the texture.However, as the image of rotten buffalo meat has (A) the lowest percentage, it is challenging to distinguish this type of meat.(B) This has the lowest rate for the image of rotten buffalo and horse meat textures, which shows the difficulty of effectively identifying the image of both types of meat.However, the images of rotten beef and pork textures have the highest percentage, showing that the model is more accurate in classifying the image of rotten beef and pork.(C) The texture image of rotten goat, pork, and buffalo meat has the highest accuracy, while the texture image of rotten beef has the lowest.It shows that for the model to classify the image of rotten buffalo meat accurately, it has to be more precise.However, the images of rotten beef, goat meat, and pork can be identified correctly in this experiment.Overall, the system works well in categorizing cases of rotten meat.(D) This shows the images of rotten pork, goat meat, and beef textures.Rotten meat is more common and has the best percentage (D).This model performs well in classifying the image of rotten meat; however, the lowest level of the image is associated with the rotten horse meat texture (D).
Table 7 shows how well the three models compare in terms of the performance measurement results of the k-NN algorithm, the Haar Wavelet algorithm, and the GLCM for the three classes (fresh, frozen, and rotten).(A) k-NN, (B) Wavelet Haar, and (C) GLCM are assumed.First, for the fresh meat texture image class, the percentages are (A) 97% to 99%; (B) 89.25% to 89.96%; and (C) 51.52% to 183.21%.The percentage of frozen meat in both images is 97% to 99% in (A), 87.56% to 88.25% in (B), and 78.25% to 185.75% in (C), all three with percentages ranging from 94%.For rotten meat images, the percentages are up to 96% in (A), 86.26% to 87.97% in (B), and 34.62% to 115.79% in (C).The performance measurement comparison of k-nearest neighbor algorithm, Haar Wavelet algorithm, and gray-level co-occurrence matrix can be seen in Table 7 below: The performance results of algorithms (A), (B), and (C) relating to fresh, frozen, and rotten meat images provide valuable insights into the performance of algorithm models in determining the condition of meat based on texture images.Fresh Meat: (A) The k-NN algorithm gives the best results on texture images of fresh goat meat, horse meat, and beef.It also has the most significant standout score (99%).This shows how well the k-NN algorithm performs in classifying fresh meat images.k-NN performs the worst in the fresh buffalo meat texture image, with a score of 97%.Meanwhile, (B) shows the fresh pork texture image, which demonstrates that the Haar Wavelet algorithm performs worse (89.25%) than k-NN.However, when it comes to fresh beef texture images, our algorithm performs well (89.96%).For the fresh pork texture image (C), the GLCM method gives consistent results, with the lowest application percentage (51.52%).However, GLCM data can still be used for classification, although GLCM has the largest fresh goat meat texture images (183.21%).Of the three algorithms studied, the GLCM, Wavelet Haar, and k-NN models perform the best in categorizing fresh meat texture images into meat categories.This shows that the k-NN technique is more suitable for applications that manage fresh meat texture images.
Frozen Meat: (A) Using the k-NN method, the frozen pork texture image gives the most prominent value (99%), while the texture image of frozen buffalo meat yields the lowest result (97%).This shows how well the k-NN algorithm performs in classifying frozen meat images.However, compared to k-NN, the Haar Wavelet algorithm performs worst (87.56%) on the frozen beef texture images.However, the algorithm continues to produce good results.In total, 88.25 percent is the highest performance in the frozen beef texture image.Based on the GLCM algorithm, the frozen pork texture image (C) has the lowest value, 78.25%.However, GLCM results can still be used to classify frozen meat images.After testing three rounds, k-NN maintains its top ranking in frozen meat texture image classification, with Wavelet Haar and GLCM ranking second and third, respectively.This shows that the k-NN technique is more suitable for applications that require frozen meat texture image classification.GLCM is the best model in performance testing, with an accuracy of 185.75%.
Rotten Meat: (A) has the lowest percentage (94%), although the images of rotten beef, goat meat, and pork have the highest k-NN value (96%).This shows how effective the k-NN algorithm is while classifying images of rotten meat.Meanwhile, (B) k-NN outperforms the Haar Wavelet algorithm (86.26%); there is an image of rotten buffalo meat.However, the algorithm continues to produce good results.In contrast, (C) shows that the GLCM approach produces uncertain results; the rotten pork texture image has the lowest performance percentage (34.62).However, GLCM data can still be used to classify frozen meat images.The rotten beef texture image has the highest performance percentage (115.79%).After testing three different algorithms, k-NN, GLCM, and Wavelet, Haar continues to produce the best classification results for images containing rotten meat textures.This shows that the k-NN approach is more suitable for classifying rotten meat texture images.
Classification accuracy based on meat texture analysis is presented in (Table 8) below:

Conclusions and Future Work
Fresh Meat: With a very high-performance percentage, the k-NN algorithm is best at categorizing fresh meat texture images, especially fresh goat meat, horse meat, and beef.However, GLCM is also excellent in classifying fresh meat texture images, especially fresh goat meat.Frozen Meat: The k-NN algorithm also excels at categorizing frozen pork texture images with a high-performance percentage.In performance testing, GLCM excels in classifying frozen beef texture images with very high accuracy.Rotten Meat: The k-NN algorithm demonstrates its efficacy in this work by re-standing out in categorizing texture images of rotten meat.Even so, GLCM can be used to classify images of rotten meat, yet with uncertain results.Based on comprehensive testing, the k-NN technique is generally more suitable for classifying meat texture images, especially in distinguishing fresh, frozen, and rotten meat.However, GLCM also produces impressive results, especially in classifying

Figure 1 .
Figure 1.Classification stages of the meat texture image.

Figure 2
Figure 2 below shows the stages of the classification model:

Figure 2
Figure 2 below shows the stages of the classification model:

2. 4 .
Wavelet Haar DWT, which is based on Haar wavelet basis functions, is used for dimensionality reduction in the data.Algorithm coefficients and prediction time consumption are better used with DWT (wavelet basis function and the number of transformation layers are Haar-4 respectively) [50].The Haar wavelet is a type of wavelet function used in wavelet analysis.The wavelet function is a mathematical tool for analyzing and representing texture images of various types of meat or data simultaneously in the time and frequency domains.The Dutch mathematician Alfréd Haar presented this function first in 1910.
Appl.Syst.Innov.2024, 7, x FOR PEER REVIEW 9 of 27 (c) Using different scales in the Haar wavelet transform can also affect the number of peaks in the histogram.The more varied the scales used, the more details are captured, resulting in more peaks.

Figure 3 .
Figure 3. Haar wavelet approximation on images of fresh meat types and their histograms.

Figure 3 .
Figure 3. Haar wavelet approximation on images of fresh meat types and their histograms.Why do many peaks appear?Some causal factors include the following: (a) If the original image has many sudden changes or small details, there will be many peaks in the approximation histogram of the Haar wavelet.(b) The resolution of the Haar wavelet transform also influences the number of peaks.The greater the resolution, the finer the details that can be detected, resulting in fewer peaks in the histogram.(c) Using different scales in the Haar wavelet transform can also affect the number of peaks in the histogram.The more varied the scales used, the more details are captured, resulting in more peaks.

Figure 5 .
Figure 5. Classification of texture images of meat types using k-NN, Wavelet Haar, and GLCM approaches.

Table 4 .
Classification Actual Positive True Positive (TP) False Negative (FN) Actual Negative False Positive (FP) True Negative (TN) Illustrations of the histogram distribution and experimental findings of meat texture in class (a) fresh meat, class (b) frozen meat, and class (c) spoiled meat are shown in (Table 4) below: Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.

Table 4 .Table 4 .Table 4 .
Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.

Table 4 .Table 4 .Table 4 .
Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.Illustration of the histogram distribution and findings of meat texture experiments in class (a) fresh meat, class (b) frozen meat, and class (c) rotten meat.There were 50 samples for each of these classes of meat.
) is the intensity of the image pixel at coordinates (m, n).
) is the GLCM element for the intensity pairs  and  at a distance of  and a direction of .• is the Kronecker delta function, with a value of 1 if the values in it are the same, and 0 if they are different.
•  is the pixel intensity at the coordinate (, ) in the image.•and  is the shift in direction that determines the distance.

Table 5 .
Comparison of GLCM feature extraction results for contrast, correlation, energy, homogeneity, and entropy metrics.

Table 6 .
Validation results using k-NN classification for all features of class (a), class (b), and class (c).

Table 7 .
Comparison of performance measurements of the k-nearest neighbor algorithm, Haar Wavelet algorithm, and gray level co-occurrence matrix.

Table 8 .
Classification accuracy based on meat texture analysis.