*2.2. CIS and FIS Algorithms*

#### 2.2.1. CIS Algorithm

The CIS algorithm processes images classified by the classifier as coarse materials. The CIS algorithm is based on the Python OpenCV library (version 4.1.1). The uneven color distribution on the surface of the coarse ores and the coarse ores covered by fine particles led to the region of coarse ores in the image being divided into many small regions. Therefore, the CIS algorithm should be able to remove features that are similar to the ore edge on the surface of the coarse ore. The CIS algorithm is described in Figure 5. *Minerals* **2020**, *10*, 1115 6 of 16 to remove features that are similar to the ore edge on the surface of the coarse ore. The CIS algorithm is described in Figure 5.

**Figure 5.** Block diagram of the coarse image segmentation (CIS) algorithm. **Figure 5.** Block diagram of the coarse image segmentation (CIS) algorithm.

The CIS algorithm follows five steps. In the first step, the input image is processed using the bilateralFilter function. The setting value of the diameter of each pixel neighborhood equals 25, the sigma parameter of the color space equals 100, and the sigma parameter of the coordinate space equals 25. The purpose of bilateral filtering is to blur the surface of coarse materials while preserving the edge. The parameters of the bilateralFilter function were chosen according to experience and practice; for example, 25, 50, 75, 100. After bilateral filtering, the noise, details, and small color blocks on the surface of the ore are blurred, and the edge of the ore is preserved [30,31]. In the second step, the operations include graying [32], adaptive thresholding [33], and median filtering [34,35]. The setting kernel of the median filter equals 3. The kernel of the median filter should not be too high, to prevent edge interruption. After several tries, the results processed using the kernel with a value of 3 was more suitable for subsequent processing than 5 or 7. After the second step, the color image is binarized and denoised. In the third step, the image is processed using the findContours and drawContours functions. After these operations, the interconnected areas are closed. In the fourth step, the image is processed using the erode and morphologyEx functions [36–38]. The setting kernel is a 3 × 3 morph ellipse. The iterations parameter of the erode function is 10 and the iterations parameter of the morphologyEx function is 4. The target of erosion and open operation is to extract markers. The iterations parameters are sensitive, and are chosen by experience and trials. Finally, the watershed transformation is performed based on markers, and the watershed lines are drawn [10,39,40]. For instance, Figure 6 shows how the CIS algorithm processes a coarse material image. The CIS algorithm follows five steps. In the first step, the input image is processed using the bilateralFilter function. The setting value of the diameter of each pixel neighborhood equals 25, the sigma parameter of the color space equals 100, and the sigma parameter of the coordinate space equals 25. The purpose of bilateral filtering is to blur the surface of coarse materials while preserving the edge. The parameters of the bilateralFilter function were chosen according to experience and practice; for example, 25, 50, 75, 100. After bilateral filtering, the noise, details, and small color blocks on the surface of the ore are blurred, and the edge of the ore is preserved [30,31]. In the second step, the operations include graying [32], adaptive thresholding [33], and median filtering [34,35]. The setting kernel of the median filter equals 3. The kernel of the median filter should not be too high, to prevent edge interruption. After several tries, the results processed using the kernel with a value of 3 was more suitable for subsequent processing than 5 or 7. After the second step, the color image is binarized and denoised. In the third step, the image is processed using the findContours and drawContours functions. After these operations, the interconnected areas are closed. In the fourth step, the image is processed using the erode and morphologyEx functions [36–38]. The setting kernel is a 3 × 3 morph ellipse. The iterations parameter of the erode function is 10 and the iterations parameter of the morphologyEx function is 4. The target of erosion and open operation is to extract markers. The iterations parameters are sensitive, and are chosen by experience and trials. Finally, the watershed transformation is performed based on markers, and the watershed lines are drawn [10,39,40]. For instance, Figure 6 shows how the CIS algorithm processes a coarse material image.

*Minerals* **2020**, *10*, 1115 7 of 16

**Figure 6.** Original (**a**), after the first step (**b**), after the second step (**c**), after the third step (**d**), after the fourth step (**e**), and after the fifth step (**f**). **Figure 6.** Original (**a**), after the first step (**b**), after the second step (**c**), after the third step (**d**), after the fourth step (**e**), and after the fifth step (**f**). **Figure 6.** Original (**a**), after the first step (**b**), after the second step (**c**), after the third step (**d**), after the fourth step (**e**), and after the fifth step (**f**).

#### 2.2.2. FIS Algorithm 2.2.2. FIS Algorithm 2.2.2. FIS Algorithm

The FIS algorithm processes the images classified by the classifier as mixed materials. The FIS algorithm is based on the Python OpenCV library (version 4.1.1). Both fine and coarse-fine materials are mixed materials. The edge of fine materials is weak; therefore, excessive blurring causes the under-segmentation of fine material images, and insufficient blurring causes the over-segmentation of coarse material images. The FIS algorithm must remove the edge-like features on the surface of coarse ores as much as possible while retaining the outlines of granular particles and fine material. The FIS algorithm is described in Figure 7. The FIS algorithm processes the images classified by the classifier as mixed materials. The FIS algorithm is based on the Python OpenCV library (version 4.1.1). Both fine and coarse-fine materials are mixed materials. The edge of fine materials is weak; therefore, excessive blurring causes the under-segmentation of fine material images, and insufficient blurring causes the over-segmentation of coarse material images. The FIS algorithm must remove the edge-like features on the surface of coarse ores as much as possible while retaining the outlines of granular particles and fine material. The FIS algorithm is described in Figure 7. The FIS algorithm processes the images classified by the classifier as mixed materials. The FIS algorithm is based on the Python OpenCV library (version 4.1.1). Both fine and coarse-fine materials are mixed materials. The edge of fine materials is weak; therefore, excessive blurring causes the under-segmentation of fine material images, and insufficient blurring causes the over-segmentation of coarse material images. The FIS algorithm must remove the edge-like features on the surface of coarse ores as much as possible while retaining the outlines of granular particles and fine material. The FIS algorithm is described in Figure 7.

**Figure 7.** Block diagram of the fine image segmentation (FIS) algorithm. **Figure 7.** Block diagram of the fine image segmentation (FIS) algorithm. **Figure 7.** Block diagram of the fine image segmentation (FIS) algorithm.

The FIS algorithm follows four steps. In the first step, the input image is processed using the bilateralFilter function. Due to the need to deal with the coarse ores which are contained in the mixed materials, it is necessary to use bilateral filtering. Parameter settings are found to be the same as the CIS algorithm [30,31]. In the second step, the operations include graying [32], adaptive thresholding The FIS algorithm follows four steps. In the first step, the input image is processed using the bilateralFilter function. Due to the need to deal with the coarse ores which are contained in the mixed materials, it is necessary to use bilateral filtering. Parameter settings are found to be the same as the CIS algorithm [30,31]. In the second step, the operations include graying [32], adaptive thresholding [33], and two median filterings [34,35]. The setting kernels of the median filters equal 3. After the The FIS algorithm follows four steps. In the first step, the input image is processed using the bilateralFilter function. Due to the need to deal with the coarse ores which are contained in the mixed materials, it is necessary to use bilateral filtering. Parameter settings are found to be the same as the CIS algorithm [30,31]. In the second step, the operations include graying [32], adaptive thresholding [33], and two median filterings [34,35]. The setting kernels of the median filters equal 3. After the second

[33], and two median filterings [34,35]. The setting kernels of the median filters equal 3. After the

step, the color image is binarized and denoised. In the third step, the image is processed using the erode function and median filtering. The setting kernel of the median filter equals 9 and the kernel of the erosion operation is a 5 × 5 morph ellipse [38]. Due to the edge of fine materials being weak, we should not adopt strong morphological operations. Therefore, the iterations were set to one. To ensure complete separation among markers, the kernel of the median filter in the third step was set to 9. Finally, the watershed transformation was performed based on markers and the watershed lines were drawn [10,40]. A mixed material image was processed using the FIS algorithm as shown in Figure 8. the erode function and median filtering. The setting kernel of the median filter equals 9 and the kernel of the erosion operation is a 5 × 5 morph ellipse [38]. Due to the edge of fine materials being weak, we should not adopt strong morphological operations. Therefore, the iterations were set to one. To ensure complete separation among markers, the kernel of the median filter in the third step was set to 9. Finally, the watershed transformation was performed based on markers and the watershed lines were drawn [10,40]. A mixed material image was processed using the FIS algorithm as shown in Figure 8.

*Minerals* **2020**, *10*, 1115 8 of 16

**Figure 8.** Original (**a**), after the first step (**b**), after the second step (**c**), after the erosion operation (**d**), after the third step (**e**), and after the fourth step (**f**). **Figure 8.** Original (**a**), after the first step (**b**), after the second step (**c**), after the erosion operation (**d**), after the third step (**e**), and after the fourth step (**f**).

#### **3. Experimental Details 3. Experimental Details**
