2.3.1. Image Preprocessing

With a camera (Huawei Honor 20, 48 million pixels), 358 gangue images and coal block images (including 285 gangue images and 173 coal block images) were taken. The image size was 4000 × 3000, forming the original sample set. We preprocessed the original images in order to extract the feature vectors, as shown in Figure 3.


The results of the prepossessing process are shown in Figure 3.

2.3.2. Gray Level Co-Occurrence Matrix (GLCM)

The method commonly used to describe the grayscale texture is the grayscale correlation matrix. The index eigenvalues derived from the gray level co-occurrence matrix are as follows: "*contrast*" returns the contrast between a pixel in the whole image and its neighbors. The contrast of an image composed of constants is 0. The calculation equation is

$$\text{Contrast} = \sum\_{i,j} |i-j|^2 p(i,j) \tag{12}$$

"*Correlation*" returns the cross-correlation between a pixel in the whole image and its neighbors. The value range is [−1, 1]. The cross-correlation of images composed of constants is none. The correlation degrees 1 and −1 correspond to complete positive correlation and complete negative correlation, respectively. The calculation equation is

$$Correlation = \sum\_{i,j} \frac{(i - \mu \* i)(j - \mu \* j)p(i, j)}{\sigma\_i \* \sigma\_j} \tag{13}$$

"*Homogeneity*" reflects the tightness of the distribution of elements in the GLCM relative to the diagonal of the GLCM. The value range is [0, 1]. The homogeneity of a diagonal GLCM is 1. The equation is

$$Homogeneity = \sum\_{i,j} \frac{p(i,j)}{1 + |i - j|} \tag{14}$$

"*Energy*" returns the sum of squares of all elements in the GLCM. The value range is [0, 1]. The energy of an image composed of constants is 1. The calculation equation is

$$Energy = \sum\_{i,j} p(i,j)^2\tag{15}$$

2.3.3. Feature Extraction of Coal and Gangue Images

According to the theories detailed above, the feature vector of each sample image is composed of six image features (contrast, correlation, homogeneity, energy, *Encircle–City Feature* and *Encircle–City Feature* auxiliary). As shown in Table 1, the sample included 358 sample images composed of 185 gangue images and 173 coal images.


**Table 1.** Feature vector of the sample set.

As space is limited, only some data have been listed; the complete list of data is given in the link in Appendix A.

#### 2.3.4. Flowchart of the Proposed Method

As shown Figure 4, the flow chart of the proposed method includes the steps of inputting samples, initialization of the ASGS-CWOA, the optimization process and recording the data. The details about inputting the samples are given in Sections 2.3.2 and 2.3.3, and the details of initialization of the ASGS-CWOA, the optimization process and recording the data are described in Sections 2.2.1 and 2.2.2 above.

**Figure 4.** Flowchart of the proposed method.

## **3. Simulation Experiment**
