Research on Concrete Beam Crack Recognition Algorithm Based on Block Threshold Value Image Processing

: To solve the problem that the digital image recognition accuracy of concrete structure cracks is not high under the condition of uneven illumination and complex surface color of concrete structure, this paper has proposed a block segmentation method of maximum entropy threshold based on the digital image data obtained by the ACTIS automatic detection system. The steps in this research are as follows: 1. The crack digital images of concrete specimens with typical features were collected by using the Actis system of KURABO Co., Ltd., of Japan in the concrete beam bending test. 2. The images are segmented into blocks to distinguish backgrounds of different grayscale. 3. The maximum interclass average gray difference method is used to distinguish the sub-blocks and screen out the image blocks that need to be segmented. 4. Segmentation is made to the image with 2D maximum entropy threshold segmentation method to obtain the binary image, and the target image can be obtained by screening the connected domain features of the binary image. Results have shown that compared with other algorithms, the proposed method can effectively decrease the image over-segmentation and under segmentation rates, highlight the characteristics of the target cracks, solve the problems of excessive difference between the identi ﬁ ed length and actual length of cracks caused by background gray level change and uneven illumination, and effectively improve the recognition accuracy of bridge concrete cracks.


Introduction
Cracks in concrete structures not only affect the appearance of the structure, but also lead to internal rebar corrosion, accelerate the aging of the structure, and reduce the bearing capacity and safety of the structure. Rapid and accurate identification of concrete surface cracks is an important means of structure quality inspection and safety assessment. Method for detecting concrete cracks mainly include ultrasonic detection, acoustic emission detection, optical fiber sensing detection and digital image processing detection. Among them, the crack detection method based on digital image processing has the advantages of non-contact, high efficiency, convenience and intuitive image, so it is a common method for apparent crack detection of concrete beams.
At present, a lot of research achievements have been made on crack detection based on image processing. Aiming at the binarization problem in image processing, Ostu [1] first proposed the threshold segmentation method. It uses each pixel in the image which belongs to the target or to the background area and then obtain the corresponding binarized image and it is widely used in dealing with crack image.
However, noise and over-segmentation phenomenon will be generated due to the lack of self-adaptation [2]. Research of Lee shows that when the area of the target is over 30% of the whole image, the segmentation performance of the traditional algorithm is close to the optimal value. When the relative area of the target is reduced, the performance of these methods is rapidly reduced [3]. Rao et al. [4] used the traditional differential operator to solve the two-dimensional real function of the gradient, and then selected a specific threshold to extract the contour edge of the image. In the absence of noise, the results are better when these operators are used to detect the edge of the bridge image. However, the actual bridge images obtained in the acquisition cannot remove the influence of noise caused by uneven light and shadow. Liu et al. [5] adopted the traditional mathematical morphology method and did not take any preprocessing for the image containing noise, effectively detecting the edge and filtering out the noise at the same time. This algorithm only uses a single structural element to complete the corrosion operation, so it can only retain the edges in the same direction as its structural element, while the edges in different directions will be corroded away, which will greatly affect the accuracy of fracture extraction. Fujita et al. [6] applied the linear filtering of Hessian matrix to enhance the contrast between the crack area and the background, followed by threshold segmentation on the image to extract the crack area. This method can well extract the cracks in the concrete image, but the threshold value is fixed globally in an image, so the adaptability of the algorithm is poor. Nishikawa et al. [7] designed a crack detection method using image filtering operations. The genetic programming is used to construct the image filter to detect the crack area, and then the filtering and crack connection are performed again in the suspected crack area. The crack recognition effect of this algorithm is accurate, but the algorithm is cumbersome and the engineering application is less feasible. Tsai et al. [8] designed an automatic crack detection algorithm using the smallest path. The starting point of the crack is only needed in this algorithm to identify all the continuous cracks, which is efficient and convenient. The disadvantage is that the starting point of the crack needs to be selected manually which means the result is subject to manual error. Velenca et al. [9] designed a crack recognition algorithm combining image processing and photogrammetry. The crack images were obtained by direct shear experiments in the laboratory. The final crack image is obtained after being filtered, binarized, noise-removed, edge-connected, hole-filled and shape-detected. The experimental results show that the crack detection error is 0.2%. However, the detection samples of the algorithm are crack images obtained under laboratory conditions, which are quite different from the actual situation on the spot. Muduli et al. [10] designed an improved crack detection algorithm based on digital image fusion. The algorithm uses the improved canny operator and HBT to perform edge detection on the crack image, and then uses Haar wavelet decomposition to remove the noise. However, when there are a lot of noise in the crack image, the detection effect of the algorithm will be inaccurate. Attard et al. [11] proposed a hybrid detection method combining neighborhood image difference method, binary pixel comparison and optical flow method. This method can predict the development trend of tunnel cracks while detecting tunnel diseases. Miyamoto et al. [12] determined the edge of the crack on the image obtained on the basis of the gray difference between the crack and the background. Salari et al. [13] used the wavelet transform algorithm for image noise reduction and the Otsu algorithm for threshold segmentation, and extracted the crack area on the basis of the gray information of the image, but it was not related to the shape features of the crack. Based on MATLAB and other software. Wei et al. [14] and Zhigang et al. [15] studied the issue of pavement crack detection through image significance analysis, histogram estimation and shape analysis. Song et al. [16] used the method of gray-scale skeleton combined with fractal optimization to identify concrete cracks, and this algorithm can suppress interference of noises in background fairly well. Song et al. [17] used fuzzy C-means clustering algorithm to segment the image, and then used morphological processing for fine extraction of the cracks. Sifre et al. [18] and Oyallon et al. [19] used the deep learning theory to realize the recognition of image texture features. The rotation and scale scattering invariance algorithm was used to provide a new research method for crack identification of concrete. However, the feature extraction effect of the algorithm was not good, and the accuracy should be improved.
Due to the influence of concrete pouring, curing, carbonation and other factors, concrete structure digital images collected have problems such as uneven illumination and excessive noise. It is difficult to solve all these problems with the image processing approaches mentioned above. In this paper, the crack digital images of concrete specimens with typical features were collected by using the Actis system of KURABO Co., Ltd., of Japan in the concrete beam bending test. On this basis, a threshold segmentation algorithm based on image blocking idea has been proposed. This approach combines block image processing and maximum entropy threshold segmentation, to improve the recognition accuracy of concrete bridge surface cracks. First, the concrete image taken was divided into blocks, then blocks with only the background and those with the target and the background are distinguished by the maximum inter-class variance method, and finally, the maximum entropy threshold is used to segment blocks with both the target and the background and to screen the connected domain to obtain the target image.

Concrete Beam Bending Test
First, concrete beams bending test was made to collect images of concrete beams with cracks. The test process is as follows:

Making Concrete Beam Bending Specimens with Cracks
The test specimens were reinforced concrete beam-column structural members, with concrete strength grade C30 and concrete beam size 250 mm × 250 mm × 1950 mm. After curing for a certain age, the specimens were loaded and cracks appear on the surface. The specimens with cracks on the surface after testing are as shown in Fig. 1.

Crack Image Acquisition Equipment
The concrete beam components are tested by the ACTIS automatic crack detection system after loading test. The ACTIS automatic crack detection system produced by Japan KURABO Co., Ltd., is a system that automatically extracts cracks by visual images taken by a digital camera. The system can be widely used in the maintenance and management of bridges, tunnels, roads, dams, buildings and other buildings. The software can automatically extract cracks with one click, which can determine the location of cracks and give the width; it can realize the tracking and comparison of the developing trend of target cracks in different time periods; it can take wide-angle images and freely combine high-resolution images and stitch multiple pictures together for processing. The specific parameters are shown in Tab. 1.

Collecting Surface Crack Images of Concrete Specimens
After the loading test, cracks appeared on concrete beam member surface, the ACTIS digital imaging system was used to take pictures of the concrete beam, the cracks were marked, and after comparison, crack No. 1 was selected as the object of study, as shown in Fig. 2.
It can be seen from Fig. 2 that the image of crack No. 1 contains some micro noise, and the background gray level is not uniform due to uneven local illumination and color change of the concrete surface, which brings some difficulties to the crack recognition. The No. 1 crack was manually measured, and the length of the No. 1 crack was measured to be 203.23 mm.

ACTIS System Crack Identification
The following two experimental schemes are used to test the impact of distance and focal length on crack identification in order to obtain the best distance and the best focal length of the ACTIS system for crack identification.   The results of automatic crack extraction software for photo crack recognition are shown in Fig. 5. It can be seen from the figure that when the detection distance is 8 m, the ACTIS system has good crack recognition ability. In the range of 10~20 m, the length of extracting cracks does not change much. After distance is more than 40 m, the accuracy of crack recognition decreases, and the lens needs to be replaced for shooting to improve the quality of photos.
2. The crack length identification with different focal lengths when the shooting distance is 8 m is shown in Fig. 6, and the identified length is shown in Tab. 3.
The concrete crack automatic detection system is used to identify the crack No. 1 selected in the photo of Fig. 6, and the crack length identification of different focal lengths is shown in Fig. 7, and the identified length is shown in Tab. 2.
It can be seen from Fig. 8 that when the shooting distance is 8 m, the crack recognition effect is the best when the focal length is 300.
In summary, the crack identification length of the ACTIS system is smaller than the actual length. This is caused by the fact that the gray level at the top of the No. 1 crack is highly similar to the gray level at the bottom of the image background and there are many micro noises in the image.
For the problem of insufficient accuracy of the ACTIS concrete automatic detection system, this paper has proposed a maximum entropy threshold block segmentation method, to solve the problem of uneven background gray level caused by uneven local illumination and color change of concrete surface.

Concrete Beam Crack Recognition Based on Block Image Segmentation
The algorithm steps proposed in this paper are as shown in Fig. 9. After the graying processing of the image input, the whole image processing algorithm is composed of five steps.
Step 1: The median filtering method is used to suppress the most micro noise; Step 2: The crack image is divided into blocks reasonably to reduce the effect of local uneven background gray level; Step 3: The pixels in block areas of the image are studied in turn, and the image blocks that need to be segmented and those that do not need to be segmented are successively distinguished according to the gray level change of the pixels so as to improve the speed of crack recognition; Step 4: Image segmentation of the selected blocks is made with the 2D maximum entropy threshold segmentation method to obtain the initial shape of the crack; Step 5: The pseudo-cracks are removed in binarized image by connected domain recognition and screening to increase the proportion of the real cracks in the binarized images.

Image Segmentation Processing
The new algorithm first divides the image into blocks. The principle is that the crack is distributed in one line or one row of blocks. In this experiment, the crack image was divided into 6 × 6 blocks. As shown in Fig. 10.
After image segmentation, the new algorithm examines the pixels in the blocks of the image in sequence. First, the image blocks that need to be segmented and those that do not need to be segmented (those only with background) were successively distinguished according to the gray level change of the pixels, and then segmentation was made with high threshold value for high gray image blocks, and with low threshold value for low gray image blocks.

Distinguishing Image Blocks
The algorithm in this paper uses the maximum interclass average gray difference method to judge which image block should be segmented. When there is only background or only target in the image, the average gray difference will be small; when there is both background and target in the image, the average gray difference will be large; and the filtered-out image blocks containing only background need not be segmented. First, the Otsu method was used to calculate the optimal threshold T corresponding to each block, as shown in Fig. 11.
The maximum interclass average gray difference of each block is calculated by using T. The basic idea of maximum interclass average gray difference is as follows: Suppose the number of pixels in the image is N, the gray value corresponds to [0, L -1], and the number of pixels corresponding to gray level i is N i , so its probability is: In formula (1), Pixels in the image are divided into target (represented by C 1 ) and the background (represented by C 2 ) by threshold T according to the gray value, where the gray value range of target is [0,T] and the gray value range of background is T þ 1; L À 1 ½ , and then we get: The average gray value of C 1 is   The average gray value of C 2 is where, Finally, the obtained mathematical expression of the interclass gray difference Δm is: The threshold value of each block obtained by Otsu method and the average gray difference of blocks obtained by maximum interclass average gray difference method are as shown in Fig. 12. It can be seen that the average gray difference is large in a block with background only. In this crack image, gray difference 17 can well distinguish the two different kinds of blocks.

Image Segmentation
After the segmentation of the image and the classification of the segmented blocks, the 2D maximum entropy threshold segmentation method was adopted for blocks with large average gray difference, and the principle of this method is as follows: The 2D maximum entropy threshold segmentation method is provided based on the 2D histogram of the image. The principle of 2D histogram of an image is different from that of one-dimensional histogram in that the gray value of pixels and the average gray value of its neighboring areas are considered simultaneously. The average gray value g(x,y) of the pixel area can be defined as [20][21][22]: The value of n is normally taken as 3. The average gray image f x; y ð Þ of the original image f x; y ð Þcan be obtained by processing the original image with this formula. A 2D histogram can be constructed with f x; y ð Þ and g x; y ð Þ. Generally speaking, a 2D histogram has at least two peak values. If the image is expressed with the gray level and the average gray value of neighboring area [f x; y ð Þ, g x; y ð Þ], and the image is segmented with the 2D vector (S, T), then the 2D thresholding function f S;T x; y ð Þ can be defined as [23]: Then the 2D gray level histogram is defined as follows: Suppose i is the corresponding gray value in f(x,y); j the corresponding gray value in g x; y ð Þ and R ij the corresponding frequency when the gray value of f x; y ð Þ is i and the gray value of g x; y ð Þ is j. then the combined probability density p ij can be defined as: and Then p ij È É is the 2D gray level histogram of the image f x; y ð Þ. Then the above image threshold segmentation vector (S, T) is used to divide the histogram into four parts. Based on the homomorphism, the target area and the background area account for the largest proportion, while the gray level of the pixels in the target area and the background areas is relatively uniform, and the gray value of the pixels is close to the average gray value of the neighboring area; in the borderline area of the target and the background, the gray value of the pixels is quite different from the average gray value of the neighboring area, the pixels of the target and the background are concentrated near the diagonal line, and the two peak values of the 2D histogram correspond respectively to the target and the background. Suppose that the target area and background area have different probability distributions, the posterior probability of the target area and background area is used to normalize other areas. In conjunction with the principle of one-dimensional maximum entropy, the discrete two-dimensional entropy is obtained: From the two-dimensional entropy functions of target and background, the total entropy function can be obtained as follows:

且 且
In formula (12), At the maximum value of ' s; t ð Þ, the optimal threshold vector s Ã ; t Ã ð Þof the image can be obtained: After the completion of image segmentation, the resulting image is as shown in Fig. 13:

Recognition and Screening of Connected Domain
As can be seen from Fig. 8, the result of image segmentation can accurately reflect the length and characteristics of crack No. 1. However, in this image, in addition to the crack and large damage points, there are many connected domains that interfere with crack recognition. These connected domains are caused by concrete surface stains and surface roughness. Then it is necessary to calculate and screen the parameters of the connected domains, and those meeting the requirement can be regarded as cracks. A crack is a thin and long target with a certain strike and continuity, and the judging parameters are as follows: (1) Area of the connected domain A 1 . The area of connected domains can be screened with the bwareaopen function of MATLAB. The area of the crack is normally larger than that of other noise zones, so a dimension threshold A* of the connected domain can be set, when the value of area A k ½ of connected domain k is greater than or equal to the value of A Ã , the connected domain can be retained. Otherwise, the connected domain can be deleted.
(2) Length-width ratio of minimum enclosing rectangle of connected domain R 1.
Length-width ratio of minimum enclosing rectangle can be obtained with the BoundingBox function in the regionprops function of MATLAB.
Rectangularity refers to the similarity between the shape of the target and the rectangle, reflecting how much the object fills into its minimum enclosing rectangle. The rectangularity varies with different objects ranging from 0 to 1 [15], and small and curved objects such as cracks have less rectangularity. Its calculation formula is: where A 2 is the area of the minimum enclosing rectangle.
The image obtained after connected domain screening is as shown in Fig. 14. It can be seen from the figure that noise points left are well eliminated after connected domain pre-processing.

Crack Length Measurement and Analysis
To determine the basic parameters of the crack (such as length and width), it is necessary to refine the preprocessed image to obtain the skeleton of the crack area [24]. In this paper, the bwmorph command flow in MATLAB is used to extract the skeleton and remove burrs from the image, and then the length of the skeleton is measured. The measurement principle is as follows: The target boundary is represented by the connected straight-line segments with specific lengths and directions, and the boundary is encoded. If the boundary chain code of the crack area is a 1 ; a 2 ; a 3 ; Á Á Á ; a n f g , and the length of the line segment obtained for each code segment a i is Dl i , then the length L of the area boundary is Þ¼n e þ ffiffi ffi 2 p n 0 (18) where, n is the total number of code segments in the chain code series; n e is the number of even code segments in the chain code series, and n o the number of odd code segments in the chain code series.
Combined with the camera settings (the focal length is 70 and measuring distance is 5 m), the length of crack No. 1 obtained in Fig. 9 is 205.62 mm. The comparative analysis between the algorithm results and the measurement results of the ACTIS system is shown in Tab. 4: As can be seen from Tab. 4, the algorithm in this paper has higher accuracy in measuring crack length.

Analysis of Comparison Results of Similar Algorithms
To fully prove the effectiveness of the new segmentation algorithm, crack pictures of different shapes were used for experiments, to compare the new segmentation algorithm of this paper with the block Otsu threshold segmentation method, global Otsu threshold segmentation method, global one-dimensional maximum entropy segmentation method, global two-dimensional maximum entropy segmentation method and local threshold segmentation algorithm Niblack method before the screening of connected domains. In the Niblack method, for each pixel of the image, the gray mean and variance of all points are calculated in the neighborhood window, and then the threshold value of each point is calculated by the following formula [25]: See  16(c) show that the images obtained from processing with Otsu segmentation method presents discontinuity due to the influence of rectangular block segmentation, and a lot of background is included in the white area. This shows that compared with the 2D maximum entropy method, the Otsu method cannot effectively distinguish the information of the target and the background.  Fig. 15(d)), or target as background (as shown in Fig. 15(e)), the global segmentation method cannot effectively solve the influence of uneven illumination and background gray level change on the accuracy of target recognition, and the same conclusion can be reached by analyzing the images in Fig. 16. 3. The comparisons of Figs. 15(b) with 15(f) and Figs. 16(b) with 16(f) show that Niblack local threshold segmentation method produces a lot of pseudo-noise when it is used to process a more complex crack recognition image, so it is difficult to extract the crack target directly in it. By contrast, the block 2D maximum entropy threshold segmentation method has greatly reduced the effect of noise.

Conclusions
This paper has proposed a new threshold value segmentation method for digital concrete crack images with complex background. In this method, the image is first divided into blocks to distinguish background with different gray level, followed by screening of the separated blocks with the maximum interclass average gray level difference method, then threshold segmentation is made for the image with the 2D maximum entropy threshold segmentation method, and finally, connected domain feature screening is made for the crack image. This algorithm can effectively reduce the influence of noise, solve the problem of uneven local illumination and change of background gray level, and extract the crack target features more accurately. Experimental results show that in the digital concrete crack image segmentation with a complex background, the segmentation results obtained by the algorithm in this paper are more accurate than those detected by the ACTIS system, and effectively reduces the over-segmentation and undersegmentation rates and highlights the characteristics of cracks, thus providing the basis and convenience for the subsequent data analysis in the health monitoring of concrete structures.