## 3 Implementation of Digital Image Processing Based on Particles Statistical
The calibration of standard pixel points of target particles was based on the given shooting conditions, including the shooting distance, the camera's focal length, the camera's  
Figure 3: K-means clustering algorithm diagram: (**a**) binary image of two particles; (**b**) the distance between all of the pixels of target particles and the position of the initial centroid; (**c**) the center point moves to a new center point position. sensor pixels, and other conditions, to obtain the pixels number of the target particle. Two points should be considered: 1. The shooting conditions of the target particle calibration were in accordance with the shooting conditions in the actual test process. 2. It was necessary to calibrate a large number of target particles and finally determine the number of standard target particle pixels. The image process is shown in Figure 4. It consists of six main steps: basic parameter input, image reading and windowing, image pre-processing, connected domain search and statistics, particle statistics by k-means clustering and the criterion of min(_Dao_), and result output. The basic parameters that needed to be input included only the standard pixels of the target particles, which were determined by the previous calibration process of the average pixel points of target particles. The image pre-processing included the steps of greyscale, image enhancement, and image binarization, where the image enhancement used histogram equalization and the bimodal valley in the histogram automatically selected by the program was used as the threshold in image binarization. The related information of the connected domain included the number of connected domains, the number of pixels of each connected domain, and the coordinates of each pixel point. The output results included the number of windows, the number of target particles, the value of \(N_{2E}\), the value of \(N_{2}/N_{2E}\), and the observed porosity. Through the above analysis, by giving specific individual particle pixels \(P_{i}\), the area of occlusion can be analyzed. But due to differences in particle size and shape, only the average value \(P_{m}\) and the standard deviation \(\delta\) can be obtained, not a specific value. Determining the suitable \(P_{i}\) value is still a problem. Let us assume the simplest case, in which there are \(M\) particles of equal particle size with a total number of pixels as \(Ap_{i}\), where \(a\) is the multiple coefficients of the standard deviation, which depends on the complexity of the target particle shape, and the subscript sign \(i\) is the number of single-particle pixel values. When there is no occlusion between  
Figure 4: Main steps of the image processing program. particles in a test image, it is obvious that there is \(Ap_{0}=P_{1}\times M\). But when there is partial occlusion between particles, \(Ap_{1}<P_{1}\times M\). So the difference between the two areas is the sum of the obstructed area, i.e., \(Dao=Ap_{0}-Ap_{1}=P_{1}\times M-Ap_{1}\). For example, the shaded area between the two centers in Figure 3a represents the area of occlusion between the two particles. Let us take a step further: the sizes of \(M\) particles are not the same, and there is a range of individual particle pixels where \(P_{i}=[P_{\mathrm{m}}-a\delta,P_{\mathrm{m}}+a\delta]\). In this situation, the \(Dao\) should be carefully considered as it contains important information, that is, the minimum value of \(Dao\) within a specific range of \(P_{1}\) is as a judgement condition to obtain the actual number of particles, which is the criterion of \(\min(Dao)\). A simple example will be used for further discussion in Section 4.1 below. The above algorithm is implemented in Python, and the corresponding code is written by the authors.