# Tunnel Lining Crack Recognition Based on Improved Multiscale Retinex and Sobel Edge Detection

Authors: Quanlei Wang; Ning Zhang; Kun Jiang; Chao Ma; Zhaochen Zhou; Chunquan Dai
Journal: Mathematical Problems in Engineering
 (2021)

---

## Abstract

China is gradually transitioning from the “tunnel construction era” to the “tunnel maintenance era,” and more and more operating tunnels need to be inspected for diseases. With the continuous development of computer vision, the automatic identification of tunnel lining cracks with computers has gradually been applied in engineering. On the basis of summarizing the weaknesses and strengths of previous studies, this paper first uses the improved multiscale Retinex algorithm to filter the collected tunnel crack images and introduces the eight-direction Sobel edge detection operator to extract the edges of the cracks. Perform mathematical morphological operations on the image after edge extraction, and use the principle of the smallest enclosing rectangle to remove the isolated points of the image. Finally, the performance of the algorithm is judged by the objective evaluation index of the image, the accuracy of crack recognition, and the running time of the algorithm. The image filtering algorithm proposed in this paper can better preserve the edges of the image while enhancing the image. The objective evaluation indexes of the image have been improved significantly, and the main body of the crack can be accurately identified. The overall crack recognition accuracy rate can reach 97.5%, which is higher than the existing tunnel lining crack recognition algorithm, and the average calculation time for each image is shorter. This algorithm has high research significance and engineering application value.


---

## Body

## 1. Introduction

Tunnels are an important part of the road and railway transportation network. With the continuous increase in the mileage of roads and railways in China, and due to the aging of the structure itself, a large number of tunnels have gradually entered the maintenance period. The tunnel itself is faced with its own structural aging and damage from external factors. Among many tunnel diseases, lining cracks are one of the fundamental problems that endanger the safe operation of the tunnel. It will not only affect the durability of the lining structure, but may even endanger the safety of the structure itself and cause major losses. If tunnel cracks are discovered and repaired in time at the initial stage, the probability of serious consequences will be greatly reduced. At present, manual detection is still the main way to find tunnel cracks, but this method is low in efficiency, is low in detection accuracy, and consumes a lot of manpower and material resources, and the overall detection effect is not satisfactory. With the development of tunnel inspection vehicles, it is possible to use a vehicle-mounted CCD camera to take pictures of the lining of a tunnel in a short time. Then, according to the obtained tunnel lining image, a detection method based on computer vision is used to identify the cracks in the image. Compared with the artificial tunnel crack detection method, the crack detection method based on computer vision has the advantages of fast recognition speed and high detection accuracy and has been widely used in tunnel crack detection [1–3].Scholars at home and abroad have conducted a lot of research on the identification of tunnel lining cracks and have achieved satisfactory results. Li et al. [4] analyzed the existing problems of the existing tunnel crack detection system and creatively applied the latest technology to the moving train, which can realize the tunnel lining crack identification when the train speed is 50 km/h, but the overall crack identification accuracy is not high. In order to better identify and analyze cracks, Shi et al. [5] proposed an analysis method based on crack width characteristics, which greatly reduces the interference of “false cracks” and improves the accuracy of crack identification. Jang et al. [6] proposed a hybrid image autonomous concrete crack detection technology based on deep learning. The hybrid image combined with visual and infrared thermal imaging can improve the detection ability and detection accuracy of cracks. Win and Thein [7] proposed a related reverse method to identify the location and size of cracks in concrete structures. Nhat-Duc and Peir [8] used a gray intensity adjustment method called Min-Max Gray Level Discrimination (M2GLD) to automatically identify and analyze cracks. Jia et al. [9] proposed a multiscale spatial tunnel lining crack water leakage identification method based on point cloud images and proposed a fusion image detection operator, which can maintain the stability of band-shaped crack image detection. Existing various edge detection algorithms are not satisfactory for image recognition results, and the time and accuracy of crack extraction need to be further improved. Zhu et al. [10] realized the accurate identification of tunnel cracks by fusing the template-based analysis method, the linear structure analysis method based on Hough transform, and the approximate crack structure analysis method based on support vector machine, but the algorithm took a long time. Dai et al. [11] used improved homomorphic filtering to process the collected images and used the XDoG edge extraction method to extract the edges of the cracks in the image. Practice has proved that this method has the advantage of fast calculation speed. On the basis of structural similarity, Yan et al. [12] proposed an image quality evaluation method based on convolution filtering and gradient structural similarity. This method can obtain better evaluation results for dithered and blurred lining images with cracks. Although the existing image preprocessing methods are basically perfect, there are still environments with poor tunnel lighting, and image recognition needs to be enhanced.In response to insufficient illumination and uneven illumination, Song et al. [13] proposed a multiscale joint low-light enhancement network based on Retinex theory to effectively solve the problems of noise amplification and color distortion. Sun et al. [14] proposed a nonuniform illumination correction algorithm based on multiscale Retinex, which enhanced the measurement accuracy of DIC. Wang et al. [15] designed a low-light image enhancement optimization algorithm based on frame accumulation and multiscale Retinex joint processing; this algorithm improves the overall quality of the image to a certain extent. For the problem of occurrence of halation and overenhancement, Ping et al. [16] fused Gabor filtering with Retinex theory. In order to solve the light scattering in the water and the interference of the impurities in the water on the light propagation, Huang et al. [17] combined the color correction method with the deblurring network, which can better eliminate the blur and enhance the details. Liu et al. [18] used MSRCR and guided filtering methods for defogging and proposed a white balance fusion global guided image filtering (G-GIF) method, which effectively solved the problem of edge detail loss.Although the existing image preprocessing methods are basically perfect, there is still a lack of image filtering methods for the environment with poor tunnel illumination. Various existing edge detection algorithms are not satisfactory for image recognition results, and there are often more false cracks and noises, which affect the final recognition results of cracks. The time and accuracy of crack extraction need to be further improved. Based on the abovementioned problems, this paper proposes a new tunnel lining crack identification algorithm based on improved multiscale Retinex and Sobel edge detection.


## 2. Basic Principles of Retinex Algorithm

In 1978, Land [19] first proposed the calculation theory of color constancy perception, also known as the Retinex theory. Different from traditional linear and nonlinear methods that can only enhance a certain type of image feature, Retinex can strike a balance between dynamic range compression, edge enhancement, and color constancy. Therefore, various different types of images can be adaptively enhanced.


### 2.1. Single-Scale Retinex (SSR)

The Retinex theory can divide the imageIx,y into two parts, namely, the incident component Lx,y and the reflected component Rx,y [20]. The imaging principle of the Retinex algorithm is shown in Figure 1. For a certain image, the relationship between the three can be expressed in the following formula:(1)Ix,y=Lx,y⋅Rx,y.Figure 1
Retinex algorithm imaging principle diagram.The basic principle of the Retinex algorithm is to estimate the reflected component through the incident component and then achieve the purpose of image enhancement. In 1997, Jobson improved the Retinex algorithm and proposed the SSR algorithm [21]. The basic idea of the single-scale Retinex algorithm consists of three steps. The first step is to construct a Gaussian surround function and then use the constructed function to filter the three color channels of R, G, and B of the color image. The filtered image is the incident component we estimated. The third step is to subtract the incident component from the original image in the logarithmic domain, and the data obtained is the reflection component, and the reflection component is the output result image. The formula of the SSR algorithm is shown in the following formula:(2)Rix,y=logIix,yLix,y=logIix,y−logFx,y∗Iix,y.In formula (2), i represents the color channel in the color model. Iix,y represents the low-light image input by the first i color channel. Rix,y represents the output of the first i channel after single-scale Retinex processing. ∗ stands for convolution operation. Fx,y represents a Gaussian wraparound function, and its function expression is usually as shown in the following equation:(3)Fx,y=λe−x2+y2/c2.In formula (3), where λ is the normalization coefficient, since the integral of Fx,y is always equal to one, therefore, λ can be obtained by calculation. c is the scale constant of the wrap function.


### 2.2. Multiscale Retinex Algorithm (MSR)

Since the single-scale Retinex algorithm selects Gaussian function as the number of traverse segments, the enhanced image cannot simultaneously guarantee a large-scale compression of dynamic range and contrast intensity. In order to balance the two enhancement effects, a very accurate scale constantc must be selected. Therefore, the SSR algorithm usually cannot obtain satisfactory processing results.In view of the shortcoming of the single-scale Retinex algorithm, some scholars have proposed the multiscale Retinex algorithm [22, 23]. Compared with the single-scale Retinex, the multiscale Retinex algorithm can take into account the two characteristics of dynamic range compression and image contrast. The MSR algorithm is a linear weighted summation of the single-scale Retinex algorithm, and its specific expression is shown in the following formula:(4)Rix,y=∑k=1NWklogIix,y−logFkx,y∗Iix,y.In formula (4), Wk is the weight of different scales, satisfying ∑k=1NWk=1. k represents the number of scales of the wrapping function, and the general value is 3, which represents three scales of small, medium, and large. Fkx,y represents the wraparound function at scale ck.


### 2.3. The Improved MSR Algorithm

The traditional MSR algorithm uses a Gaussian function as the surround function, but because the Gaussian operator cannot estimate the illumination well in the transition zone, when the illumination changes greatly, a halo phenomenon will occur, which will weaken the image and affect the enhancement effect of the image. Therefore, this paper chooses to use bilateral filter function instead of the original Gaussian wrap function [24]. Compared with the Gaussian function, bilateral filtering can enhance the spatial domain while maintaining the smoothness of the time domain, which can better solve the problem of misjudgment of the Gaussian function. The edge information of the image can also be preserved, so that the obtained image is more continuous and smooth, and it can also solve the halo problem caused by the Gaussian function to a certain extent. The function of bilateral filtering is(5)f′x,y=∑m,n∈Ωp,x,ywdm,nfm,nwrm,n∑m,n∈Ωp,x,ywdm,nwrm,n,wdm,n=e−x−m2+y−n22σd2,wrm,n=e−fx,y−fm,n22σr2.Among them,fm,n and f′x,y are the input image and the filtered image, respectively. wdm,n and wrm,n are the spatial domain kernel function and value function. σd and σr are the spatial distance difference scale parameter and the pixel difference scale parameter. Ωp,x,y is the set of pixels with the center of x,y in the input image, and the radius of 2p+1. p is the filter radius, and the larger the p, the larger the filter interval, and the more complicated the calculation process.


#### 2.3.1. Gamma Correction

Gamma correction on the image after bilateral filtering can make the transformed image more natural. The specific expression form of gamma correction is shown in the following formula:(6)L′x,y=Lγx,y.Among them,L′x,y represents the incident component after gamma correction. γ is the gamma coefficient. If γ>1, the overall image becomes brighter; if γ<1, the overall image becomes darker; if γ=1, the image does not change.


#### 2.3.2. Sigmoid Function

The sigmoid function can simulate the nonlinear and local characteristics of human vision to a certain extent and has good local details and dynamic range compression capabilities [25]. Assuming that the low-illuminance image Ix,y can be obtained by multiplying the actual image Sx,y and the interference term Nx,y, the expression is shown in the following equation:(7)Ix,y=Sx,y⋅Nx,y.Using the Sigmoid function to stretch the contrast of the reflected image can enhance the contrast of the image and make the processed image more visible. The formula is shown in the following formula:(8)Iki,j=Sf2i,jf1i,j+Sf3i,jf2i,j+⋯+Sf254i,jf253i,j+Sf255i,jf254i,j.When the brightness component of the image is enhanced, the saturation of the image is lower. In order to make the image color more full, the saturation of the image needs to be stretched. However, because the tunnel images obtained under different lighting conditions have certain differences, the corresponding saturation processing levels must also be different. This paper proposes an adaptive nonlinear stretching algorithm for saturation components, and the formula is shown in the following equation:(9)S′=1+meanR,G,BmaxR,G,B+minR,G,B+1S.Among them,S′ and S represent the saturation of the image after stretching and before stretching, respectively. meanR,G,B, maxR,G,B and minR,G,B are, respectively, the average value, maximum value, and minimum value of the (R, G, B) color component of the corresponding pixel of the image.The overall flow of the algorithm in this paper is shown in Figure2. First, extract the RGB three color channels of the image, and then convert the RGB color space to the HSV color space, and the H channel remains unchanged. The S channel is adaptively enhanced. The V channel first uses the improved MSR algorithm for image filtering. Then, use the gamma function for color correction. Finally, the HSV space is converted back to the RGB space, and Sigmoid function is used to improve the reflection component and enhance image details. So, we got the image preprocessing result. Next, the Sobel edge detection algorithm is used to detect the edges and remove the independent points in the image to make the crack shape more complete.Figure 2
The overall flowchart of the algorithm.


### 2.4. Analysis of Filtering Results

The improved MSR algorithm proposed in this paper is compared with the SSR algorithm and the MSR algorithm, and the obtained tunnel low-illuminance image comparison chart is shown in Figure3.Figure 3
Comparison of filtering effects. (a) Original image. (b) SSR algorithm. (c) MSR algorithm. (d) MSR-B algorithm.
(a)(b)(c)(d)It can be seen clearly from Figure3 that the filtering results after different types of Retinex algorithms can be seen. The three filtered images can improve the brightness and contrast of the image to a certain extent. However, the algorithm proposed in this paper (MSR-B) keeps the boundary of the image obtained by the SSR algorithm and the MSR algorithm clearer and can better highlight the tunnel cracks and maintain the details of the cracks.


## 2.1. Single-Scale Retinex (SSR)

The Retinex theory can divide the imageIx,y into two parts, namely, the incident component Lx,y and the reflected component Rx,y [20]. The imaging principle of the Retinex algorithm is shown in Figure 1. For a certain image, the relationship between the three can be expressed in the following formula:(1)Ix,y=Lx,y⋅Rx,y.Figure 1
Retinex algorithm imaging principle diagram.The basic principle of the Retinex algorithm is to estimate the reflected component through the incident component and then achieve the purpose of image enhancement. In 1997, Jobson improved the Retinex algorithm and proposed the SSR algorithm [21]. The basic idea of the single-scale Retinex algorithm consists of three steps. The first step is to construct a Gaussian surround function and then use the constructed function to filter the three color channels of R, G, and B of the color image. The filtered image is the incident component we estimated. The third step is to subtract the incident component from the original image in the logarithmic domain, and the data obtained is the reflection component, and the reflection component is the output result image. The formula of the SSR algorithm is shown in the following formula:(2)Rix,y=logIix,yLix,y=logIix,y−logFx,y∗Iix,y.In formula (2), i represents the color channel in the color model. Iix,y represents the low-light image input by the first i color channel. Rix,y represents the output of the first i channel after single-scale Retinex processing. ∗ stands for convolution operation. Fx,y represents a Gaussian wraparound function, and its function expression is usually as shown in the following equation:(3)Fx,y=λe−x2+y2/c2.In formula (3), where λ is the normalization coefficient, since the integral of Fx,y is always equal to one, therefore, λ can be obtained by calculation. c is the scale constant of the wrap function.


## 2.2. Multiscale Retinex Algorithm (MSR)

Since the single-scale Retinex algorithm selects Gaussian function as the number of traverse segments, the enhanced image cannot simultaneously guarantee a large-scale compression of dynamic range and contrast intensity. In order to balance the two enhancement effects, a very accurate scale constantc must be selected. Therefore, the SSR algorithm usually cannot obtain satisfactory processing results.In view of the shortcoming of the single-scale Retinex algorithm, some scholars have proposed the multiscale Retinex algorithm [22, 23]. Compared with the single-scale Retinex, the multiscale Retinex algorithm can take into account the two characteristics of dynamic range compression and image contrast. The MSR algorithm is a linear weighted summation of the single-scale Retinex algorithm, and its specific expression is shown in the following formula:(4)Rix,y=∑k=1NWklogIix,y−logFkx,y∗Iix,y.In formula (4), Wk is the weight of different scales, satisfying ∑k=1NWk=1. k represents the number of scales of the wrapping function, and the general value is 3, which represents three scales of small, medium, and large. Fkx,y represents the wraparound function at scale ck.


## 2.3. The Improved MSR Algorithm

The traditional MSR algorithm uses a Gaussian function as the surround function, but because the Gaussian operator cannot estimate the illumination well in the transition zone, when the illumination changes greatly, a halo phenomenon will occur, which will weaken the image and affect the enhancement effect of the image. Therefore, this paper chooses to use bilateral filter function instead of the original Gaussian wrap function [24]. Compared with the Gaussian function, bilateral filtering can enhance the spatial domain while maintaining the smoothness of the time domain, which can better solve the problem of misjudgment of the Gaussian function. The edge information of the image can also be preserved, so that the obtained image is more continuous and smooth, and it can also solve the halo problem caused by the Gaussian function to a certain extent. The function of bilateral filtering is(5)f′x,y=∑m,n∈Ωp,x,ywdm,nfm,nwrm,n∑m,n∈Ωp,x,ywdm,nwrm,n,wdm,n=e−x−m2+y−n22σd2,wrm,n=e−fx,y−fm,n22σr2.Among them,fm,n and f′x,y are the input image and the filtered image, respectively. wdm,n and wrm,n are the spatial domain kernel function and value function. σd and σr are the spatial distance difference scale parameter and the pixel difference scale parameter. Ωp,x,y is the set of pixels with the center of x,y in the input image, and the radius of 2p+1. p is the filter radius, and the larger the p, the larger the filter interval, and the more complicated the calculation process.


### 2.3.1. Gamma Correction

Gamma correction on the image after bilateral filtering can make the transformed image more natural. The specific expression form of gamma correction is shown in the following formula:(6)L′x,y=Lγx,y.Among them,L′x,y represents the incident component after gamma correction. γ is the gamma coefficient. If γ>1, the overall image becomes brighter; if γ<1, the overall image becomes darker; if γ=1, the image does not change.


### 2.3.2. Sigmoid Function

The sigmoid function can simulate the nonlinear and local characteristics of human vision to a certain extent and has good local details and dynamic range compression capabilities [25]. Assuming that the low-illuminance image Ix,y can be obtained by multiplying the actual image Sx,y and the interference term Nx,y, the expression is shown in the following equation:(7)Ix,y=Sx,y⋅Nx,y.Using the Sigmoid function to stretch the contrast of the reflected image can enhance the contrast of the image and make the processed image more visible. The formula is shown in the following formula:(8)Iki,j=Sf2i,jf1i,j+Sf3i,jf2i,j+⋯+Sf254i,jf253i,j+Sf255i,jf254i,j.When the brightness component of the image is enhanced, the saturation of the image is lower. In order to make the image color more full, the saturation of the image needs to be stretched. However, because the tunnel images obtained under different lighting conditions have certain differences, the corresponding saturation processing levels must also be different. This paper proposes an adaptive nonlinear stretching algorithm for saturation components, and the formula is shown in the following equation:(9)S′=1+meanR,G,BmaxR,G,B+minR,G,B+1S.Among them,S′ and S represent the saturation of the image after stretching and before stretching, respectively. meanR,G,B, maxR,G,B and minR,G,B are, respectively, the average value, maximum value, and minimum value of the (R, G, B) color component of the corresponding pixel of the image.The overall flow of the algorithm in this paper is shown in Figure2. First, extract the RGB three color channels of the image, and then convert the RGB color space to the HSV color space, and the H channel remains unchanged. The S channel is adaptively enhanced. The V channel first uses the improved MSR algorithm for image filtering. Then, use the gamma function for color correction. Finally, the HSV space is converted back to the RGB space, and Sigmoid function is used to improve the reflection component and enhance image details. So, we got the image preprocessing result. Next, the Sobel edge detection algorithm is used to detect the edges and remove the independent points in the image to make the crack shape more complete.Figure 2
The overall flowchart of the algorithm.


## 2.3.1. Gamma Correction

Gamma correction on the image after bilateral filtering can make the transformed image more natural. The specific expression form of gamma correction is shown in the following formula:(6)L′x,y=Lγx,y.Among them,L′x,y represents the incident component after gamma correction. γ is the gamma coefficient. If γ>1, the overall image becomes brighter; if γ<1, the overall image becomes darker; if γ=1, the image does not change.


## 2.3.2. Sigmoid Function

The sigmoid function can simulate the nonlinear and local characteristics of human vision to a certain extent and has good local details and dynamic range compression capabilities [25]. Assuming that the low-illuminance image Ix,y can be obtained by multiplying the actual image Sx,y and the interference term Nx,y, the expression is shown in the following equation:(7)Ix,y=Sx,y⋅Nx,y.Using the Sigmoid function to stretch the contrast of the reflected image can enhance the contrast of the image and make the processed image more visible. The formula is shown in the following formula:(8)Iki,j=Sf2i,jf1i,j+Sf3i,jf2i,j+⋯+Sf254i,jf253i,j+Sf255i,jf254i,j.When the brightness component of the image is enhanced, the saturation of the image is lower. In order to make the image color more full, the saturation of the image needs to be stretched. However, because the tunnel images obtained under different lighting conditions have certain differences, the corresponding saturation processing levels must also be different. This paper proposes an adaptive nonlinear stretching algorithm for saturation components, and the formula is shown in the following equation:(9)S′=1+meanR,G,BmaxR,G,B+minR,G,B+1S.Among them,S′ and S represent the saturation of the image after stretching and before stretching, respectively. meanR,G,B, maxR,G,B and minR,G,B are, respectively, the average value, maximum value, and minimum value of the (R, G, B) color component of the corresponding pixel of the image.The overall flow of the algorithm in this paper is shown in Figure2. First, extract the RGB three color channels of the image, and then convert the RGB color space to the HSV color space, and the H channel remains unchanged. The S channel is adaptively enhanced. The V channel first uses the improved MSR algorithm for image filtering. Then, use the gamma function for color correction. Finally, the HSV space is converted back to the RGB space, and Sigmoid function is used to improve the reflection component and enhance image details. So, we got the image preprocessing result. Next, the Sobel edge detection algorithm is used to detect the edges and remove the independent points in the image to make the crack shape more complete.Figure 2
The overall flowchart of the algorithm.


## 2.4. Analysis of Filtering Results

The improved MSR algorithm proposed in this paper is compared with the SSR algorithm and the MSR algorithm, and the obtained tunnel low-illuminance image comparison chart is shown in Figure3.Figure 3
Comparison of filtering effects. (a) Original image. (b) SSR algorithm. (c) MSR algorithm. (d) MSR-B algorithm.
(a)(b)(c)(d)It can be seen clearly from Figure3 that the filtering results after different types of Retinex algorithms can be seen. The three filtered images can improve the brightness and contrast of the image to a certain extent. However, the algorithm proposed in this paper (MSR-B) keeps the boundary of the image obtained by the SSR algorithm and the MSR algorithm clearer and can better highlight the tunnel cracks and maintain the details of the cracks.


## 3. Image Edge Extraction

### 3.1. Edge Extraction of Eight-Direction Sobel Operator

The Sobel operator based on eight directions performs edge detection on the image in the eight directions of0°, 22.5°, 45°, 67.5°, 90°, 112.5°, 135°, and 157.5° (counterclockwise rotation along the X axis). Through the convolution operation of the operator template in each direction with each pixel, the foreground characteristic color is given to the pixel, whose operation value exceeds a certain threshold. Finally, the feature pixels in the eight directions are gathered into the same image, and then the final Sobel operator detection image is obtained [26]. The operator can be divided into eight according to the direction of the template, and the detection template is shown in Figure 4. The final test result is shown in Figure 5.Figure 4
Sobel detection template in eight directions.
(a)(b)(c)(d)(e)(f)(g)(h)Figure 5
Sobel test results.


### 3.2. Removal of Isolated Edges of Cracks

The principle of the minimum enclosing rectangle is to use a rectangle of a certain size and position to exactly completely contain the edge of an object in the image. The rectangle usually refers to the rectangle defined by the largest and smallest abscissas and the largest and smallest ordinates in the image object area as its smallest enclosing rectangle, and then judging whether there are other rectangles in the neighborhood of each enclosing rectangle to determine whether it is an isolated edge.The specific process of the algorithm is usually as follows: (1) first, perform the morphological expansion operation on the image, which can realize the initial merging of the tiny holes in the image and the connected areas. (2) Obtain the smallest bounding rectangle of all connected regions. (3) Taking the smallest circumscribed rectangle of a connected domain as the center, judge whether there are other adjacent circumscribed rectangles in the size of its eight-neighborhood template; if not, define it as an isolated point and discard it. If there are other circumscribed rectangles, they are judged as nonisolated points. (4) Eliminate the small circumscribed rectangle with less than 50 white pixels in the circumscribed rectangle in the image, after the expansion operation is carried out, and the crack image determined by the isolated point is shown in Figure6.Figure 6
Removal of isolated areas.As shown in Figure6, the eight neighborhoods of Sector 3 and Sector 4 do not contain other circumscribed rectangles, so they are judged as isolated edges and discarded. However, Sector 1 and Sector 2 are nonisolated points, and the algorithm is reserved. It can be seen from Table 1 that after removing the isolated edges of the cracks, the number of noncharacteristic pixels can be reduced by 27%, and the final proportion of the number of cracks can reach 94%. The number of noise points in the image is obviously reduced, and the crack skeleton roughly appears.Table 1
Comparison of information on the removal of isolated points of cracks.
OperationTotal number of feature extractionsCrack feature recognition numberProportion of fracture characteristics (%)Before the algorithm144801025370.8After the algorithm10562993094.1


### 3.3. Breakpoint Connection and Image Filling

The crack skeleton usually has a certain degree of discontinuity, and the crack image after the edge is extracted by the Sobel edge detection operator does not conform to the actual situation, so the crack needs to be filled. The direction vector crack connection algorithm proposed in the literature [3] is used to connect the broken points of the processed image, and the final result is shown in Figure 7. Then, fill the upper and lower white edges of Figure 7 as a whole. The specific effect is shown in Figure 8. It can be seen from Figures 7 and 8 that, after the breakpoint connection and crack filling operations, the crack image can already be identified, which can lay the foundation for other subsequent steps.Figure 7
Crack breakpoint connection.Figure 8
Overall crack filling.


## 3.1. Edge Extraction of Eight-Direction Sobel Operator

The Sobel operator based on eight directions performs edge detection on the image in the eight directions of0°, 22.5°, 45°, 67.5°, 90°, 112.5°, 135°, and 157.5° (counterclockwise rotation along the X axis). Through the convolution operation of the operator template in each direction with each pixel, the foreground characteristic color is given to the pixel, whose operation value exceeds a certain threshold. Finally, the feature pixels in the eight directions are gathered into the same image, and then the final Sobel operator detection image is obtained [26]. The operator can be divided into eight according to the direction of the template, and the detection template is shown in Figure 4. The final test result is shown in Figure 5.Figure 4
Sobel detection template in eight directions.
(a)(b)(c)(d)(e)(f)(g)(h)Figure 5
Sobel test results.


## 3.2. Removal of Isolated Edges of Cracks

The principle of the minimum enclosing rectangle is to use a rectangle of a certain size and position to exactly completely contain the edge of an object in the image. The rectangle usually refers to the rectangle defined by the largest and smallest abscissas and the largest and smallest ordinates in the image object area as its smallest enclosing rectangle, and then judging whether there are other rectangles in the neighborhood of each enclosing rectangle to determine whether it is an isolated edge.The specific process of the algorithm is usually as follows: (1) first, perform the morphological expansion operation on the image, which can realize the initial merging of the tiny holes in the image and the connected areas. (2) Obtain the smallest bounding rectangle of all connected regions. (3) Taking the smallest circumscribed rectangle of a connected domain as the center, judge whether there are other adjacent circumscribed rectangles in the size of its eight-neighborhood template; if not, define it as an isolated point and discard it. If there are other circumscribed rectangles, they are judged as nonisolated points. (4) Eliminate the small circumscribed rectangle with less than 50 white pixels in the circumscribed rectangle in the image, after the expansion operation is carried out, and the crack image determined by the isolated point is shown in Figure6.Figure 6
Removal of isolated areas.As shown in Figure6, the eight neighborhoods of Sector 3 and Sector 4 do not contain other circumscribed rectangles, so they are judged as isolated edges and discarded. However, Sector 1 and Sector 2 are nonisolated points, and the algorithm is reserved. It can be seen from Table 1 that after removing the isolated edges of the cracks, the number of noncharacteristic pixels can be reduced by 27%, and the final proportion of the number of cracks can reach 94%. The number of noise points in the image is obviously reduced, and the crack skeleton roughly appears.Table 1
Comparison of information on the removal of isolated points of cracks.
OperationTotal number of feature extractionsCrack feature recognition numberProportion of fracture characteristics (%)Before the algorithm144801025370.8After the algorithm10562993094.1


## 3.3. Breakpoint Connection and Image Filling

The crack skeleton usually has a certain degree of discontinuity, and the crack image after the edge is extracted by the Sobel edge detection operator does not conform to the actual situation, so the crack needs to be filled. The direction vector crack connection algorithm proposed in the literature [3] is used to connect the broken points of the processed image, and the final result is shown in Figure 7. Then, fill the upper and lower white edges of Figure 7 as a whole. The specific effect is shown in Figure 8. It can be seen from Figures 7 and 8 that, after the breakpoint connection and crack filling operations, the crack image can already be identified, which can lay the foundation for other subsequent steps.Figure 7
Crack breakpoint connection.Figure 8
Overall crack filling.


## 4. Algorithm Evaluation

The algorithm in this paper is based on Intel (R) Core (TM) i5-5200U CPU @ 2.20 GHz, memory is 8.00 GB, operating system is Windows 8.1 Chinese version system, and Matlab R2016a is used for simulation experiment.


### 4.1. Improved Retinex Algorithm Evaluation

The objective evaluation criteria of image enhancement effect usually include three objective indicators of peak signal-to-noise ratio (PSNR), information entropy, and contrast. Generally speaking, the larger the peak signal-to-noise ratio, the smaller the distortion of the image. Information entropy represents the amount of image information. Generally speaking, the higher the image information entropy, the greater the information entropy, and the more complete the image edges maintained. Contrast can better reflect the relationship between tunnel cracks and concrete lining in the image, and it can also be said that the image is more in line with the intuitive visual effect of the human eye.


#### 4.1.1. Peak Signal-to-Noise Ratio (PSNR)

The formula for calculating the peak signal-to-noise ratio is shown in equations (10) and (11):(10)MSE=1mn∑i=1m∑j=1nXi,j−Yi,j2,(11)PSNR=10log102n−12MSE,where MSE represents the mean square error of the current image X and the reference image Y; m and n are the height and width of an image, respectively; n is the number of bits per pixel, generally taken as 8; that is, the pixel grayscale is 256.


#### 4.1.2. Information Entropy

Entropy is the information entropy of the image, which describes the average amount of information that the image wants. The entropy is also large. The clearer the image texture, the richer the color. The definition of entropy is shown in the following formula:(12)Hp=−∑i=0255pilogpi.Among them,pi represents the probability of each gray level i appearing.


#### 4.1.3. Image Contrast

The calculation formula of contrast is shown in the following formula:(13)C=∑δδi,jPδi,j.Among them,δi,j=i−j is the grayscale difference between adjacent pixels. Pδi,j is the pixel distribution probability, where the grayscale difference between adjacent pixels is δ.


#### 4.1.4. Comparison of Recognition Results

Calculate the peak signal-to-noise ratio, information entropy, and image comparison chart of the four images in Figure3, respectively, and the calculation results are shown in Table 2.Table 2
Objective quality evaluation of each algorithm.
AlgorithmPSNREntropyContrastOriginal image91.494.1959.15SSR94.564.9389.11MSR95.384.9586.85MSR-B algorithm105.305.32126.42It can be clearly seen from Table2 that the algorithm in this paper has a large improvement in PSNR, information entropy, and image contrast, and all surpass the SSR algorithm and the MSR algorithm. The obtained image is clearer, the boundary preservation is more obvious, and the image information is richer, which proves the superiority of the image filtering algorithm proposed in this paper.


### 4.2. Evaluation of Crack Identification Effect

Compare the cracks that can be recognized by the human eye in the original image with the cracks that the computer automatically recognizes. The part of the crack contour drawn manually in the original image is shown in red in Figure9, all the correct pixels are marked as Pt, and the other redundant parts in Figure 9 are represented in green in the original image, marked as Pf. The total number of pixels is denoted by N.Figure 9
Comparison of recognition results.The calculation formula of the recognition accuracy rateP is shown in formula (14). After calculating multiple images, it can be seen that the accuracy of crack identification in this paper is approximately 80.4%; that is, the main body of the crack can be fully identified, but there is a certain identification error. The overall recognition effect is good:(14)P=PtN×100%.In order to verify the accuracy of the algorithm, 200 tunnel crack images were randomly selected from the gallery for identification. If the cracks in the image can be completely identified, the identification is considered successful; otherwise, the identification fails. The image of cracks on the surface of ordinary concrete is selected for comparison with the cracks of the bridge, and the recognition results are shown in Table3.Table 3
Comparison of the accuracy of crack recognition.
Test objectQuantityRecognition rate (%)Concrete crack20099.0Tunnel lining crack20097.5Bridge crack20092.0From the comparison in Table3, it can be seen that the accuracy of the proposed tunnel lining crack recognition image in this paper can reach 97.5%, which is higher than other existing algorithms. The recognition effect of ordinary concrete surface cracks is also very good, which may be due to the better light obtained when collecting ordinary concrete surface cracks, and there is basically no other noise interference. However, the accuracy of identifying bridge cracks is still low. The bridge cracks here do not refer to the cracks in the asphalt pavement of the bridge, but the wings and piers of the bridge superstructure. These parts usually need to be added with waterproof paint, and there may be part of the paint peeling off in the obtained crack image, which leads to low recognition accuracy. The recognition rate of ordinary concrete crack images is higher than that of tunnel lining crack images, and bridge crack images have a certain relationship with light intensity. When the light is strong or weak, it will significantly affect the imaging of the crack edge and then have a greater impact on the identification of the crack width. After testing, when the light intensity is in the range of 1400–3100lux, the test accuracy of the width is relatively high, and the average relative error is less than 5% [27].


### 4.3. Algorithm Running Time Comparison

The running time of an algorithm is an important indicator to evaluate the efficiency of an algorithm. In the case of ensuring the recognition accuracy, the faster the algorithm runs, the higher the image recognition efficiency. Compare the algorithm proposed in this paper with literature [6], crack recognition algorithm based on maximum entropy [28], gradient-based improvement Canny algorithm [29], and SVM-based crack recognition algorithm [30] (the algorithm consumes time and takes the average of the test object). The calculation time comparison is shown in Table 4.Table 4
Comparison of algorithm running time.
AlgorithmRunning time (s)Document 6 algorithm5.2Gradient-improved Canny algorithm1.2Maximum entropy segmentation algorithm1.1SVM-based crack recognition algorithm8.7MSR-B algorithm4.1From the comparison in Table4, it can be seen that the gradient-improved Canny algorithm and the maximum entropy crack segmentation algorithm have the shortest running time, but because the algorithm itself does not preprocess the image through steps such as image filtering, the crack extraction results are relatively general. The SVM-based algorithm takes an average of 8.7 seconds for each picture, but the recognition result is not much different from this article. Compared with the algorithm in literature [6], the algorithm in this paper has a greater improvement in the processing efficiency of each image. It is suitable for a large number of tunnel image processing and has certain engineering application significance.


## 4.1. Improved Retinex Algorithm Evaluation

The objective evaluation criteria of image enhancement effect usually include three objective indicators of peak signal-to-noise ratio (PSNR), information entropy, and contrast. Generally speaking, the larger the peak signal-to-noise ratio, the smaller the distortion of the image. Information entropy represents the amount of image information. Generally speaking, the higher the image information entropy, the greater the information entropy, and the more complete the image edges maintained. Contrast can better reflect the relationship between tunnel cracks and concrete lining in the image, and it can also be said that the image is more in line with the intuitive visual effect of the human eye.


### 4.1.1. Peak Signal-to-Noise Ratio (PSNR)

The formula for calculating the peak signal-to-noise ratio is shown in equations (10) and (11):(10)MSE=1mn∑i=1m∑j=1nXi,j−Yi,j2,(11)PSNR=10log102n−12MSE,where MSE represents the mean square error of the current image X and the reference image Y; m and n are the height and width of an image, respectively; n is the number of bits per pixel, generally taken as 8; that is, the pixel grayscale is 256.


### 4.1.2. Information Entropy

Entropy is the information entropy of the image, which describes the average amount of information that the image wants. The entropy is also large. The clearer the image texture, the richer the color. The definition of entropy is shown in the following formula:(12)Hp=−∑i=0255pilogpi.Among them,pi represents the probability of each gray level i appearing.


### 4.1.3. Image Contrast

The calculation formula of contrast is shown in the following formula:(13)C=∑δδi,jPδi,j.Among them,δi,j=i−j is the grayscale difference between adjacent pixels. Pδi,j is the pixel distribution probability, where the grayscale difference between adjacent pixels is δ.


### 4.1.4. Comparison of Recognition Results

Calculate the peak signal-to-noise ratio, information entropy, and image comparison chart of the four images in Figure3, respectively, and the calculation results are shown in Table 2.Table 2
Objective quality evaluation of each algorithm.
AlgorithmPSNREntropyContrastOriginal image91.494.1959.15SSR94.564.9389.11MSR95.384.9586.85MSR-B algorithm105.305.32126.42It can be clearly seen from Table2 that the algorithm in this paper has a large improvement in PSNR, information entropy, and image contrast, and all surpass the SSR algorithm and the MSR algorithm. The obtained image is clearer, the boundary preservation is more obvious, and the image information is richer, which proves the superiority of the image filtering algorithm proposed in this paper.


## 4.1.1. Peak Signal-to-Noise Ratio (PSNR)

The formula for calculating the peak signal-to-noise ratio is shown in equations (10) and (11):(10)MSE=1mn∑i=1m∑j=1nXi,j−Yi,j2,(11)PSNR=10log102n−12MSE,where MSE represents the mean square error of the current image X and the reference image Y; m and n are the height and width of an image, respectively; n is the number of bits per pixel, generally taken as 8; that is, the pixel grayscale is 256.


## 4.1.2. Information Entropy

Entropy is the information entropy of the image, which describes the average amount of information that the image wants. The entropy is also large. The clearer the image texture, the richer the color. The definition of entropy is shown in the following formula:(12)Hp=−∑i=0255pilogpi.Among them,pi represents the probability of each gray level i appearing.


## 4.1.3. Image Contrast

The calculation formula of contrast is shown in the following formula:(13)C=∑δδi,jPδi,j.Among them,δi,j=i−j is the grayscale difference between adjacent pixels. Pδi,j is the pixel distribution probability, where the grayscale difference between adjacent pixels is δ.


## 4.1.4. Comparison of Recognition Results

Calculate the peak signal-to-noise ratio, information entropy, and image comparison chart of the four images in Figure3, respectively, and the calculation results are shown in Table 2.Table 2
Objective quality evaluation of each algorithm.
AlgorithmPSNREntropyContrastOriginal image91.494.1959.15SSR94.564.9389.11MSR95.384.9586.85MSR-B algorithm105.305.32126.42It can be clearly seen from Table2 that the algorithm in this paper has a large improvement in PSNR, information entropy, and image contrast, and all surpass the SSR algorithm and the MSR algorithm. The obtained image is clearer, the boundary preservation is more obvious, and the image information is richer, which proves the superiority of the image filtering algorithm proposed in this paper.


## 4.2. Evaluation of Crack Identification Effect

Compare the cracks that can be recognized by the human eye in the original image with the cracks that the computer automatically recognizes. The part of the crack contour drawn manually in the original image is shown in red in Figure9, all the correct pixels are marked as Pt, and the other redundant parts in Figure 9 are represented in green in the original image, marked as Pf. The total number of pixels is denoted by N.Figure 9
Comparison of recognition results.The calculation formula of the recognition accuracy rateP is shown in formula (14). After calculating multiple images, it can be seen that the accuracy of crack identification in this paper is approximately 80.4%; that is, the main body of the crack can be fully identified, but there is a certain identification error. The overall recognition effect is good:(14)P=PtN×100%.In order to verify the accuracy of the algorithm, 200 tunnel crack images were randomly selected from the gallery for identification. If the cracks in the image can be completely identified, the identification is considered successful; otherwise, the identification fails. The image of cracks on the surface of ordinary concrete is selected for comparison with the cracks of the bridge, and the recognition results are shown in Table3.Table 3
Comparison of the accuracy of crack recognition.
Test objectQuantityRecognition rate (%)Concrete crack20099.0Tunnel lining crack20097.5Bridge crack20092.0From the comparison in Table3, it can be seen that the accuracy of the proposed tunnel lining crack recognition image in this paper can reach 97.5%, which is higher than other existing algorithms. The recognition effect of ordinary concrete surface cracks is also very good, which may be due to the better light obtained when collecting ordinary concrete surface cracks, and there is basically no other noise interference. However, the accuracy of identifying bridge cracks is still low. The bridge cracks here do not refer to the cracks in the asphalt pavement of the bridge, but the wings and piers of the bridge superstructure. These parts usually need to be added with waterproof paint, and there may be part of the paint peeling off in the obtained crack image, which leads to low recognition accuracy. The recognition rate of ordinary concrete crack images is higher than that of tunnel lining crack images, and bridge crack images have a certain relationship with light intensity. When the light is strong or weak, it will significantly affect the imaging of the crack edge and then have a greater impact on the identification of the crack width. After testing, when the light intensity is in the range of 1400–3100lux, the test accuracy of the width is relatively high, and the average relative error is less than 5% [27].


## 4.3. Algorithm Running Time Comparison

The running time of an algorithm is an important indicator to evaluate the efficiency of an algorithm. In the case of ensuring the recognition accuracy, the faster the algorithm runs, the higher the image recognition efficiency. Compare the algorithm proposed in this paper with literature [6], crack recognition algorithm based on maximum entropy [28], gradient-based improvement Canny algorithm [29], and SVM-based crack recognition algorithm [30] (the algorithm consumes time and takes the average of the test object). The calculation time comparison is shown in Table 4.Table 4
Comparison of algorithm running time.
AlgorithmRunning time (s)Document 6 algorithm5.2Gradient-improved Canny algorithm1.2Maximum entropy segmentation algorithm1.1SVM-based crack recognition algorithm8.7MSR-B algorithm4.1From the comparison in Table4, it can be seen that the gradient-improved Canny algorithm and the maximum entropy crack segmentation algorithm have the shortest running time, but because the algorithm itself does not preprocess the image through steps such as image filtering, the crack extraction results are relatively general. The SVM-based algorithm takes an average of 8.7 seconds for each picture, but the recognition result is not much different from this article. Compared with the algorithm in literature [6], the algorithm in this paper has a greater improvement in the processing efficiency of each image. It is suitable for a large number of tunnel image processing and has certain engineering application significance.


## 5. Conclusion

(1)
The improved multiscale Retinex algorithm is used to filter the collected images of tunnel lining cracks. The addition of gamma transform and Sigmoid function can preserve more details of the image. Through the comparison of peak signal-to-noise ratio, information entropy, and contrast, it can be seen that the newly proposed image enhancement algorithm can well retain the original information of the image, and the edges of the image are preserved intact, which is conducive to subsequent recognition.(2)
The eight-direction Sobel operator is used to detect the edge of the image, and the isolated points are removed by the morphological operation and the principle of the smallest bounding rectangle, and finally the crack is filled. The results show that the proposed crack processing algorithm can make the crack identification accuracy reach 90.4% and can basically realize the complete identification of the main body of the crack.(3)
The crack recognition algorithm proposed in this paper has a recognition accuracy of 97.5%, and the calculation time for each picture is relatively short. Subsequent improvements can be made to the Sobel edge detection operator to reduce the recognition of error points. It is also possible to perform semantic segmentation of the image and then identify the segmented cracks to improve the recognition accuracy.



---

*Source: 9969464-2021-09-28.xml*