# Research on Automatic Dodging Method for Road Surface Line Array Images

Authors: Fuqiang Yang; Jiabin Zhao; Bo Yu; Jiayuan Zhang; Wei Tang
Journal: Advances in Civil Engineering
 (2022)

---

## Abstract

Line scan cameras are widely used to acquire pavement images due to their imaging characteristics and low price, but the acquired pavement line array images often have uneven brightness. To eliminate the impact of image greyscale unevenness on subsequent processing, an automatic dodging method is proposed based on mask dodging algorithm. The main idea of the method is to chuck the images into sub-blocks with the approximate greyscale change degree by introducing the cumulative slope conception. The rules to determine the filter size and the parameters required to adjust the sub-block are self-adaptive. The contrast stretching method is improved to make it more suitable for pavement images. The method is compared with other classical dodging algorithms, and the results show that the proposed automatic dodging method is better than others intuitively and quantitatively. The image length has no significant influence on it. Moreover, the crack segmentation results indicate that the proposed dodging method is effective for line array images, and a more accuracy crack segmentation could be achieved if the images preprocessed by the proposed dodging methods.


---

## Body

## 1. Introduction

With the successful development of the transport industry, the total mileage of China’s roads is increasing year by year, while many roads are gradually turning to the maintenance and repair stage. The pavement cracks, which can threaten traffic safety and shorten the service life of roads, are the key inspection content of road maintenance. Traditional crack detection mainly relies on manual discrimination, the detection process is time-consuming and laborious, and the detection results are easily affected by the subjective factors of the inspector. Therefore, the automatic crack detection, combining the image acquisition and preprocessing, the crack identification and evaluation, has gradually become the mainstream method [1]. However, poor illumination of the acquisition environment or uneven distribution of fill light sources can lead to uneven distribution of greyscale and reduced contrast in the acquired pavement images [2], and bring about more difficult crack feature extraction and inaccurate crack assessment. Therefore, the homogenization of unevenly illuminated images is an essential step in automatic detection.The existing dodging methods for nonuniform illuminated images can be divided into three categories. The first category is based on the additive model, in which the low-pass, morphological, and homomorphic filters are used to simulate the background image and achieve global grayscale correction [2]. Qingquan and Qingwu achieved the dodging of pavement images based on the principle of electronic print cameras [3]. Li et al. proposed a variational adaptive dodging method based on the Mask model to obtain the ideal image [4]. Zhen et al. improved the Mask dodging method based on wavelet transform to obtain more accurate background images [5]. The second category is based on the illumination-reflection model [6]. Jobson et al. proposed the single-scale Retinex (SSR) algorithm and the multiscale Retinex (MSR) algorithm to estimate illumination based on this model and eliminate the effect of uneven illumination [7]. Wang et al. proposed a nonlinear function transform-based image correction method based on this model and multiscale theory [8]. Jung et al. used adaptive smoothing based on Retinex theory to eliminate the effect of illumination [9]. Ng and Wang proposed a total variation model for Retinex to describe the reflection function [10]. A variational Bayesian model was also used to estimate the light component in the Retinex model [11]. The third category is based on the statistical features of the images. By improving the multiplier method proposed by Cheng and Miyojim [12], Ying and Salari divided the pavement image into smaller rectangles and used the mean and multiplier of each window to remove non-uniform backgrounds [13]. Khan et al. independently equalized the subhistograms obtained from the segmentation to improve the illumination unevenness [14]. Ruiz-del-Solar and Quinteros applied Illumination Plane Subtraction (IPS) together with histogram equalization (HE) to reduce the effects of extreme illumination [15]. Parrany and Mirzaei used the first-order statistics of each pixel’s local neighborhood to calculate a local adaptive threshold matrix to obtain background images [16]. Yu et al. used least squares (LS) and minimum mean square error (MMSE) to estimate the illumination deviation of the background image [17]. Singh et al. used the combined information across multiple images to complete a polynomial fit for the illumination correction function (ICF) [18]. The above methods have good results in processing images captured by photography, video technology, and surface array cameras [19]. However, they are less effective in dealing with images with stripe noise, which could be caused by auxiliary illumination or other reasons when line scan cameras are used. Line scan cameras are widely used in image acquisition because of their low cost, high accuracy, high acquisition rate, and flexible control of the acquisition range. So, the appropriate image dodging methods should be designed for these images.For uneven illumination of line array images, Li and Liu used a sine function to complete a least-squares fit of the difference between each pixel point and the mean value of the pixels in that row. They completed the greyscale correction pixel by pixel based on the fitting results [20]. Carfantan and Idier proposed a statistical linear destriping (SLD) method for the stripe noise in these images [21]. By analyzing the various factors that cause uneven illumination of line array images, and calculating the multiplicative and additive components of the nonuniform correction coefficients for images, Song et al. applied correction coefficients on a pixel-by-pixel basis [22]. The existing methods operate directly on the pixel points but fail to accurately simulate the actual background greyscale of the line array image.An automatic dodging method for uneven illumination of line-array sweep images is proposed in this study, by which the actual background greyscale of images could be acquired. Firstly, the greyscale distribution characteristics of the line array image describing the road surface are analyzed. The original image is reasonably subblocked according to this characteristic to obtain a more accurate background image. Secondly, the greyscale difference between the subblocks is adjusted, and the image’s contrast is stretched. Then, the results of the dodging process are evaluated in terms of subjective visual and objective indicators, showing that the processing effect of the method in this study is significant and better than other existing methods. Finally, the method is applied to the preprocessing step of crack segmentation to provide a good image basis for subsequent processing [23, 24].


## 2. Image Characterization

The line scan camera has a high acquisition rate and short imaging exposure time, and a line light source is required for fill light to ensure the shooting effect. The instantaneous field of view of a line scan camera is one-dimension, and the road images are acquired by the push broom method [21], so the line array images have the same lighting environment in the camera movement direction. However, stripes exist in the horizontal direction of acquired images due to the uneven energy distribution of the fill light source and the response difference of sensors [25], as shown in Figure 1. The width, number, and greyscale range of stripes depend on the energy distribution of the line light source. The images are usually saved as a grayscale pixel matrix in the computer, and the greyscale values can be defined by:(1)I=Ib+Ic+In+Ia,where Ib represents the pavement background, which is low-frequency, and could be considered as a fixed value; Ic and In represent the pavement cracks, and random noise respectively, both of them are high-frequency only appeared in some pixels; Ia represents the auxiliary illumination of low-frequency high amplitude component, and it is considered as the image background.Figure 1
Original line array pavement image with (a) single-content; (b) lane lines; (c) square manhole covers; (d) round manhole covers.
(a)(b)(c)(d)Due to the complexity of the road environment, the acquired road images often contain other information shown in Figure1, such as white lane lines, round or square manhole covers, etc. These unwanted interferences will certainly affect the dodging processing results. According to the acquisition and fill light methods of line array images, the uneven illumination phenomenon only occurs in the horizontal direction, which is perpendicular to the direction of motion. Thus, the two-dimensional image could be compressed into one dimension by averaging the greyscale values of each column, and the column-averaged greyscale Ix can be obtained by:(2)Ix=∑y=1ngx,y/n,where gx,y is the greyscale matrix of the original image and n is the number of column pixels.According to equation (2), the greyscale distribution in the horizontal direction of each image in Figure 1 are shown in Figure 2. The greyscale distribution of the four images is approximately similar. The narrower and denser the stripes in the original image, the more the number of abrupt changes in the greyscale value at the corresponding location in Figure 2; the darkest or brightest local locations in the original image are reflected as abrupt changes in the greyscale value in Figure 2. The locations of the white lane lines in Figure 1(b) reflect an overall increase in greyscale values in this range; the square and round manhole covers in Figures 1(c) and 1(d) reflect an overall decrease in greyscale values in this range. A comparison of the original image with the greyscale distribution map shows that the greyscale distribution map provides a complete description of the greyscale characteristics of the original image.Figure 2
Grayscale distribution of the different line array pavement images.


## 3. Methodology

### 3.1. Mask Dodging Algorithm

The mask dodging algorithm is proposed for the sun printing of photographs [3] and is a more commonly used dodging method to eliminate the greyscale difference of images. According to the Mask principle, the original images contain two components, and is described as(3)Ix,y=Iex,y+Bx,y,where Ix,y represents an unevenly illuminated original image, Iex,y represents an evenly illuminated image, and Bx,y represents the background image.This mathematical model assumes that the uneven illumination of an image is caused by the unevenness of the background image. Thus, an evenly illuminated image could be achieved by subtracting the background component as,(4)Iex,y=Ix,y−Bx,y+offset,where offset denotes the greyscale value offset to ensure that the greyscale value is between 0 and 255 after subtracting the background image from the input image, and it is selected as the mean greyscale value of the original image so that the grey level of the resultant image close to the original image.The background image is acquired by using a Gaussian low-pass filter from the original image:(5)Bx,y=F−1Hu,vFu,v,where F−1 is the inverse discrete Fourier transform (IDFT), Fu,v is the DFT of input image Ix,y, and Hu,v is a Gaussian low-pass filter as(6)Hu,v=e−D2u,v/2σ2,where Du,v is the distance from the centre of the frequency rectangle, u and v are discrete frequency variables in the range of [0, p − 1] and [0, q − 1], respectively. For a digital image I′x,y of m × n, p = 2m, q = 2n. σ is the filter scale, which represents the extension of the metric about the centre. Increasing the filter scale σ will improve the accuracy of the background image simulation. However, it can also misrepresent some features as background, and therefore the filter size should not be too large.The subtraction operation in equation (4) will reduce the dynamic range of the greyscale values of the resulting image, so the contrast stretching method is used to increase the contrast of the image, which can be determined by:(7)Isx,y=255×Iex,y−V255−2VifV>0,Iex,y×255+2V255−VifV<0,where V is the contrast stretching parameter and takes a value (−127, 127); the larger the value of V, the greater the stretching. But if the value of V is too larger, the pixel values outside the range (0, 255). So, it should be determined according to the actual situation of the image. To remove the greyscale values that exceed (0, 255), the greyscale values are regarded as 0 or 255 if they are less than 0 or greater than 255 respectively.


### 3.2. Improved Mask Dodging Algorithm

In the mask dodging algorithm, the filter scaleσ is selected manually and there is a lack of self-adaptability. By directly applying the mask dodging algorithm to the line array images with pavement cracks, it was found that a better dodging effect could be acquired with an increasing filter window size, but the crack characteristics in the image will weaken, and it is adverse for the crack identification. Moreover, the contrast stretching effect is not obvious. To address the problems of the classical mask dodging method in processing line array images, an improved mask dodging algorithm is proposed and the main changes contain image chunking, filter size selection, greyscale adjustment between sub-block images, and contrast stretching.


#### 3.2.1. Image Chunking

Due to the single greyscale change, the mask dodging algorithm has a very good effect on images with uneven illumination phenomenon of light in the middle and dark around. However, the greyscale distribution mutates many times perpendicularly to the direction of motion in the line array image, and these mutations will affect the dodging effect of the line array image. It is proposed to be divided into some sub-blocks with small grayscale differences in each and applying the dodging method on each sub-block.As shown in Figure3, the greyscale distribution curve I (x) contains many peaks and valleys, and it could be divided into segments with a knife-blade-shape by the adjacent peaks and valleys plus the two endpoints of the curve as demarcation points. Thus, the greyscale distribution curve I (x) could be formed by connecting the knife-blade curves, and the greyscale on each knife-blade curve could be fitted by a cosine function as(8)Ii−1,ix=Acosωx+φ+h,where Ii−1,ix denotes the average greyscale of the xth pixel column; i denotes the ith demarcation point on the curve I (x), i = 1, 2, …, n + 1; n is the maximum number of peaks and valleys; A, ω, φ, and h denote the amplitude, angular frequency, initial phase, and offset, respectively.Figure 3
Schematic diagram of the knife-blade curve.As the peaks and valleys are located at the local extremum points of the curveI(x), the parameters of equation (8) could be calculated as(9)A=Ixi−1−Ixi2,ω=πxi−xi−1,φ=−πxi−1xi−xi−1,h=Ixi+Ixi−12,where Ixi and Ixi−1 are the greyscales at the pixel column xi and xi−1, respectively; xi and xi−1 are the pixel column of the ith and i − 1th demarcation points on curve I (x), respectively. Except x0 and xn+1, which are the two endpoints of the curve, the other demarcation points are the extremum points that belong to(10)xj∈x|I′x=0j=1,2,…,n,As the knife-blade curves describe the greyscale distribution alongx direction, the greyscale change degree could be reflected by the derivative of the knife-blade curve:(11)Ii−1,i′x=−Aωsinωx+φ,The maximum derivative of a knife-blade curve could be achieved as(12)ki−1,i=Ii−1,i′x|x=1ωπ2−φ=−Aω,where ki−1,i is the maximum derivative of the knife-blade curve between the i − 1th and ith demarcation points, and is used to represent the greyscale change degree of this knife-blade curve.To ensure each sub-block has the approximate greyscale change degree, the cumulative slope is introduced as(13)ki=0i=0,ki−1,i+ki−1i=1,2,…,n+1,where ki is the cumulative slope of the first i segments.If the image is intended to be divided intom sub-block, the cumulative slope of each sub-block should be(14)ksub_j=j⋅kn+1m,where ksub_j is the cumulative slope of the first j sub-block, j is the sub-block number, j = 1, 2, …, m.However, the actual cumulative slope of each sub-block cannot be exactly equal toksub_j calculated by equation (14), so the split point is selected as(15)xsub_j=xr−1ifksub_j−kr−1≤ksub_j−kr,xrifksub_j−kr−1>ksub_j−kr,where xsub_j is the jth sub-block split point, kr−1 and kr are cumulative slopes adjacent ksub_j with xr−1 and xr as their positions.


#### 3.2.2. Filter Size

The Gaussian low-pass filter is introduced in equation (5) when acquiring the background image, and the filter scale σ should be carefully selected to ensure a better leveling effect with no significantly weakened crack features. The concept of signal-to-noise ratio in image information is proposed to improve the adaptiveness of the method, defining:(16)SNRi=Iavg_iIstd_i,where SNRi is the signal-to-noise ratio of the ith sub-block image, i is the sub-block image number; Iavg_i and Istd_i are the average value and standard deviation of the greyscale values of the ith block image, respectively.The signal-to-noise ratioSNRi is used as the filter window size when acquiring the background of the ith sub-block images.


#### 3.2.3. Grayscale Adjustment between Sub-Block Images

After the dodging process of each sub-block images, there will be some greyscale differences between each sub-block image, and it is considered a greyscale adjustment problem between multiple images. The Wallis transform method is used to adjust the greyscale of each sub-block image [26]. The algorithm needs to select a suitable target image and use its mean and variance parameters to adjust the other images to achieve greyscale correction. The classical Wallis algorithm is given by:(17)Mix,y=Nix,y−mNstsN+mt,where Nix,y and Mix,y are the greyscale value of ith sub-block image at point x,y before and after Wallis transformation. mN and sN are the average greyscale value and standard deviation of the ith sub-block image respectively; mt and st are the target average greyscale value and target standard deviation.By specifying the target average greyscale value and target standard deviation one desired, the original image could have the same average greyscale value and standard deviation as the target values after Wallis transformation. To improve the overall brightness of the image to be processed, the sub-block image with the largest average greyscale value was selected as the standard image.


#### 3.2.4. Contrast Stretching

The contrast stretching method shown in equation (7) is suitable for remote sensing image processing, with the stretching parameter V∈−127,127. When V < 0, the original image greyscale range shrinks toward the middle with 127 as the origin value; when V > 0, the original greyscale range extends to both ends with 127 as the original value. The overall greyscale value of the road image containing cracks is lower compared with the remote sensing image, so the original value of the transformation is reduced to make it more suitable for the contrast stretching of the road image. The adjusted contrast stretching method is:(18)Ioutput=255×Iinput−V255−255/T×VV∈0,T,where T is the greyscale threshold and V is the contrast stretch parameter; the value of Ioutput is selected as 0 if it is less than 0, and 255 if it is greater than 255. The greyscale threshold T is defined by:(19)T=Imean−kTIstd,where Imean, Istd are the mean and standard deviation of the greyscale values of the image to be processed; kT is the correlation coefficient, the larger the value of kT, the smaller the range of values for V and the smaller the origin value used for stretching.


#### 3.2.5. The Automatic Dodging Method Processing Process

The processing flow of the proposed dodging method is shown in Figure4. The specific processing steps are as follows:(1)
Obtain the grey distribution of the original image according to equation (2). Calculate the degree of greyscale change of each segment of the image according to equation (12).(2)
To chunk the original image according to the calculation result of step 1 and the number of chunks to ensure that each sub-block image’s degree of grey change is approximate.(3)
Determining the parameters of the Gaussian low-pass filter according to equation (16), completing the subtraction operation of the original image and the background image according to equation (4).(4)
Selecting the sub-block with the maximum brightness as the standard image and adjusting the grayscale difference between the sub-blocks according to equation (17).(5)
Completing the contrast stretching process of the image according to equation (18).(6)
Evaluating the processing result quantitatively, and if this result meets the requirements, output the processing result; otherwise, increase the number of sub-blocks and repeat steps 2–5.Figure 4
The processing flow of the dodging method in this study.


### 3.3. Crack Segmentation

To verify that the automatic dodging method proposed in this study can provide a good image base for the subsequent processing of pavement images and highlight the necessity and importance of the automatic dodging method, the crack segmentation process is performed on the images before and after dodging, and their crack segmentation results are compared. The crack segmentation methods used in this section are the improved minimum path selection method and the pixel-level segmentation method based on U-Net convolutional network.


#### 3.3.1. Minimal Path Method

Amhaz et al. propose a minimal path selection (MPS) method for 2D crack images [27, 28]. This section focuses on some improvements to this method’s path endpoint selection strategy and adjusts the region growth quasi-measurement used for fracture width estimation.The shortest path problem is a classical algorithmic problem in graph theory, which aims to find the shortest path between two nodes so that the sum of the weights of its constituent edges is minimized. As shown in Figure5, (A, C, E, D, F) is the shortest path between vertices A and F in the weighted directed graph. The shortest path has nothing to do with the number of nodes passed, but with the weight of each edge and the use of the cost function to count the weights of each path.Figure 5
Shortest path diagram.The pavement crack has a curve-like shape and its greyscale value is lower than the pavement background, so the pavement cracks are considered as paths consisting of pixel points with low greyscale value, and the greyscale value cost of the path is described using cost function [27]:(20)Ec=∫0Lw1C′v2+w2C″v2+PCvdv,where Cv denotes the curve in the image with length L, the first and second terms are the first and second-order derivatives of that curve, and w1 and w2 are the corresponding weighting coefficients. The third term is the external force. Here, we consider an external force based on grey levels. The first two terms are mainly to ensure the smoothness of the curve, but the actual pavement cracks are not very smooth. By omitting the first two terms, the cost function of equation (20) retains only the grey value weights:(21)Ecij=∫0LPCvdv≈∑v=ijIv,where i and j are the starting point and endpoint of the curve Cijv, respectively, and Iv is the greyscale value at point v on the curve Cv. The start and end points are known, and the objective is to find the path with the lowest greyscale value, in which case Dijkstra’s algorithm works well [29, 30].The crack image processing flow based on the improved minimum path method is:(1)
Preprocessing: The line array image is firstly dodging processed using the improved mask dodging algorithm. Then the manhole cover region in the image is identified using the Hough transform method, and the manhole cover region is set to the average greyscale of the image to avoid its details interfering with the crack segmentation.(2)
Selection of path endpoints: According to the characteristics of the linear-like distribution of cracks, the image is divided into strip sub-blocks of a certain size according to the horizontal and vertical directions. The pixel point with the lowest greyscale value in the sub-blocks is selected as the endpoint of the minimum path, and the set of endpoints is the subset of the crack pixel points,(22)M=mi|mi=minx∈In·wiIx∪mj|mj=minj∈In·hjIy,wheremi is the set of pixel points with the lowest greyscale value for each horizontal sub-block and mj is the set of pixel points with the lowest greyscale value for each vertical sub-block. Here, In·wi indicates that the size of sub-block i is n×w, n is the set size, and w and h are the image width and height, respectively. However, there are certain pseudo-endpoints in this subset, whose grayscale value is the lowest locally but does not belong to the crack region. So the endpoints in this subset can be filtered by:(23)M′=mi∈M|Imi<μ−kσ,whereμ and σ are the mean and standard deviation of the greyscale of the image, and k is the correlation coefficient, it is chosen according to the actual situation of the image.(3)
To improve the efficiency of Dijkstra's algorithm, the search range is constrained within 2n pixels, where n is the set size of the sub-block image in the previous step.(4)
Postprocessing: The obtained minimum path width is a single pixel, which does not match the actual situation of the crack. So, the pixel points of the path are used as seed points to aggregate the surrounding pixel points iteratively using the 8-neighborhood region growth method, and the improved region growth criterion is defined by:(24)S∶Gi±1,j±1−CP<TGi±1,j±1<CP,whereGi±1,j±1 is any point in the 8-neighbourhood, CP is the average of the greyscale of all seed points, and T is the greyscale threshold. Finally, the smaller isolated noise areas are removed by the connected domain marking method [31, 32].


#### 3.3.2. U-Net Convolutional Network Model

U-Net is a modified fully convolutional neural network model with no fully connected layers in the network structure, and which can process images of arbitrary sizes [33]. It was first proposed by Olaf et al. for the segmentation of neuronal structures and was mainly used to process medical images in the early days. In recent years, the U-Net networks have also been applied to remote sensing image segmentation, road detection, and other fields [34].The U-Net network structure is U-shaped and is a typical encoder–decoder structure, as shown in Figure6. The left side of the structure is the backbone feature extraction network, which extracts image features and obtains deep semantic information through four convolutional pooling operations. The right-hand side of the structure is used for feature recovery by up-sampling the restored pixels and fusing feature maps of the same resolution from the encoder network to improve the accuracy of the results by combining low-level semantic information with high-level semantic information.Figure 6
U-Net network structure.The cross-entropy function is used as the loss function of this network model, and its learning rate is set to 0.0005, and the number of iterations is 100. The values of the loss function in the training and validation sets and the changes of mean pixel accuracy (MPA) and mean intersection over union (MIOU) in the validation set were recorded [35]. The results are shown in Figure 7.Figure 7
U-Net network model correlation curves: (a) loss curves; (b) MPA curve and MIOU curve.
(a)(b)


## 3.1. Mask Dodging Algorithm

The mask dodging algorithm is proposed for the sun printing of photographs [3] and is a more commonly used dodging method to eliminate the greyscale difference of images. According to the Mask principle, the original images contain two components, and is described as(3)Ix,y=Iex,y+Bx,y,where Ix,y represents an unevenly illuminated original image, Iex,y represents an evenly illuminated image, and Bx,y represents the background image.This mathematical model assumes that the uneven illumination of an image is caused by the unevenness of the background image. Thus, an evenly illuminated image could be achieved by subtracting the background component as,(4)Iex,y=Ix,y−Bx,y+offset,where offset denotes the greyscale value offset to ensure that the greyscale value is between 0 and 255 after subtracting the background image from the input image, and it is selected as the mean greyscale value of the original image so that the grey level of the resultant image close to the original image.The background image is acquired by using a Gaussian low-pass filter from the original image:(5)Bx,y=F−1Hu,vFu,v,where F−1 is the inverse discrete Fourier transform (IDFT), Fu,v is the DFT of input image Ix,y, and Hu,v is a Gaussian low-pass filter as(6)Hu,v=e−D2u,v/2σ2,where Du,v is the distance from the centre of the frequency rectangle, u and v are discrete frequency variables in the range of [0, p − 1] and [0, q − 1], respectively. For a digital image I′x,y of m × n, p = 2m, q = 2n. σ is the filter scale, which represents the extension of the metric about the centre. Increasing the filter scale σ will improve the accuracy of the background image simulation. However, it can also misrepresent some features as background, and therefore the filter size should not be too large.The subtraction operation in equation (4) will reduce the dynamic range of the greyscale values of the resulting image, so the contrast stretching method is used to increase the contrast of the image, which can be determined by:(7)Isx,y=255×Iex,y−V255−2VifV>0,Iex,y×255+2V255−VifV<0,where V is the contrast stretching parameter and takes a value (−127, 127); the larger the value of V, the greater the stretching. But if the value of V is too larger, the pixel values outside the range (0, 255). So, it should be determined according to the actual situation of the image. To remove the greyscale values that exceed (0, 255), the greyscale values are regarded as 0 or 255 if they are less than 0 or greater than 255 respectively.


## 3.2. Improved Mask Dodging Algorithm

In the mask dodging algorithm, the filter scaleσ is selected manually and there is a lack of self-adaptability. By directly applying the mask dodging algorithm to the line array images with pavement cracks, it was found that a better dodging effect could be acquired with an increasing filter window size, but the crack characteristics in the image will weaken, and it is adverse for the crack identification. Moreover, the contrast stretching effect is not obvious. To address the problems of the classical mask dodging method in processing line array images, an improved mask dodging algorithm is proposed and the main changes contain image chunking, filter size selection, greyscale adjustment between sub-block images, and contrast stretching.


### 3.2.1. Image Chunking

Due to the single greyscale change, the mask dodging algorithm has a very good effect on images with uneven illumination phenomenon of light in the middle and dark around. However, the greyscale distribution mutates many times perpendicularly to the direction of motion in the line array image, and these mutations will affect the dodging effect of the line array image. It is proposed to be divided into some sub-blocks with small grayscale differences in each and applying the dodging method on each sub-block.As shown in Figure3, the greyscale distribution curve I (x) contains many peaks and valleys, and it could be divided into segments with a knife-blade-shape by the adjacent peaks and valleys plus the two endpoints of the curve as demarcation points. Thus, the greyscale distribution curve I (x) could be formed by connecting the knife-blade curves, and the greyscale on each knife-blade curve could be fitted by a cosine function as(8)Ii−1,ix=Acosωx+φ+h,where Ii−1,ix denotes the average greyscale of the xth pixel column; i denotes the ith demarcation point on the curve I (x), i = 1, 2, …, n + 1; n is the maximum number of peaks and valleys; A, ω, φ, and h denote the amplitude, angular frequency, initial phase, and offset, respectively.Figure 3
Schematic diagram of the knife-blade curve.As the peaks and valleys are located at the local extremum points of the curveI(x), the parameters of equation (8) could be calculated as(9)A=Ixi−1−Ixi2,ω=πxi−xi−1,φ=−πxi−1xi−xi−1,h=Ixi+Ixi−12,where Ixi and Ixi−1 are the greyscales at the pixel column xi and xi−1, respectively; xi and xi−1 are the pixel column of the ith and i − 1th demarcation points on curve I (x), respectively. Except x0 and xn+1, which are the two endpoints of the curve, the other demarcation points are the extremum points that belong to(10)xj∈x|I′x=0j=1,2,…,n,As the knife-blade curves describe the greyscale distribution alongx direction, the greyscale change degree could be reflected by the derivative of the knife-blade curve:(11)Ii−1,i′x=−Aωsinωx+φ,The maximum derivative of a knife-blade curve could be achieved as(12)ki−1,i=Ii−1,i′x|x=1ωπ2−φ=−Aω,where ki−1,i is the maximum derivative of the knife-blade curve between the i − 1th and ith demarcation points, and is used to represent the greyscale change degree of this knife-blade curve.To ensure each sub-block has the approximate greyscale change degree, the cumulative slope is introduced as(13)ki=0i=0,ki−1,i+ki−1i=1,2,…,n+1,where ki is the cumulative slope of the first i segments.If the image is intended to be divided intom sub-block, the cumulative slope of each sub-block should be(14)ksub_j=j⋅kn+1m,where ksub_j is the cumulative slope of the first j sub-block, j is the sub-block number, j = 1, 2, …, m.However, the actual cumulative slope of each sub-block cannot be exactly equal toksub_j calculated by equation (14), so the split point is selected as(15)xsub_j=xr−1ifksub_j−kr−1≤ksub_j−kr,xrifksub_j−kr−1>ksub_j−kr,where xsub_j is the jth sub-block split point, kr−1 and kr are cumulative slopes adjacent ksub_j with xr−1 and xr as their positions.


### 3.2.2. Filter Size

The Gaussian low-pass filter is introduced in equation (5) when acquiring the background image, and the filter scale σ should be carefully selected to ensure a better leveling effect with no significantly weakened crack features. The concept of signal-to-noise ratio in image information is proposed to improve the adaptiveness of the method, defining:(16)SNRi=Iavg_iIstd_i,where SNRi is the signal-to-noise ratio of the ith sub-block image, i is the sub-block image number; Iavg_i and Istd_i are the average value and standard deviation of the greyscale values of the ith block image, respectively.The signal-to-noise ratioSNRi is used as the filter window size when acquiring the background of the ith sub-block images.


### 3.2.3. Grayscale Adjustment between Sub-Block Images

After the dodging process of each sub-block images, there will be some greyscale differences between each sub-block image, and it is considered a greyscale adjustment problem between multiple images. The Wallis transform method is used to adjust the greyscale of each sub-block image [26]. The algorithm needs to select a suitable target image and use its mean and variance parameters to adjust the other images to achieve greyscale correction. The classical Wallis algorithm is given by:(17)Mix,y=Nix,y−mNstsN+mt,where Nix,y and Mix,y are the greyscale value of ith sub-block image at point x,y before and after Wallis transformation. mN and sN are the average greyscale value and standard deviation of the ith sub-block image respectively; mt and st are the target average greyscale value and target standard deviation.By specifying the target average greyscale value and target standard deviation one desired, the original image could have the same average greyscale value and standard deviation as the target values after Wallis transformation. To improve the overall brightness of the image to be processed, the sub-block image with the largest average greyscale value was selected as the standard image.


### 3.2.4. Contrast Stretching

The contrast stretching method shown in equation (7) is suitable for remote sensing image processing, with the stretching parameter V∈−127,127. When V < 0, the original image greyscale range shrinks toward the middle with 127 as the origin value; when V > 0, the original greyscale range extends to both ends with 127 as the original value. The overall greyscale value of the road image containing cracks is lower compared with the remote sensing image, so the original value of the transformation is reduced to make it more suitable for the contrast stretching of the road image. The adjusted contrast stretching method is:(18)Ioutput=255×Iinput−V255−255/T×VV∈0,T,where T is the greyscale threshold and V is the contrast stretch parameter; the value of Ioutput is selected as 0 if it is less than 0, and 255 if it is greater than 255. The greyscale threshold T is defined by:(19)T=Imean−kTIstd,where Imean, Istd are the mean and standard deviation of the greyscale values of the image to be processed; kT is the correlation coefficient, the larger the value of kT, the smaller the range of values for V and the smaller the origin value used for stretching.


### 3.2.5. The Automatic Dodging Method Processing Process

The processing flow of the proposed dodging method is shown in Figure4. The specific processing steps are as follows:(1)
Obtain the grey distribution of the original image according to equation (2). Calculate the degree of greyscale change of each segment of the image according to equation (12).(2)
To chunk the original image according to the calculation result of step 1 and the number of chunks to ensure that each sub-block image’s degree of grey change is approximate.(3)
Determining the parameters of the Gaussian low-pass filter according to equation (16), completing the subtraction operation of the original image and the background image according to equation (4).(4)
Selecting the sub-block with the maximum brightness as the standard image and adjusting the grayscale difference between the sub-blocks according to equation (17).(5)
Completing the contrast stretching process of the image according to equation (18).(6)
Evaluating the processing result quantitatively, and if this result meets the requirements, output the processing result; otherwise, increase the number of sub-blocks and repeat steps 2–5.Figure 4
The processing flow of the dodging method in this study.


## 3.2.1. Image Chunking

Due to the single greyscale change, the mask dodging algorithm has a very good effect on images with uneven illumination phenomenon of light in the middle and dark around. However, the greyscale distribution mutates many times perpendicularly to the direction of motion in the line array image, and these mutations will affect the dodging effect of the line array image. It is proposed to be divided into some sub-blocks with small grayscale differences in each and applying the dodging method on each sub-block.As shown in Figure3, the greyscale distribution curve I (x) contains many peaks and valleys, and it could be divided into segments with a knife-blade-shape by the adjacent peaks and valleys plus the two endpoints of the curve as demarcation points. Thus, the greyscale distribution curve I (x) could be formed by connecting the knife-blade curves, and the greyscale on each knife-blade curve could be fitted by a cosine function as(8)Ii−1,ix=Acosωx+φ+h,where Ii−1,ix denotes the average greyscale of the xth pixel column; i denotes the ith demarcation point on the curve I (x), i = 1, 2, …, n + 1; n is the maximum number of peaks and valleys; A, ω, φ, and h denote the amplitude, angular frequency, initial phase, and offset, respectively.Figure 3
Schematic diagram of the knife-blade curve.As the peaks and valleys are located at the local extremum points of the curveI(x), the parameters of equation (8) could be calculated as(9)A=Ixi−1−Ixi2,ω=πxi−xi−1,φ=−πxi−1xi−xi−1,h=Ixi+Ixi−12,where Ixi and Ixi−1 are the greyscales at the pixel column xi and xi−1, respectively; xi and xi−1 are the pixel column of the ith and i − 1th demarcation points on curve I (x), respectively. Except x0 and xn+1, which are the two endpoints of the curve, the other demarcation points are the extremum points that belong to(10)xj∈x|I′x=0j=1,2,…,n,As the knife-blade curves describe the greyscale distribution alongx direction, the greyscale change degree could be reflected by the derivative of the knife-blade curve:(11)Ii−1,i′x=−Aωsinωx+φ,The maximum derivative of a knife-blade curve could be achieved as(12)ki−1,i=Ii−1,i′x|x=1ωπ2−φ=−Aω,where ki−1,i is the maximum derivative of the knife-blade curve between the i − 1th and ith demarcation points, and is used to represent the greyscale change degree of this knife-blade curve.To ensure each sub-block has the approximate greyscale change degree, the cumulative slope is introduced as(13)ki=0i=0,ki−1,i+ki−1i=1,2,…,n+1,where ki is the cumulative slope of the first i segments.If the image is intended to be divided intom sub-block, the cumulative slope of each sub-block should be(14)ksub_j=j⋅kn+1m,where ksub_j is the cumulative slope of the first j sub-block, j is the sub-block number, j = 1, 2, …, m.However, the actual cumulative slope of each sub-block cannot be exactly equal toksub_j calculated by equation (14), so the split point is selected as(15)xsub_j=xr−1ifksub_j−kr−1≤ksub_j−kr,xrifksub_j−kr−1>ksub_j−kr,where xsub_j is the jth sub-block split point, kr−1 and kr are cumulative slopes adjacent ksub_j with xr−1 and xr as their positions.


## 3.2.2. Filter Size

The Gaussian low-pass filter is introduced in equation (5) when acquiring the background image, and the filter scale σ should be carefully selected to ensure a better leveling effect with no significantly weakened crack features. The concept of signal-to-noise ratio in image information is proposed to improve the adaptiveness of the method, defining:(16)SNRi=Iavg_iIstd_i,where SNRi is the signal-to-noise ratio of the ith sub-block image, i is the sub-block image number; Iavg_i and Istd_i are the average value and standard deviation of the greyscale values of the ith block image, respectively.The signal-to-noise ratioSNRi is used as the filter window size when acquiring the background of the ith sub-block images.


## 3.2.3. Grayscale Adjustment between Sub-Block Images

After the dodging process of each sub-block images, there will be some greyscale differences between each sub-block image, and it is considered a greyscale adjustment problem between multiple images. The Wallis transform method is used to adjust the greyscale of each sub-block image [26]. The algorithm needs to select a suitable target image and use its mean and variance parameters to adjust the other images to achieve greyscale correction. The classical Wallis algorithm is given by:(17)Mix,y=Nix,y−mNstsN+mt,where Nix,y and Mix,y are the greyscale value of ith sub-block image at point x,y before and after Wallis transformation. mN and sN are the average greyscale value and standard deviation of the ith sub-block image respectively; mt and st are the target average greyscale value and target standard deviation.By specifying the target average greyscale value and target standard deviation one desired, the original image could have the same average greyscale value and standard deviation as the target values after Wallis transformation. To improve the overall brightness of the image to be processed, the sub-block image with the largest average greyscale value was selected as the standard image.


## 3.2.4. Contrast Stretching

The contrast stretching method shown in equation (7) is suitable for remote sensing image processing, with the stretching parameter V∈−127,127. When V < 0, the original image greyscale range shrinks toward the middle with 127 as the origin value; when V > 0, the original greyscale range extends to both ends with 127 as the original value. The overall greyscale value of the road image containing cracks is lower compared with the remote sensing image, so the original value of the transformation is reduced to make it more suitable for the contrast stretching of the road image. The adjusted contrast stretching method is:(18)Ioutput=255×Iinput−V255−255/T×VV∈0,T,where T is the greyscale threshold and V is the contrast stretch parameter; the value of Ioutput is selected as 0 if it is less than 0, and 255 if it is greater than 255. The greyscale threshold T is defined by:(19)T=Imean−kTIstd,where Imean, Istd are the mean and standard deviation of the greyscale values of the image to be processed; kT is the correlation coefficient, the larger the value of kT, the smaller the range of values for V and the smaller the origin value used for stretching.


## 3.2.5. The Automatic Dodging Method Processing Process

The processing flow of the proposed dodging method is shown in Figure4. The specific processing steps are as follows:(1)
Obtain the grey distribution of the original image according to equation (2). Calculate the degree of greyscale change of each segment of the image according to equation (12).(2)
To chunk the original image according to the calculation result of step 1 and the number of chunks to ensure that each sub-block image’s degree of grey change is approximate.(3)
Determining the parameters of the Gaussian low-pass filter according to equation (16), completing the subtraction operation of the original image and the background image according to equation (4).(4)
Selecting the sub-block with the maximum brightness as the standard image and adjusting the grayscale difference between the sub-blocks according to equation (17).(5)
Completing the contrast stretching process of the image according to equation (18).(6)
Evaluating the processing result quantitatively, and if this result meets the requirements, output the processing result; otherwise, increase the number of sub-blocks and repeat steps 2–5.Figure 4
The processing flow of the dodging method in this study.


## 3.3. Crack Segmentation

To verify that the automatic dodging method proposed in this study can provide a good image base for the subsequent processing of pavement images and highlight the necessity and importance of the automatic dodging method, the crack segmentation process is performed on the images before and after dodging, and their crack segmentation results are compared. The crack segmentation methods used in this section are the improved minimum path selection method and the pixel-level segmentation method based on U-Net convolutional network.


### 3.3.1. Minimal Path Method

Amhaz et al. propose a minimal path selection (MPS) method for 2D crack images [27, 28]. This section focuses on some improvements to this method’s path endpoint selection strategy and adjusts the region growth quasi-measurement used for fracture width estimation.The shortest path problem is a classical algorithmic problem in graph theory, which aims to find the shortest path between two nodes so that the sum of the weights of its constituent edges is minimized. As shown in Figure5, (A, C, E, D, F) is the shortest path between vertices A and F in the weighted directed graph. The shortest path has nothing to do with the number of nodes passed, but with the weight of each edge and the use of the cost function to count the weights of each path.Figure 5
Shortest path diagram.The pavement crack has a curve-like shape and its greyscale value is lower than the pavement background, so the pavement cracks are considered as paths consisting of pixel points with low greyscale value, and the greyscale value cost of the path is described using cost function [27]:(20)Ec=∫0Lw1C′v2+w2C″v2+PCvdv,where Cv denotes the curve in the image with length L, the first and second terms are the first and second-order derivatives of that curve, and w1 and w2 are the corresponding weighting coefficients. The third term is the external force. Here, we consider an external force based on grey levels. The first two terms are mainly to ensure the smoothness of the curve, but the actual pavement cracks are not very smooth. By omitting the first two terms, the cost function of equation (20) retains only the grey value weights:(21)Ecij=∫0LPCvdv≈∑v=ijIv,where i and j are the starting point and endpoint of the curve Cijv, respectively, and Iv is the greyscale value at point v on the curve Cv. The start and end points are known, and the objective is to find the path with the lowest greyscale value, in which case Dijkstra’s algorithm works well [29, 30].The crack image processing flow based on the improved minimum path method is:(1)
Preprocessing: The line array image is firstly dodging processed using the improved mask dodging algorithm. Then the manhole cover region in the image is identified using the Hough transform method, and the manhole cover region is set to the average greyscale of the image to avoid its details interfering with the crack segmentation.(2)
Selection of path endpoints: According to the characteristics of the linear-like distribution of cracks, the image is divided into strip sub-blocks of a certain size according to the horizontal and vertical directions. The pixel point with the lowest greyscale value in the sub-blocks is selected as the endpoint of the minimum path, and the set of endpoints is the subset of the crack pixel points,(22)M=mi|mi=minx∈In·wiIx∪mj|mj=minj∈In·hjIy,wheremi is the set of pixel points with the lowest greyscale value for each horizontal sub-block and mj is the set of pixel points with the lowest greyscale value for each vertical sub-block. Here, In·wi indicates that the size of sub-block i is n×w, n is the set size, and w and h are the image width and height, respectively. However, there are certain pseudo-endpoints in this subset, whose grayscale value is the lowest locally but does not belong to the crack region. So the endpoints in this subset can be filtered by:(23)M′=mi∈M|Imi<μ−kσ,whereμ and σ are the mean and standard deviation of the greyscale of the image, and k is the correlation coefficient, it is chosen according to the actual situation of the image.(3)
To improve the efficiency of Dijkstra's algorithm, the search range is constrained within 2n pixels, where n is the set size of the sub-block image in the previous step.(4)
Postprocessing: The obtained minimum path width is a single pixel, which does not match the actual situation of the crack. So, the pixel points of the path are used as seed points to aggregate the surrounding pixel points iteratively using the 8-neighborhood region growth method, and the improved region growth criterion is defined by:(24)S∶Gi±1,j±1−CP<TGi±1,j±1<CP,whereGi±1,j±1 is any point in the 8-neighbourhood, CP is the average of the greyscale of all seed points, and T is the greyscale threshold. Finally, the smaller isolated noise areas are removed by the connected domain marking method [31, 32].


### 3.3.2. U-Net Convolutional Network Model

U-Net is a modified fully convolutional neural network model with no fully connected layers in the network structure, and which can process images of arbitrary sizes [33]. It was first proposed by Olaf et al. for the segmentation of neuronal structures and was mainly used to process medical images in the early days. In recent years, the U-Net networks have also been applied to remote sensing image segmentation, road detection, and other fields [34].The U-Net network structure is U-shaped and is a typical encoder–decoder structure, as shown in Figure6. The left side of the structure is the backbone feature extraction network, which extracts image features and obtains deep semantic information through four convolutional pooling operations. The right-hand side of the structure is used for feature recovery by up-sampling the restored pixels and fusing feature maps of the same resolution from the encoder network to improve the accuracy of the results by combining low-level semantic information with high-level semantic information.Figure 6
U-Net network structure.The cross-entropy function is used as the loss function of this network model, and its learning rate is set to 0.0005, and the number of iterations is 100. The values of the loss function in the training and validation sets and the changes of mean pixel accuracy (MPA) and mean intersection over union (MIOU) in the validation set were recorded [35]. The results are shown in Figure 7.Figure 7
U-Net network model correlation curves: (a) loss curves; (b) MPA curve and MIOU curve.
(a)(b)


## 3.3.1. Minimal Path Method

Amhaz et al. propose a minimal path selection (MPS) method for 2D crack images [27, 28]. This section focuses on some improvements to this method’s path endpoint selection strategy and adjusts the region growth quasi-measurement used for fracture width estimation.The shortest path problem is a classical algorithmic problem in graph theory, which aims to find the shortest path between two nodes so that the sum of the weights of its constituent edges is minimized. As shown in Figure5, (A, C, E, D, F) is the shortest path between vertices A and F in the weighted directed graph. The shortest path has nothing to do with the number of nodes passed, but with the weight of each edge and the use of the cost function to count the weights of each path.Figure 5
Shortest path diagram.The pavement crack has a curve-like shape and its greyscale value is lower than the pavement background, so the pavement cracks are considered as paths consisting of pixel points with low greyscale value, and the greyscale value cost of the path is described using cost function [27]:(20)Ec=∫0Lw1C′v2+w2C″v2+PCvdv,where Cv denotes the curve in the image with length L, the first and second terms are the first and second-order derivatives of that curve, and w1 and w2 are the corresponding weighting coefficients. The third term is the external force. Here, we consider an external force based on grey levels. The first two terms are mainly to ensure the smoothness of the curve, but the actual pavement cracks are not very smooth. By omitting the first two terms, the cost function of equation (20) retains only the grey value weights:(21)Ecij=∫0LPCvdv≈∑v=ijIv,where i and j are the starting point and endpoint of the curve Cijv, respectively, and Iv is the greyscale value at point v on the curve Cv. The start and end points are known, and the objective is to find the path with the lowest greyscale value, in which case Dijkstra’s algorithm works well [29, 30].The crack image processing flow based on the improved minimum path method is:(1)
Preprocessing: The line array image is firstly dodging processed using the improved mask dodging algorithm. Then the manhole cover region in the image is identified using the Hough transform method, and the manhole cover region is set to the average greyscale of the image to avoid its details interfering with the crack segmentation.(2)
Selection of path endpoints: According to the characteristics of the linear-like distribution of cracks, the image is divided into strip sub-blocks of a certain size according to the horizontal and vertical directions. The pixel point with the lowest greyscale value in the sub-blocks is selected as the endpoint of the minimum path, and the set of endpoints is the subset of the crack pixel points,(22)M=mi|mi=minx∈In·wiIx∪mj|mj=minj∈In·hjIy,wheremi is the set of pixel points with the lowest greyscale value for each horizontal sub-block and mj is the set of pixel points with the lowest greyscale value for each vertical sub-block. Here, In·wi indicates that the size of sub-block i is n×w, n is the set size, and w and h are the image width and height, respectively. However, there are certain pseudo-endpoints in this subset, whose grayscale value is the lowest locally but does not belong to the crack region. So the endpoints in this subset can be filtered by:(23)M′=mi∈M|Imi<μ−kσ,whereμ and σ are the mean and standard deviation of the greyscale of the image, and k is the correlation coefficient, it is chosen according to the actual situation of the image.(3)
To improve the efficiency of Dijkstra's algorithm, the search range is constrained within 2n pixels, where n is the set size of the sub-block image in the previous step.(4)
Postprocessing: The obtained minimum path width is a single pixel, which does not match the actual situation of the crack. So, the pixel points of the path are used as seed points to aggregate the surrounding pixel points iteratively using the 8-neighborhood region growth method, and the improved region growth criterion is defined by:(24)S∶Gi±1,j±1−CP<TGi±1,j±1<CP,whereGi±1,j±1 is any point in the 8-neighbourhood, CP is the average of the greyscale of all seed points, and T is the greyscale threshold. Finally, the smaller isolated noise areas are removed by the connected domain marking method [31, 32].


## 3.3.2. U-Net Convolutional Network Model

U-Net is a modified fully convolutional neural network model with no fully connected layers in the network structure, and which can process images of arbitrary sizes [33]. It was first proposed by Olaf et al. for the segmentation of neuronal structures and was mainly used to process medical images in the early days. In recent years, the U-Net networks have also been applied to remote sensing image segmentation, road detection, and other fields [34].The U-Net network structure is U-shaped and is a typical encoder–decoder structure, as shown in Figure6. The left side of the structure is the backbone feature extraction network, which extracts image features and obtains deep semantic information through four convolutional pooling operations. The right-hand side of the structure is used for feature recovery by up-sampling the restored pixels and fusing feature maps of the same resolution from the encoder network to improve the accuracy of the results by combining low-level semantic information with high-level semantic information.Figure 6
U-Net network structure.The cross-entropy function is used as the loss function of this network model, and its learning rate is set to 0.0005, and the number of iterations is 100. The values of the loss function in the training and validation sets and the changes of mean pixel accuracy (MPA) and mean intersection over union (MIOU) in the validation set were recorded [35]. The results are shown in Figure 7.Figure 7
U-Net network model correlation curves: (a) loss curves; (b) MPA curve and MIOU curve.
(a)(b)


## 4. Experimentation and Analysis

In this study, the proposed automatic dodging method is tested on a dataset containing line array pavement images acquired by a Laser Crack Measurement System (LCMS). The acquisition system uses line laser fill light, which can measure at speeds of up to 100 km/h and still guarantee millimeter resolution. To expand this dataset, we cropped some of the images in the dataset, and we used 243 of these images to test the dodging effect. The test program was written using python 3.7, and the experimental platform was an Intel i5-5200U processor with 8 GB of RAM and a Windows operating system.


### 4.1. Quality Evaluation

The common methods used to deal with uneven illumination are the Mask dodging algorithm, the Retinex enhancement method, the homomorphic filtering method, and the Wallis transform. The Retinex method separates the illuminance component from the original image and retains the reflection component. In contrast, the homomorphic filtering method removes the corresponding multiplicative noise by estimating the low or high-frequency components by the filter function. Four selected line array images were processed by different methods to verify the dodging method proposed, and the results are shown in Figure8.Figure 8
Comparison of different dodging methods for line array image of (a) single content pavement, (b) pavement with lane line, (c) pavement containing square manhole cover, (d) pavement containing round manhole cover.


#### 4.1.1. Qualitative Evaluation

For the four different images shown in Figure8, the Mask method eliminated the wider stripes in the original image and faded the narrow stripes slightly; however, the result is an overall darker image and the crack features are weakened. The Retinex enhancement method results in an overall brighter image but does not eliminate the narrow stripes in the original image, and its dodging effect is average. The result of the homomorphic filtering method is a moderately bright image, but there is a significant loss of the crack feature, which makes the image blurred. The apparent block could be seen with the images processed by the Wallis transform method, and the dodging effect is not obvious. The proposed method in this study removed the banding streaks in the original image, which has an apparent dodging effect, a clear image detail, and good retention of the fracture features.


#### 4.1.2. Quantitative Evaluation

The mean of image, standard deviation, image entropy, average image gradient, and luminance distribution value is employed to quantitatively evaluate the image after dodging. The mean and standard deviation of the greyscale value determine the brightness and contrast of an image.Image entropy is a statistical form of features that reflects how much average information is in an image. The one-dimensional entropy of an image represents the aggregation characteristics of the grayscale distribution in the image, and it is defined as [8]:(25)HX=−∑i=0255pilog2pi,where pi represents the proportion of pixels with a greyscale value of i in the image.The average image gradient reflects the detail contrast and texture transformation. The larger the value, the clearer the image, and it is calculated by [8, 36]:(26)∇G_=1MN∑i=1M∑j=1NΔxfi,j2+Δyfi,j22,where Δxfi,j and Δyfi,j are the first-order difference value of pixel i,j in the x and y directions, respectively.The luminance distribution value of an image is defined as the standard deviation of the average luminance of its sub-blocks and reflects the luminance differences of an image. The images were divided equally into 5 × 5 blocks in this study.The quantitative evaluation parameters of the four original images and dodged images are listed in Table1. It is shown that the Mask method has the closest greyscale range to the original image, but its standard deviation, image entropy, and average image gradient values are the smallest. The results indicate that the processed image is slightly blurred and some information is lost during processing. The Retinex enhancement method produced the brightest resultant images. Their luminance distribution values were low, but their image entropy and average image gradient values were low, i.e., the method results in a partial loss of information in the image. The homomorphic filtering method has the largest luminance distribution values, i.e., it is considered to have a more significant variation in the grey values in each region of the image, so its dodging effect is general. Even though the images dodged by the Wallis transform method have the smallest luminance distribution value, the existing block is beyond its ascendancy. Processed by the proposed method, the images are higher than the original image in the mean grey value, outperforming the other methods in terms of standard deviation, image entropy, and average image gradient value of the image, ensuring the dodging effect of the image and the contrast of the image.Table 1
Quantitative evaluation parameters of the four images before and after dodging by different methods.
ImageEvaluation indicatorsOriginal imageMask dodgingRetinex enhancementHomomorphic filteringWallis transformMy methodaM174.4274.00183.50162.7486.67130.21SD213.5010.2612.1115.6110.9425.96H35.795.375.585.985.486.71G48.418.419.9115.598.2121.70LDV55.740.230.362.630.950.30bM70.9170.00216.81156.93113.13154.33SD21.9613.4612.087.9019.5925.12H6.435.785.424.916.326.64G10.6610.658.656.1714.1920.48LDV11.510.410.562.591.490.61cM62.3462.00182.53150.4197.81163.61SD26.156.5617.3623.817.7730.53H6.364.584.694.974.966.85G4.804.825.524.934.3523.07LDV22.280.606.1415.281.1010.58dM67.4967.00191.26152.25102.67177.90SD25.4911.1917.4913.4912.5939.99H6.665.475.275.095.687.25G10.3910.379.906.8210.4435.34LDV19.740.452.306.800.958.861M: mean of image; 2SD: standard deviation; 3H: information entropy; 4G: mean gradient; 5LDV: luminance distribution value.


### 4.2. Dodging Time

To verify the practical application value of the automatic dodging method in this study, the running time required to process 100 line array crack images of 701 × 525 pixels in size in the statistical data set, and compare the running time of this method with that of Mask method. The statistical results are shown in Table2.Table 2
Time required for dodging.
Image number1234…979899100Average valueRunning time (s)Mask3.723.773.763.70…3.673.973.703.703.72My method5.585.395.525.42…5.355.325.505.405.42The proposed automatic dodging method is based on the Mask method with the addition of adaptive chunking and greyscale adjustment operations. So the running time of the method is longer than that of the Mask method.


### 4.3. Crack Segmentation Results

#### 4.3.1. Improved Minimal Path Method

Following the process described in Section3.3.1, the crack areas were segmented using the improved minimal path method for the pavement images before and after dodging. The results are shown in Figure 9, where the blue areas in the figures are the accurately extracted crack part, while the green areas are the pseudo cracks extracted for error. By comparing the crack segmentation results, it can be seen that the original image has few blue areas, in contrast, many green areas appear at the dark stripes, whose greyscale values are similar to the cracks, and they are easily misjudged as crack areas and also interfere with the segmentation of the actual crack areas. After dodging, the crack image has no noticeable dark stripes, so there are more blue areas in the image, which characterize the crack well, and fewer green areas.Figure 9
Crack segmentation by the minimal path method from (a) the original image; (b) the image after dodging. (The blue area is the accurately segmented crack; the green is the pseudo cracks.).
(a)(b)


#### 4.3.2. U-Net Convolutional Network Model

The convolutional network model trained in Section3.3.2 was used to segment the cracked areas in the pavement images before and after dodging, and the segmentation results are shown in Figure 10.Figure 10
Crack segmentation by the U-Net network model from (a) the original image; (b) the image after dodging. (The blue area is the accurately segmented crack; the green is the pseudo cracks.).
(a)(b)The segmentation results in Figure10 are very close, so the confusion matrix was used to quantitatively evaluate the crack segmentation results. The pixel points can be divided into four categories, TP (true positives): truly cracked pixels detected correctly; FP (false positives): noncracked pixels detected incorrectly; FN (false negatives): truly cracked pixels not detected; TN (true negatives): correctly labeled background pixels. The segmentation results were evaluated quantitatively using the accuracy P, recall R, and F1 score metrics [27], and the results are shown in Table 3.Table 3
Comparison of crack segmentation results.
Evaluation indicatorsImage aImage bImage cImage dOriginalAfter-dodgingOriginalAfter-dodgingOriginalAfter-dodgingOriginalAfter-dodgingP (%)50.6661.7666.7967.6949.2060.5847.5966.52R (%)43.9445.3554.6961.9151.3256.2933.1836.13F1 (%)47.0652.3060.1464.6750.2458.3639.1046.83The accuracyP reflects the proportion of falsely detected noncracked pixels.(27)P=TPTP+FP.RecallR reflects the proportion of actual cracks not detected by:(28)R=TPTP+FN.TheF1 score represents the summed average of accuracy and recall.(29)F1=2TP2TP+FP+FN.Analysis of the data in Table3 shows that the images after dodging have a higher crack segmentation accuracy and recall than the original images; the F1 value of the segmentation results can be improved by more than 5%.Therefore, the analysis and observation of the crack segmentation results obtained by the improved minimum path method and the U-Net network model indicate that the proposed dodging method is effective for line array images. A more accurate crack segmentation could be achieved if the proposed dodging methods preprocess the images.


## 4.1. Quality Evaluation

The common methods used to deal with uneven illumination are the Mask dodging algorithm, the Retinex enhancement method, the homomorphic filtering method, and the Wallis transform. The Retinex method separates the illuminance component from the original image and retains the reflection component. In contrast, the homomorphic filtering method removes the corresponding multiplicative noise by estimating the low or high-frequency components by the filter function. Four selected line array images were processed by different methods to verify the dodging method proposed, and the results are shown in Figure8.Figure 8
Comparison of different dodging methods for line array image of (a) single content pavement, (b) pavement with lane line, (c) pavement containing square manhole cover, (d) pavement containing round manhole cover.


### 4.1.1. Qualitative Evaluation

For the four different images shown in Figure8, the Mask method eliminated the wider stripes in the original image and faded the narrow stripes slightly; however, the result is an overall darker image and the crack features are weakened. The Retinex enhancement method results in an overall brighter image but does not eliminate the narrow stripes in the original image, and its dodging effect is average. The result of the homomorphic filtering method is a moderately bright image, but there is a significant loss of the crack feature, which makes the image blurred. The apparent block could be seen with the images processed by the Wallis transform method, and the dodging effect is not obvious. The proposed method in this study removed the banding streaks in the original image, which has an apparent dodging effect, a clear image detail, and good retention of the fracture features.


### 4.1.2. Quantitative Evaluation

The mean of image, standard deviation, image entropy, average image gradient, and luminance distribution value is employed to quantitatively evaluate the image after dodging. The mean and standard deviation of the greyscale value determine the brightness and contrast of an image.Image entropy is a statistical form of features that reflects how much average information is in an image. The one-dimensional entropy of an image represents the aggregation characteristics of the grayscale distribution in the image, and it is defined as [8]:(25)HX=−∑i=0255pilog2pi,where pi represents the proportion of pixels with a greyscale value of i in the image.The average image gradient reflects the detail contrast and texture transformation. The larger the value, the clearer the image, and it is calculated by [8, 36]:(26)∇G_=1MN∑i=1M∑j=1NΔxfi,j2+Δyfi,j22,where Δxfi,j and Δyfi,j are the first-order difference value of pixel i,j in the x and y directions, respectively.The luminance distribution value of an image is defined as the standard deviation of the average luminance of its sub-blocks and reflects the luminance differences of an image. The images were divided equally into 5 × 5 blocks in this study.The quantitative evaluation parameters of the four original images and dodged images are listed in Table1. It is shown that the Mask method has the closest greyscale range to the original image, but its standard deviation, image entropy, and average image gradient values are the smallest. The results indicate that the processed image is slightly blurred and some information is lost during processing. The Retinex enhancement method produced the brightest resultant images. Their luminance distribution values were low, but their image entropy and average image gradient values were low, i.e., the method results in a partial loss of information in the image. The homomorphic filtering method has the largest luminance distribution values, i.e., it is considered to have a more significant variation in the grey values in each region of the image, so its dodging effect is general. Even though the images dodged by the Wallis transform method have the smallest luminance distribution value, the existing block is beyond its ascendancy. Processed by the proposed method, the images are higher than the original image in the mean grey value, outperforming the other methods in terms of standard deviation, image entropy, and average image gradient value of the image, ensuring the dodging effect of the image and the contrast of the image.Table 1
Quantitative evaluation parameters of the four images before and after dodging by different methods.
ImageEvaluation indicatorsOriginal imageMask dodgingRetinex enhancementHomomorphic filteringWallis transformMy methodaM174.4274.00183.50162.7486.67130.21SD213.5010.2612.1115.6110.9425.96H35.795.375.585.985.486.71G48.418.419.9115.598.2121.70LDV55.740.230.362.630.950.30bM70.9170.00216.81156.93113.13154.33SD21.9613.4612.087.9019.5925.12H6.435.785.424.916.326.64G10.6610.658.656.1714.1920.48LDV11.510.410.562.591.490.61cM62.3462.00182.53150.4197.81163.61SD26.156.5617.3623.817.7730.53H6.364.584.694.974.966.85G4.804.825.524.934.3523.07LDV22.280.606.1415.281.1010.58dM67.4967.00191.26152.25102.67177.90SD25.4911.1917.4913.4912.5939.99H6.665.475.275.095.687.25G10.3910.379.906.8210.4435.34LDV19.740.452.306.800.958.861M: mean of image; 2SD: standard deviation; 3H: information entropy; 4G: mean gradient; 5LDV: luminance distribution value.


## 4.1.1. Qualitative Evaluation

For the four different images shown in Figure8, the Mask method eliminated the wider stripes in the original image and faded the narrow stripes slightly; however, the result is an overall darker image and the crack features are weakened. The Retinex enhancement method results in an overall brighter image but does not eliminate the narrow stripes in the original image, and its dodging effect is average. The result of the homomorphic filtering method is a moderately bright image, but there is a significant loss of the crack feature, which makes the image blurred. The apparent block could be seen with the images processed by the Wallis transform method, and the dodging effect is not obvious. The proposed method in this study removed the banding streaks in the original image, which has an apparent dodging effect, a clear image detail, and good retention of the fracture features.


## 4.1.2. Quantitative Evaluation

The mean of image, standard deviation, image entropy, average image gradient, and luminance distribution value is employed to quantitatively evaluate the image after dodging. The mean and standard deviation of the greyscale value determine the brightness and contrast of an image.Image entropy is a statistical form of features that reflects how much average information is in an image. The one-dimensional entropy of an image represents the aggregation characteristics of the grayscale distribution in the image, and it is defined as [8]:(25)HX=−∑i=0255pilog2pi,where pi represents the proportion of pixels with a greyscale value of i in the image.The average image gradient reflects the detail contrast and texture transformation. The larger the value, the clearer the image, and it is calculated by [8, 36]:(26)∇G_=1MN∑i=1M∑j=1NΔxfi,j2+Δyfi,j22,where Δxfi,j and Δyfi,j are the first-order difference value of pixel i,j in the x and y directions, respectively.The luminance distribution value of an image is defined as the standard deviation of the average luminance of its sub-blocks and reflects the luminance differences of an image. The images were divided equally into 5 × 5 blocks in this study.The quantitative evaluation parameters of the four original images and dodged images are listed in Table1. It is shown that the Mask method has the closest greyscale range to the original image, but its standard deviation, image entropy, and average image gradient values are the smallest. The results indicate that the processed image is slightly blurred and some information is lost during processing. The Retinex enhancement method produced the brightest resultant images. Their luminance distribution values were low, but their image entropy and average image gradient values were low, i.e., the method results in a partial loss of information in the image. The homomorphic filtering method has the largest luminance distribution values, i.e., it is considered to have a more significant variation in the grey values in each region of the image, so its dodging effect is general. Even though the images dodged by the Wallis transform method have the smallest luminance distribution value, the existing block is beyond its ascendancy. Processed by the proposed method, the images are higher than the original image in the mean grey value, outperforming the other methods in terms of standard deviation, image entropy, and average image gradient value of the image, ensuring the dodging effect of the image and the contrast of the image.Table 1
Quantitative evaluation parameters of the four images before and after dodging by different methods.
ImageEvaluation indicatorsOriginal imageMask dodgingRetinex enhancementHomomorphic filteringWallis transformMy methodaM174.4274.00183.50162.7486.67130.21SD213.5010.2612.1115.6110.9425.96H35.795.375.585.985.486.71G48.418.419.9115.598.2121.70LDV55.740.230.362.630.950.30bM70.9170.00216.81156.93113.13154.33SD21.9613.4612.087.9019.5925.12H6.435.785.424.916.326.64G10.6610.658.656.1714.1920.48LDV11.510.410.562.591.490.61cM62.3462.00182.53150.4197.81163.61SD26.156.5617.3623.817.7730.53H6.364.584.694.974.966.85G4.804.825.524.934.3523.07LDV22.280.606.1415.281.1010.58dM67.4967.00191.26152.25102.67177.90SD25.4911.1917.4913.4912.5939.99H6.665.475.275.095.687.25G10.3910.379.906.8210.4435.34LDV19.740.452.306.800.958.861M: mean of image; 2SD: standard deviation; 3H: information entropy; 4G: mean gradient; 5LDV: luminance distribution value.


## 4.2. Dodging Time

To verify the practical application value of the automatic dodging method in this study, the running time required to process 100 line array crack images of 701 × 525 pixels in size in the statistical data set, and compare the running time of this method with that of Mask method. The statistical results are shown in Table2.Table 2
Time required for dodging.
Image number1234…979899100Average valueRunning time (s)Mask3.723.773.763.70…3.673.973.703.703.72My method5.585.395.525.42…5.355.325.505.405.42The proposed automatic dodging method is based on the Mask method with the addition of adaptive chunking and greyscale adjustment operations. So the running time of the method is longer than that of the Mask method.


## 4.3. Crack Segmentation Results

### 4.3.1. Improved Minimal Path Method

Following the process described in Section3.3.1, the crack areas were segmented using the improved minimal path method for the pavement images before and after dodging. The results are shown in Figure 9, where the blue areas in the figures are the accurately extracted crack part, while the green areas are the pseudo cracks extracted for error. By comparing the crack segmentation results, it can be seen that the original image has few blue areas, in contrast, many green areas appear at the dark stripes, whose greyscale values are similar to the cracks, and they are easily misjudged as crack areas and also interfere with the segmentation of the actual crack areas. After dodging, the crack image has no noticeable dark stripes, so there are more blue areas in the image, which characterize the crack well, and fewer green areas.Figure 9
Crack segmentation by the minimal path method from (a) the original image; (b) the image after dodging. (The blue area is the accurately segmented crack; the green is the pseudo cracks.).
(a)(b)


### 4.3.2. U-Net Convolutional Network Model

The convolutional network model trained in Section3.3.2 was used to segment the cracked areas in the pavement images before and after dodging, and the segmentation results are shown in Figure 10.Figure 10
Crack segmentation by the U-Net network model from (a) the original image; (b) the image after dodging. (The blue area is the accurately segmented crack; the green is the pseudo cracks.).
(a)(b)The segmentation results in Figure10 are very close, so the confusion matrix was used to quantitatively evaluate the crack segmentation results. The pixel points can be divided into four categories, TP (true positives): truly cracked pixels detected correctly; FP (false positives): noncracked pixels detected incorrectly; FN (false negatives): truly cracked pixels not detected; TN (true negatives): correctly labeled background pixels. The segmentation results were evaluated quantitatively using the accuracy P, recall R, and F1 score metrics [27], and the results are shown in Table 3.Table 3
Comparison of crack segmentation results.
Evaluation indicatorsImage aImage bImage cImage dOriginalAfter-dodgingOriginalAfter-dodgingOriginalAfter-dodgingOriginalAfter-dodgingP (%)50.6661.7666.7967.6949.2060.5847.5966.52R (%)43.9445.3554.6961.9151.3256.2933.1836.13F1 (%)47.0652.3060.1464.6750.2458.3639.1046.83The accuracyP reflects the proportion of falsely detected noncracked pixels.(27)P=TPTP+FP.RecallR reflects the proportion of actual cracks not detected by:(28)R=TPTP+FN.TheF1 score represents the summed average of accuracy and recall.(29)F1=2TP2TP+FP+FN.Analysis of the data in Table3 shows that the images after dodging have a higher crack segmentation accuracy and recall than the original images; the F1 value of the segmentation results can be improved by more than 5%.Therefore, the analysis and observation of the crack segmentation results obtained by the improved minimum path method and the U-Net network model indicate that the proposed dodging method is effective for line array images. A more accurate crack segmentation could be achieved if the proposed dodging methods preprocess the images.


## 4.3.1. Improved Minimal Path Method

Following the process described in Section3.3.1, the crack areas were segmented using the improved minimal path method for the pavement images before and after dodging. The results are shown in Figure 9, where the blue areas in the figures are the accurately extracted crack part, while the green areas are the pseudo cracks extracted for error. By comparing the crack segmentation results, it can be seen that the original image has few blue areas, in contrast, many green areas appear at the dark stripes, whose greyscale values are similar to the cracks, and they are easily misjudged as crack areas and also interfere with the segmentation of the actual crack areas. After dodging, the crack image has no noticeable dark stripes, so there are more blue areas in the image, which characterize the crack well, and fewer green areas.Figure 9
Crack segmentation by the minimal path method from (a) the original image; (b) the image after dodging. (The blue area is the accurately segmented crack; the green is the pseudo cracks.).
(a)(b)


## 4.3.2. U-Net Convolutional Network Model

The convolutional network model trained in Section3.3.2 was used to segment the cracked areas in the pavement images before and after dodging, and the segmentation results are shown in Figure 10.Figure 10
Crack segmentation by the U-Net network model from (a) the original image; (b) the image after dodging. (The blue area is the accurately segmented crack; the green is the pseudo cracks.).
(a)(b)The segmentation results in Figure10 are very close, so the confusion matrix was used to quantitatively evaluate the crack segmentation results. The pixel points can be divided into four categories, TP (true positives): truly cracked pixels detected correctly; FP (false positives): noncracked pixels detected incorrectly; FN (false negatives): truly cracked pixels not detected; TN (true negatives): correctly labeled background pixels. The segmentation results were evaluated quantitatively using the accuracy P, recall R, and F1 score metrics [27], and the results are shown in Table 3.Table 3
Comparison of crack segmentation results.
Evaluation indicatorsImage aImage bImage cImage dOriginalAfter-dodgingOriginalAfter-dodgingOriginalAfter-dodgingOriginalAfter-dodgingP (%)50.6661.7666.7967.6949.2060.5847.5966.52R (%)43.9445.3554.6961.9151.3256.2933.1836.13F1 (%)47.0652.3060.1464.6750.2458.3639.1046.83The accuracyP reflects the proportion of falsely detected noncracked pixels.(27)P=TPTP+FP.RecallR reflects the proportion of actual cracks not detected by:(28)R=TPTP+FN.TheF1 score represents the summed average of accuracy and recall.(29)F1=2TP2TP+FP+FN.Analysis of the data in Table3 shows that the images after dodging have a higher crack segmentation accuracy and recall than the original images; the F1 value of the segmentation results can be improved by more than 5%.Therefore, the analysis and observation of the crack segmentation results obtained by the improved minimum path method and the U-Net network model indicate that the proposed dodging method is effective for line array images. A more accurate crack segmentation could be achieved if the proposed dodging methods preprocess the images.


## 5. Discussion

Line scan cameras are commonly used to inspect continuous materials, where the length of the acquired image is determined by the acquisition time, and therefore the image length is flexible. In this section, the proposed automatic dodging method is used to process line array images with different lengths to investigate whether the length of the image has a significant effect on the effectiveness of this method. Images with lengthL equal to 300, 600, and 900 pixels were processed separately, and a set of the resulting images was selected for presentation, as shown in Figure 11. The resultant images were analyzed quantitatively, and the results of the evaluation parameters are shown in Table 4.Figure 11
Comparison of before and after dodging results for images of different lengths: (a) original images of different lengths; (b) results of dodging of images of different lengths.
(a)(b)Table 4
Evaluation parameters of before and after dodging for images of different lengths.
Evaluation indicatorsOriginal imageThe image after dodgingL = 300L = 600L = 900L = 300L = 600L = 900M80.6684.574.45102.1105.6891.95SD14.8215.0613.515.2218.8519.35H5.935.955.795.355.685.56G7.637.228.1412.2314.4215.98LDV7.988.835.930.20.360.23According to Figure11, the dodging effect of the three images with different lengths is obvious; all of them eliminate the banding in the original image and retain the crack characteristics well. From a visual point of view, there is no significant difference in the dodging effect of the three images, and their greyscale is evenly distributed.The evaluation parameters in Table4 show that the greyscale range of the image after dodging is slightly higher. Moreover, the values of its standard deviation and the average image gradient are higher than those of the original image, which indicates that the contrast stretching effect of this method is significant. The image entropy is close to the original image, which means that the information loss during the dodging is small. The luminance distribution value is much smaller than the original image, and its dodging effect is obvious. The evaluation parameters of the different length images are close to each other, which indicates that the image length has no significant difference in the dodging effect.


## 6. Conclusions

The main contribution is an improved mask dodging method based on the idea of chunking to solve the uneven brightness of pavement line array images. There are three main points of improvement of the method.(1)
The chunking of images into sub-block before mask dodging algorithm. After compressing the image to one dimension by averaging the greyscale values of each column, the image could be chucked into some sub-blocks with the approximate greyscale change degree by introducing the cumulative slope conception, which could reduce the dodging difficulty and improve the dodging effect.(2)
The automatic dodging method proposed is highly adaptive, which is reflected in three aspects: the sub-block numbers could be auto-adjusted according to whether the dodging result meets the threshold for preset evaluation parameters, the filter size required to acquire the background image is determined by the signal-to-noise ratio of the image, and the parameters required to adjust the brightness difference among the sub-blocks are calculated by the statistics of sub-block images.(3)
The contrast stretching method is improved to be more suitable for road images with lower greyscale value, thus improving the contrast between crack features and background.The dodging evaluation of different pavement crack images shows that the automatic dodging method proposed is better than the other four methods, and the image length has no significant influence on it. Moreover, the crack segmentation results indicate that the proposed dodging method is effective for line array images, and a more accurate crack segmentation could be achieved if the images are preprocessed by the proposed dodging methods.



---

*Source: 2447359-2022-05-11.xml*