# Research on Coal and Rock Recognition in Coal Mining Based on Artificial Neural Network Models
## 2 Coal and Rock Image Acquisition and Image Feature Extraction
### Image Feature Extraction Based on Wavelet Three-Level Decomposition
(**a**) Three-level wavelet decomposition results of coal seam image; (**b**) Characteristics of LL\({}_{1}\) sub-band in wavelet first-order decomposition; (**c**) Characteristics of LL\({}_{2}\) sub-band in wavelet second-order decomposition; (**d**) Characteristics of LL\({}_{3}\) sub-band in wavelet third-order decomposition. Figure 3: Wavelet three-level decomposition schematic diagram. As the decomposition level increases, the area of the decomposed image will decrease exponentially, that is, the extracted feature information will decrease exponentially. The LL\({}_{1}\) sub-band is 1/4 of the area of the original image, which contains the most feature information, such as Figure 4b. The LL\({}_{2}\) sub-band is 1/16 of the area of the original image, which contains less feature information but more than the LL\({}_{3}\) sub-band, such as Figure 4c. The LL\({}_{3}\) sub-band is 1/64 of the area of the original image, which contains the least feature information, such as Figure 4d. The wavelet coefficient of the decomposed coal and rock images is calculated, and the final calculation result is the extracted image texture feature value. The low-frequency part coefficient and the high-frequency part coefficient of the wavelet decomposition can be calculated by calculating the neighborhood pixel value of the image. The calculation method is shown in Formulas (1) and (2), where \(L_{i}\) is the low-frequency Wavedec2 two-dimensional wavelet coefficient, \(H_{i}\) is the high-frequency Wavedec2 two-dimensional wavelet coefficient, \(i\) is the Wavedec2 wavelet coefficient index number, and \(P\) is the digital image pixel value. \[L_{i}=(P_{2i}+P_{2i+1})\frac{1}{\sqrt{2}} \tag{1}\]  
\[H_{i}=(P_{2i}-P_{2i+1})\frac{1}{\sqrt{2}} \tag{2}\]  
The coal seam image is imported into the two-dimensional wavelet decomposition program based on Wavedec2, written by Matlab 2021b, and then the image is decomposed by wavelet three-level decomposition, resulting in a low-frequency sub-band and nine high-frequency sub-bands. In the experiment, the total amount of eigenvalues extracted after each decomposition is defined as \(Show_{1}\) (i = 1, 2, 3), where i represents the decomposition level, and the statistical method is shown in Formula (3). \[\left\{ \begin{array}{l}Show_{1}=LL_{1}+LH_{1}+HL_{1}+HH_{1}\\ Show_{2}=Show_{1}+LH_{2}+HL_{2}+HH_{2}\\ Show_{3}=Show_{2}+LH_{3}+HL_{3}+HH_{3}\end{array} \right. \tag{3}\]  
The total amount of eigenvalues extracted from each layer of wavelet decomposition is counted and drawn into a network diagram, as shown in Figure 5. The experimental results show that with the increase of the number of decomposition layers, Figure 5a to Figure 5c, the total amount of texture feature value data contained in the mesh graph increases. This proves that as the number of wavelet decomposition layers increases, the total amount of texture feature values extracted from images also increases. In order to improve the accuracy of the network model for image classification and recognition, some statistics of texture features are added in the experiment to increase the difference of eigenvalues. The coal and rock images are  
The contrast of the low-frequency coefficient image is calculated by Formula (5), where \(\alpha_{LL}(i)\) is the contrast of the LL sub-band when the sub-band scale value is i (i = 1, 2, 3); and t is the gray level. \[\alpha_{LL}(i)=\sum_{n=0}^{L-1}t^{2}\Bigg{\{}\sum_{n=0}^{L-1}\sum_{n=0}^{L-1}P( m,n)\Bigg{\}} \tag{5}\]  
The correlation of low-frequency coefficient images is calculated by Formula (6), where \(G_{LL}(i)\) is the correlation of the LL sub-bands when the sub-band scale value is \(i\) (\(i\) = 1, 2, 3); \(u_{1}\) and \(u_{2}\) are the mean values of \(P\) (\(m\),\(n\)); and \(\sigma_{1}\) and \(\sigma_{2}\) are the variances of \(P\) (\(m\), \(n\)).