# Determining Effective Threshold Range of Image Pixel Values for Municipal Waste-Contaminated Clay
## 3 Results  
### Image Processing Method: IPP and PCAS  
In IPP, images can be transformed from color to grayscale images and from grayscale to binary images. In both manual and automatic methods, this program can be used to measure more than 60 measurement parameters, including the center point, long and short axes, perimeter, area, and number of dimensions. It can also select the necessary measurement parameters, display the target parameters, and automatically number the target in accordance with the specifications. The main function of PCAS is to automatically identify, geometrically quantify and statistically analyze microscopy images of particles, cracks, and pores. Through the image corrosion operation and seed algorithm, the fine connections between pores can be removed to identify and separate any particles that come into contact and overlap with each other in the image [41]. The two primary categories of frequently used image binarization methods are local and global thresholding methods ([PERSON] et al., 2020) [42]. Local thresholding, which is based on the grayscale histogram and other methods of achieving multithreshold segmentation, is typically used to identify severe interference in poor-quality images [43]. However, the calculation speed is low, and image connectivity cannot be guaranteed. In the global thresholding method, a threshold is determined based on the entire image. The disadvantage is that the processing effect is significantly worse when the illumination distribution is uneven or the noise interference is high [44]. In this study, each SEM image was preprocessed before the global threshold approach was utilized to calculate the threshold value. The specific SEM image processing steps, adopting an uncontaminated clay image as an example, are shown in Figure 2.  
Figure 2: SEM images preprocessing of the uncontaminated clay sample. Preprocessing of SEM Image  
Images should be set to the same brightness and contrast levels as much as possible because these factors significantly impact the image information, and too much or too little brightness could result in inaccurate or missing image information. First, IPP was used to correct distortions of the image background and eliminate uneven brightness. Then, the background-corrected image was processed to enhance the image intensity by adjusting the brightness, contrast, and gamma correction levels. After determining the range of variation of these three parameters by selecting several values, the brightness value was increased by 4-18, the contrast value was increased by 4-18, and the gamma value was increased by \(-0.3\)-\(0.3\). Finally, the sharpened filter was used to improve the measurement accuracy and image quality. Thresholding of SEM Image  
The image was segmented using the global thresholding method, which was programmed in MATLAB 2022 in accordance with Equation (1). The gray value of a pixel with a threshold lower than \(T\) in the original image was set to 0; otherwise, it was set to 1. \[g(x,y)=\left\{ \begin{array}{ll}0&f(x,y)<T\\ 1&f(x,y)\geq T\end{array} \right. \tag{1}\]  
where \(f(x,y)\) is the grayscale function of the original image, \(g(x,y)\) is the grayscale function of the binarized image, and \(T\) is the threshold. Morphological Processing of the SEM Images  
After image binarization, there were isolated black and bright spots in the soil binary image due to the influence of impurities and image noise. These isolated points were resolved via automatic pore system analysis in PCAS. The recognition of particles in PCAS is based on the seed algorithm. The minimum area was set to 50, low-noise pixels below the threshold were removed, and particles with pixels above the threshold were recognized. The overlapped portion of particles was then corroded after the element radius was set to two based on the corrosion operation. To acquire the particle properties, independent particles were finally located, and the corroded pixels were added back to the original particles.