# Supervised Learning-Based Image Classification for the Detection of Late Blight in Potato Crops
## 3 Materials and Methods
### Feature Extraction  
Feature extraction is based on identifying features in the image, region, or boundary and assigning quantitative and qualitative attributes to these detected features [13]. For this investigation, feature extraction focuses on identifying patterns based on the RGB and HSV color models and texture features based on the GLCM grey level co-occurrence matrix.  
To carry out the extraction of color characteristics, initially, the color spaces RGB and HSV models are selected in this investigation. Subsequently, each model has been divided by the channels that compose it: red (R), green (G), and blue (B) for the case of RGB and value of brightness (V), tone (H), and saturation (S) for the case of HSV. Finally, first order statistics calculation is performed, including mean, standard deviation, variance, and range applied to each component of RGB and HSV. As a result of this feature extraction, a total of 24 color features are obtained.  
Figure 7: Result obtained from the application of Range Threshold Segmentation.  
* Contrast: It is the amount of local variations in the shades of grey of the image. If the contrast is higher, there are different shades of gray and the feature is defined as: \[\sum_{i,j=0}^{levels-1}P_{i,j}(i-j)^{2}\] (1)
* Dissimilarity: Similar to contrast. It is high when the region has a high contrast; the metric can be defined as: \[\sum_{i,j=0}^{levels-1}P_{i,j}|i-j|\] (2)
* Homogeneity: Measure of similarity in the image; a value of 0 indicates a high similarity. The measure can be expressed in the form: \[\sum_{i,j=0}^{levels-1}\frac{P_{i,j}}{1+(i-j)^{2}}\] (3)
* ASM (Angular Second Moment): Uniformity; if this is greater, there are fewer variations in the shades of gray. The metric can be defined as: \[\sum_{i,j=0}^{levels-1}P_{i,j}^{2}\] (4)
* Correlation: Dependence of the shades of gray in the image; if it is 0, there is no linear correlation between the levels. The metric can be defined as: \[\sum_{i,j=0}^{levels-1}P_{i,j}\left[\frac{(i-\mu_{i})(j-\mu_{j})}{\sqrt{( \sigma_{i}^{2})(\sigma_{j}^{2})}}\right]\] (5)  
The texture feature extraction is based on the computation of the gray level co-occurrence matrix and the GLCM texture properties using Equations (1)-(5). A total of twenty-four features are obtained. An estimate of the image properties related to second-order statistics and based on the gray level co-occurrence matrix (GLCM) is shown in Table 2.  
A dimensionality reduction technique called the principal component analysis (PCA) method was used to reduce the previously mentioned characteristics. This statistical method simplifies the complexity of sample spaces with many dimensions while preserving their information. The algorithm projects the original color and texture feature data that is 48-dimensional into just two dimensions. The two new components corresponding to the two main dimensions of the variation are obtained as output.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & 0\({}^{\circ}\) & \(\pi\)/4 & \(\pi\)/2 & 3\(\pi\)/4 \\ \hline Contrast & contrast-0 & contrast-pi\_4 & contrast-pi\_2 & contrast-3 pi\_4 \\ Dissimilarity & dissimilarity-0 & dissimilarity-pi\_4 & dissimilarity-pi\_2 & dissimilarity-3 pi\_4 \\ Homogeneity & homogeneity-0 & homogeneity-pi\_4 & homogeneity-pi\_2 & homogeneity-3 pi\_4 \\ Energy & energy-0 & energy-pi\_4 & energy-pi\_2 & energy-3 pi\_4 \\ Correlation & correlation-0 & correlation-pi\_4 & correlation-pi\_2 & correlation-3 pi\_4 \\ ASM & asm-0 & asm-pi\_4 & asm-pi\_2 & asm-3 pi\_4 \\ \hline \hline \end{tabular}
\end{table}
Table 2: GLCM texture features.