Quantitative Identification Cracks of Heritage Rock Based on Digital Image Technology

Digital image processing technologies are used to extract and evaluate the cracks of heritage rock in this paper. Firstly, the image needs to go through a series of image preprocessing operations such as graying, enhancement, filtering and binaryzation to filter out a large part of the noise. Then, in order to achieve the requirements of accurately extracting the crack area, the image is again divided into the crack area and morphological filtering. After evaluation, the obtained fracture area can provide data support for the restoration and protection of heritage rock. In this paper, the cracks of heritage rock are extracted in three different locations.The results show that the three groups of rock fractures have different effects on the rocks, but they all need to be repaired to maintain the appearance of the heritage rock.


Introduction
As the most intuitive carrier in cultural traditions, heritage rock have left precious wealth for the brilliant history of the Chinese nation. It contains a large number of precious heritage rock, but with historical changes, social development, and the fate of heritage rock have also undergone tremendous changes with the development of the times. Rock is a valuable cultural relic because of its own characteristics, but with the change of dynasties and histories, these very meaningful rocks have been damaged to varying degrees. The reasons for the damage are various. Summary includes two main factors: natural environment and human influence. Therefore, this paper will provide some ideas for the protection, rehabilitation and restoration of heritage rock through the exploration of digital image processing technology in the detection of rock cracks in heritage rock. The reason why this paper studies the application of digital image processing technology in the detection of heritage rock cracks is because it is found that image technology has obvious advantages in the protection and restoration of heritage rock, such as high accuracy and reliability, and Non-contact damage to rock surface and high detection efficiency.
With the development of computer science, the technology of image processing is also used by more people and gradually improved. Some scholars have applied computer image processing methods to the identification and research of road cracks [1], and some scholars have proposed a method for concrete apparent crack detection [2]. Fang Mengyang et al. used MATLAB image processing technology to identify the contours of particles in the clastic rock, and obtained various morphological parameter information of all particles in the clastic rock [3]. Some scholars used the IOP Publishing doi:10.1088/1742-6596/2148/1/012048 2 crack detection embedded system to diagnose the bridge concrete cracks and recognition [4]. Some scholars use digital image processing technology to perform polarization imaging on stone carvings, which enhances the detection of carving features [5].
Based on the research of many scholars, this paper uses MATLAB to realize the function of digital image technology in the detection of heritage rock cracks. The system used in this paper is GUI design. The interface of the entire system is shown in figure 1. GUI is a graphical user interface. It has the advantages of convenient and friendly interface for users and easy operation [6].

Image Preprocessing
Through the preprocessing of the image, the influence of the noise caused by various factors on the experimental results can be minimized. Therefore, in order to better reduce the impact of noise and improve the efficiency of the algorithm, this paper will mainly introduce several image preprocessing methods:

Image Grayscale
From the spectrum theory, we can know that all visible light is mixed by the three colors of red (R), green (G), and blue (B). The pictures used in this experiment are all made by mobile phones, and these pictures are also described in the RGB color space. However, the processing calculation for the three components of R, G, and B is relatively large, so grayscale processing is required to ensure that the operation of image processing is easier and the result is more accurate.
In the RGB color space, there are four main methods for image gray-scale processing: component method, maximum method, average method, and weighted average method. This paper will give a brief introduction to these four methods one by one.

Component Method:
The component method refers to the gray value obtained after conversion of the brightness values of the three components of R, G, and B in the image as the gray value of the three gray images. This processing process can be expressed as formula (1) (1) Where f k (i, j) (k=1, 2, 3) represents the gray value of the image after gray-scale conversion processing.

Maximum Method
This method refers to selecting the largest amount among the three components of R, G, and B of the image as the gray value of the entire image. This process can be expressed as formula (2) f(i, j) = max{R(i, j), G(i, j), B(i, j)}

Average Method
Since there are three components of R, G, and B in the image, the average value method, as the name implies, is to use the average value of these three components in the image as the gray value of the entire image. This method can be expressed by the following formula (3).

Weighted Average Method
Because the human eye is not very sensitive to all colors, the sensitivity of the human eye to different colors is different, so if you want to get a gray value of the image, you need to deal with it according to the sensitivity of the human eye to the color. Different colors are given different weights, and then the values given with different weights are weighted and averaged. This method is the weighted average method. For the pictures in this paper, they are described in the three color environments of R, G, and B. Because human eye has different sensitivity to these three colors, it is most sensitive to green, followed by red, and for blue the sensitivity is the lowest [4] , so the weight of 0.59 for green, 0.3 for red and 0.11 for blue is given. With the weights, the gray value of the image can be expressed as the following formula (4) Choosing the weighted average method to preprocess the rock cracks can get more accurate results, and can reduce the difficulty and improve the efficiency for the subsequent processing. Therefore, this paper adopts the weighted average method to gray-scale the graphics.

Image Filtering
In actual images, there are often a variety of noises, and the presence of these noises will affect the processing of the image to varying degrees, and at the same time will also have a corresponding impact on the rendering effect of the processed image. By reading the literature, we know that most of the energy in the image information is concentrated in the middle and low frequency parts, and the high frequency parts will be covered by noise due to weak energy. Therefore, this part of the highfrequency noise needs to be filtered out in the experiment, and this is image filtering. Through filtering operations, the extraction of image features is more recognizable and more operable, and to achieve image noise reduction the goal of. This paper will introduce three filtering methods, namely mean filtering, Gaussian filtering and median filtering. 1) Mean filtering: this method first needs to select a target pixel, then according to this pixel as the center of the circle, the pixel values of the pixels within a certain radius are averaged, replace pixel values of target pixels with average values, this method is a linear filtering method can be expressed as formula (5): g(x, y) Represents the pixel value after the pixel point (x, y)is filtered, f(x, y) represents the pixel value of the pixel point, and M represents the size of the range selected during the filtering process.
2) Gaussian filtering: It is also a linear filtering method. This method is similar to mean filtering, the difference is that the pixels in a certain radius are calculated according to the weight of a certain normal distribution. One-dimensional expressions such as formula (6), two-dimensional expressions such as formula (7): 3) Median filtering: this method also needs to select a target pixel first, then determine the pixels within a certain radius, and then sort the pixel values of these pixels from low to high, select the middle value of this sequence, and use this median value replaces the pixel value of the target pixel. This method is a non-linear filtering method. Expressed as formula (8): g(x, y) Represents the pixel value of the pixel (x, y) after median filtering, and f(x, y) represents the pixel (x, y) value of the pixel.

Image Enhancement
Image enhancement refers to the operation of enhancing the useful information needed in the image. After image enhancement, useful features are enhanced, while less useful features will be suppressed. After image enhancement, the feature distribution of the image is more obvious, which is more conducive to the recognition of image features by human eyes and machines.
There are many methods for image enhancement. This paper uses one of many methods: spatial domain image enhancement technology. This technology is simple and easy to understand and has strong operability, this technique enhances images mainly through linear or nonlinear transformations. The neighborhood denoising method is a commonly used method in this technology. Determine a target pixel, select the pixel in the corresponding area in a specific direction, and enhance the pixel in this area according to certain rules. The definition of the operator can be expressed as formula (9): A(x, y) Represents the output image after the enhancement operator is processed, B(x, y) represents the original image, and T represents the enhancement operation in a certain direction of the pixel(x, y). The schematic diagram of the operation is shown in the figure.

Image Binarization
The so-called image binarization means that each pixel value in the pixel matrix assigned to the image is only two values, which are 0 (representing black) or 255 (representing white), that is, the entire image presents only black and white effects. In this paper, the threshold method is used to binarize the image, that is, a fixed value V is set according to the need. When the pixel value in the grayscale image of the original image is less than or equal to this fixed value V, then these in the binarized image, the value of all pixels is set to 0, otherwise it is 1, and the expression is shown in formula (10) In the formula, V represents a fixed value, W represents the pixel value in the original image grayscale image, and f represents the pixel value of the binarized image.

Extraction of Crack Information
The image pre-processed in the previous paper has filtered out most of the noise that will interfere with the experiment, retains and enhances some features that are beneficial to subsequent operations. This paper aims to extract the cracks of the heritage rock, so the pre-processed image needs to extract the crack information.

Fracture Segmentation
Because most of the rock's cracks are not evenly distributed in the area and the distribution is wide, in order to make the extraction of the image cracks go smoothly, the image needs to be segmented first, and the image is divided into several small areas, analysis and processing of each small area, the commonly used image segmentation methods are based on threshold, region and edge, and this article mainly uses the region-based image segmentation method.
The region growing method [2] is to operate on pixels with the same properties. Before the operation, it is necessary to determine the classification rules. Commonly used rules include the gray value, the texture characteristics of the image content, and the color of the image. According to the determined rules, the pixels in the image are classified, and the same types of pixels or pixel blocks are grouped together as a category of image judgment standards. Therefore, this method can be understood as classifying pixels according to a certain rule, using pixels with a certain property as seeds as needed, and then selecting pixels with the same properties as the seeds among all the pixels in the image. Then these pixels with the same properties are combined, and finally displayed according to the combined situation of the pixels. In this paper, gray value is selected as the classification rule, point A is used as the seed, and then a certain neighborhood B of the crack is determined as the area to be executed by the region growth method, and then iterated according to formula (11) In the formula, f(A) represents the gray value of point A, f(B i ) represents the gray value of any point in the area B, and T, T 1 , T 2 represents the gray value range.

Morphological Processing
For images that have undergone the area growth method, the recognition effect of the crack area has been greatly improved, but there may still be some problems that the crack shape is not ideal. In order to avoid these problems from affecting the subsequent operations, so Morphological processing of the image is also required. Morphological processing has four basic operations: corrosion, expansion, opening operation and closing operation [4] . Corrosion is the morphological treatment method used in this paper.
Morphological corrosion can eliminate the boundary points of the image and shrink the boundary to the inside. This method can be used to eliminate small and meaningless objects in the image and that will affect the image recognition. The target pixels can be processed by corrosion to achieve refinement purpose. This method has a vivid analogy, In the cell living environment, 0 is used to represent cells with viruses, and 1 is used to represent healthy cells. The process of viruses eroding healthy cells is the corrosion operation. As shown in figure 3, for a 3*3 pixel matrix, as long as there is a virus (0), healthy cells (1) will be corroded.

Evaluation of Crack Information
After the above-mentioned fracture segmentation and morphological processing, the fracture area of the image is already obvious. Next, a certain evaluation of the extracted fractures is needed to determine the degree of impact of the fractures on the rock. Since there is no universal standard for evaluating rock cracks in stony heritage rocks [7], this paper formulates the judgment rules on heritage rock based on the actual situation and the research of other scholars, as shown in table 1 and table 2.

Experimental Test
This paper selects three rock cracks in different locations for research, uses the mobile phone to take pictures of the cracks, and imports the taken pictures into the system. After a series of operations, the information of the cracks is obtained, and the severity of the corresponding rock cracks is analyzed. The protection and restoration of the rocks provide favorable data support.
(1) The first group is the stone road between the Hall of Prayer for Good Harvests in the Temple of Heaven and the Echo Wall. The picture taken is as shown in figure 4, where there is a longitudinal crack in the target picture, and the shape of the crack is relatively regular. There are large waves of water ripples in the lower part of the image, but the color is lighter, and the contrast with the surrounding environment is not large, and the cracked part is in the middle. The crack image extracted after processing is shown in figure 5.  (2) The second group is the moat fence on the north side of the Temple of Heaven. The photo taken by the mobile phone is shown in figure 6. Although the cracks in the target picture are irregular, the overall shape is relatively smooth. The image around the crack has little contrast with the surrounding environment, the upper part is generally white, and the crack part is in the middle. The image of the crack area extracted after processing is shown in figure 7    (3) The third group is the steps near the clerical pavilion in Zhengjue Temple of Yuanmingyuan garden. The picture taken by mobile phone is shown in figure 8. The cracks in the target picture are not regular but the overall shape is relatively smooth. There is little contrast between the image cracks and the surrounding environment. The crack area image extracted after processing is shown in figure 9.  Summarize the processed data of the above three groups of pictures. Due to the uneven distribution of the width of the entire crack, there is the widest part and the narrowest part in a crack. Therefore, the evaluation of the crack width in this paper uses the average value of the maximum width and the minimum width.
According to the evaluation rules on the cracks of cultural relics made in the previous paper, it can be concluded that the cracks in experimental groups 1 and 3 have a moderate impact on the rock, while the rock cracks in the experimental group 2 have a serious impact on the rock. Therefore, the three groups of rocks need to be repaired and protected, but because the impact of the second group is more serious, the second group of rocks needs to be repaired urgently to avoid more serious impacts on the rocks.

Conclusion
(1) The application of digital image technology in the extraction of heritage rock fractures first needs to preprocess the image, and first filter most of the noise that will affect the extraction of fractures, which is beneficial to improve the efficiency of subsequent operations. Then the preprocessed image is subjected to crack segmentation and morphological processing, and a part of the small noise is filtered out again, so that the crack area obtained after the operation is more accurate. The evaluation of cultural heritage rock according to the established rules provides favorable data support for the pre-protection and restoration of cultural relics.