Research on image recognition method of rock and soil porous media based on dithering algorithm

Rock-soil mass is a kind of material with complex internal structure, and its macro-mechanical response and failure process are influenced by internal microscopic composition and structure. Based on the research results of digital image technology in quantitative aspects of internal structure of rock and soil, a method for segmentation of rock and soil pore images based on dithering algorithm and statistical method for multiple parameters of pores is proposed in this paper. The result of verification shows that the pore recognition method proposed in this paper is reliable, can obtain the pore distribution and related parameters quickly and effectively, which has certain academic value and research significance.


Introduction
Rock-soil mass is a kind of porous medium material with complicated internal structure. And the quantitative measurement of the mesostructure of rock and soil materials is the basis for establishing a reasonable calculation and analysis model [1] . In order to detect the fine and microstructure of rock and soil materials more clearly and intuitively, scholars have introduced scanning electron microscopy, CT and other technologies to research, making it is possible to observe the microstructure of rock and soil [2][3][4] . For different detection methods and types of samples, scholars have done a lot of research on the application of digital image technology to geotechnical materials. For example, Li Jiansheng [5] and Yang Baohua [6] borrowed digital image processing technology to analyze CT images, and proposed methods for identifying and calculating pores. Liu Chun [7] researched and developed an image recognition and analysis system for cracks and pores, which can calculate various geometric parameters of pores.
However, in the current research process, how to choose the threshold of image segmentation is a problem. In view of the segmentation of pore images, a set of quantitative analysis methods for digital images of microstructures of rock and soil materials is proposed in this paper, which can avoid the problem of threshold selection, identify the pores and statistics of related parameters.

Introduction to dithering algorithm
Dithering algorithm refers to the grayscale pixels of the image are represented by a certain proportion of black and white dots, to achieve the grayscale sense of the overall image. Each grayscale pixel in the image uses an m×m output pattern to correspond to it, and the m×m output patterns corresponding to input pixels of different grayscale values are also different. Among them, M3 (Bayer dither table) is a standard pattern with 64 gray levels.
Then make c to be the input pixel value, d (x, y) is an matrix, and is the output value after dithering calculation. When the image dithering is a two-level grayscale image, the value of can only be 0 or 1, and the calculation process can be expressed by the following formula: Among them, d (x, y) is called the dither matrix, and its value can be calculated by the following formula (mod is the remainder operation). Then, the multi-level grayscale image can be converted into a dithering binary image.

Image segmentation
After dithering processing above, a dithering binary image with grayscale values of 0 and 1 will be generated. Then Morphological processing, filter processing and small pixel area cleaning are performed on the binary image, to obtain a binary image with the pore structure of the rock mass. The specific operation results are shown in Figure 2-6.

Pore identification and parameter statistics
If it is assumed that the connected area with the same value "0" (black) in the image matrix is a pore, and the connected area with the same value "1" (white) is a particle. In this way, individual pores and particles in the image can be distinguished, the statistical parameters shown in Table 1 are used to describe soil particles and pores.  Average complexity [8] Refers to the perimeter of a unit area. [9] It can measure the irregularity of complex shapes.

Pore recognition effect detection
In order to test the segmentation effect of the porous media image and the statistical accuracy of the parameters proposed above, this paper chooses two methods of segmentation area detection and average structure similarity for detection calculation. Among them, the average structure similarity MSSIM [10] is based on the image structure similarity (SSIM) method established by Wang et al [11] , and are averaged by the SSIM values of all sub-blocks. The area detection method is to accurately judge the segmentation error between other segmentation methods and the method under the assumption that a segmentation method is accurate. It is assumed that the relationship between the true value region T and the segmented region R is shown in Figure 7 below: The porous medium has a very complex structure, their grayscale boundary is relatively fuzzy. This article takes the soil particle electron microscope sample image, which calibrated by Liu Chun [7] as an example to verify the recognition effect of the dithering algorithm in the real pattern. The details are shown in Figure 8 below. And table 2 shows the statistical parameters of different algorithms:   It can be seen from the above results that the calculated results of the Dithering algorithm and the calibration threshold algorithm have good consistency. Then the automatic threshold method and the Dithering algorithm are compared with the calibrated binary graph, and the MSSIM measurement error distribution is shown in Figure 9 and Figure 10 below.   The above results can be seen: for images with complex structures and difficult to distinguish gray values, dithering algorithm is better than Otsu algorithm. So, taking the difficulty of manually selecting the segmentation threshold into account, the dithering algorithm proposed in this paper has certain academic significance and application value.

Conclusion
This paper introduces the dithering algorithm into the segmentation of porous media images and the identification of related physical and mechanical parameters, and realizes the automatic segmentation of porous media images under the condition of avoiding threshold selection. After segmentation area detection and average structure similarity detection, it is found that the image segmentation technology based on the dithering algorithm proposed in this paper has a good segmentation effect. Then through the statistics of the data of the connected areas after segmentation, physical indicators such as porosity, pore perimeter, pore area and fractal dimension can be obtained, which provides a data basis for in-depth study of rock and soil porous media.