# Image Enhancement Algorithm Based on Depth Difference and Illumination Adjustment

Authors: Dan Li; Jinan Bao; Sizhen Yuan; Hongdong Wang; Likai Wang; Weiwei Liu
Journal: Scientific Programming
 (2021)

---

## Abstract

In order to improve the clarity and color fidelity of traffic images under the complex environment of haze and uneven illumination and promote road traffic safety monitoring, a traffic image enhancement model based on illumination adjustment and depth of field difference is proposed. The algorithm is based on Retinex theory, uses dark channel principle to obtain image depth of the field, and uses spectral clustering algorithm to cluster image depth. After the subimages are divided, the local haze concentration is estimated according to the depth of field and the subimages are adaptively enhanced and fused. In addition, the illumination component is obtained by multiscale guided filtering to maintain the edge characteristics of the image, and the uneven illumination problem is solved by adjusting the curve function. The experimental results show that the proposed model can effectively enhance the uneven illumination and haze weather image in the traffic scene and the visual effect of the images is good. The generated image has rich details, improves the quality of traffic images, and can meet the needs of traffic practical application.


---

## Body

## 1. Introduction

Transportation is an important part of the national economy. With the changes of weather and environment, the images collected by traffic monitoring system and electronic driving instrument have different degrees of blur, low resolution, and uneven illumination [1–3]. These phenomena will make the electronic equipment unable to recognize and judge the useful information, bring inconvenience to traffic management and life, and bring severe challenges to the following image processing works such as feature extraction, target tracking, and recognition [4, 5]. Therefore, relying on artificial intelligence and machine vision technology to enhance the traffic images obtained under haze weather and uneven illumination conditions so as to improve the clarity, contrast and visual effect is a hot topic in recent years and has important theoretical research significance and application value.The traditional histogram equalization (HE) method [6–8] is simple and efficient. The haze image has a narrow centralized histogram and low contrast. This method makes the histogram evenly distributed, expands the dynamic range of the image, and enhances the contrast, but it will lose some details. Since then, many scholars have improved the HE algorithm and proposed the bilateral histogram equalization algorithm BBHE, the adaptive histogram equalization algorithm CLAHE with limited contrast, and the algorithm ESIHE based on exposure sub-histogram equalization [9–13]. Homomorphic filtering algorithm enhances the high-frequency signal region of the original images and achieves clearer images, but the images do not conform to the human visual system, and the processed images show color distortion [14]. The recognition algorithm based on neural network [15–17] can recognize images under different illumination conditions with high accuracy, but it needs a large number of training samples, setting the number of network layers and iterations, so the training time of network model is long and the real-time performance is poor.Retinex algorithm [18–20] is a common image enhancement method. Based on the theory of color constancy, the algorithm considers that the surface information of the object in the image is determined by its own characteristics and has nothing to do with the surrounding environment. The principle of Retinex algorithm is shown in Figure 1. The image can be regarded as composed of incident image and reflected image. The incident light irradiates on the reflected object, and the reflected light enters the human eye through the reflection of the reflected object, which is the image seen by human beings. The method can be expressed as follows: I (x, y) = L (x, y) ∗ R (x, y). I (x, y) is the image to be enhanced, which is composed of reflection component R (x, y) and irradiation component L (x, y). In the traditional Retinex algorithm [21, 22], Gaussian function is used to estimate the irradiance component in the image, and then the irradiance component is subtracted from the original image in the logarithmic domain to obtain the reflection component, that is, the enhanced image. This method is feasible in the uniform illumination image, but because the global illumination has a great change, for the nonuniform illumination image, removing the illumination component will lead to the global pixel value imbalance of the reflection component, which will affect the enhancement effect. So how to calculate the radiation component correctly greatly affects the image enhancement effect. Many improved Retinex algorithms focus on how to calculate the radiation component correctly [23–26].Figure 1
Principle of Retinex algorithm.Retinex algorithm based on bilateral filtering improves the SSR and MSR algorithms with Gaussian function as the center-surround function, which can keep the image edge and overcome the halo, but it has high computational complexity and cannot deal with the blur effect of the image. The multiscale Retinex algorithm of double-guided filtering proposed by Fang et al. [27]. It assumes that the illumination component is piecewise smooth. The wavelet transform domain image fusion is used to enhance the image details and color fidelity, but the information fusion calculation cost is too high. Hong et al. [28] proposed Retinex image enhancement method based on feature extraction. The main feature images of three different scales were weighted and fused to estimate the irradiation component and then multiplied with the reflection component to construct the enhanced image, but the scale needed to be manually set. Zhuang and Ding [20] proposed a filtering Retinex algorithm based on edge preserving, which embeds the gradient domain filtering (GGF) prior to reflection and illumination into the Retinex-based variational framework to improve image structure and reduce artifacts and noise. Yoon and Choe [29] aimed at the problem that illumination and reflectivity cannot be well decomposed due to the fast change of illumination and illumination in the image, which violates the constraint of illumination smoothness. Based on the color constancy of human visual system, Yoon and Choe used sparse convolutional coding to represent reflectance, which can decompose illumination and reflectivity more accurately, so as to narrow the human-computer perception gap. Zotin [30] proposed a fast image enhancement algorithm based on multiscale Retinex for HSV color model. The linear correlation of RGB color from V component of HSV model was used to calculate the multi-scale Retinex only in the low-frequency region obtained by wavelet transform, which accelerated the image processing speed and enhanced the local contrast.On the basis of previous studies, the paper proposes a traffic image enhancement model based on illumination adjustment and depth of field difference. Firstly, based on Retinex theory, the depth of field is obtained by using dark channel principle. Then, the image depth is clustered by spectral clustering algorithm. After dividing subimages, the local haze concentration is estimated according to the image depth of field, and the subimage is enhanced adaptively and fused. In addition, the illumination component is obtained by multiscale guided filtering to keep the edge characteristics of the image and adjust the curve function to solve the problem of uneven illumination.


## 2. Retinex Algorithm Theory

In Retinex algorithm,I (x, y) = L (x, y) ∗ R (x, y), where L (x, y) represents the illumination component, the noise, haze, and other interferences of the surrounding environment on the image, which needs to be removed. R (x, y) represents the reflection component, which is the original appearance of the image [26, 31]. The algorithm uses the original image I (x, y) to estimate and removes the illumination component L (x, y) to obtain the actual feature information. In order to reduce the computational complexity, it is converted to logarithmic domain, and the above equation is changed from multiplication operation to addition operation, and the expression is shown in the following equation:(1)logIx,y=logLx,y+logRx,y,(2)Fx,y=12πσ2exp−x2+y22σ2,(3)logRx,y=logIx,y−logIx,y∗Fx,y.In the single-scale Retinex algorithm [32, 33], the irradiance component logLx,y is estimated by convolution of the original image logIx,y and Gaussian surround function Fx,y. The reflection component logRx,y can be obtained according to equation (1). The Gaussian surround function is shown in equation (2), and the reflection component is shown in equation (3). In Retinex algorithm, the larger the scale parameter σ of Gaussian surround function is, the larger the Gaussian template is. Although the enhanced image is smoother and the color is fidelity, the image details are poor. The value of σ generally does not exceed 300. When the scale parameter σ is small, the detail enhancement is prominent, and the pixels are easily affected by the surrounding, resulting in color difference and halo. In order to compromise the advantages and disadvantages, as shown in the following equation, the multiscale Retinex algorithm (MSR) is obtained by multiscale weighting method:(4)logRx,y=∑i=1nwilogIix,y−logIix,y∗Fix,y.In equation (4), n=3, σ takes low, medium, and high three scales, w is the weight, and ∑i=1nwi=1.The multiscale Retinex algorithm [30, 34, 35] eliminates the halo and has good sharpening effect, which can improve the balance between detail enhancement and high color fidelity of single-scale Retinex algorithm. However, the restored RGB channels cannot maintain the original proportion, the processed image color is often distorted, and the image color is grayish. In order to solve this problem, Rahman et al. introduced a color recovery factor to compensate for color distortion and obtained Retinex algorithm with color recovery (MSRCR). MSRCR has better control of color deviation and has certain color fidelity, as shown in the following formula: (5)RMSRCRjx,y=Cjx,y∗RMSRjx,y,where Cjx,y is the color recovery factor of the jth color channel, and its expression is shown in formula (6). In formula (6), α and β are the adjustment parameters, and Ijx,y is the distribution of the original image in the jth color channel:(6)Cjx,y=βlogαIjx,y−log∑j=13Ijx,y.


## 3. Image Depth Clustering Based on Spectral Clustering Algorithm

### 3.1. Image Depth Acquisition

Compared with SSR, MSR and MSRCR consider the influence of different scales on haze image enhancement, but they are still global enhancement in essence, without considering the local differences of images. In order to better enhance the local area of haze image adaptively, the paper calculates the image depth based on the principle of dark channel [36–38]. The principle of dark channel is that the image has three RGB channels, and at least one pixel value is low. The principle is based on the atmospheric scattering model [39, 40], and its mathematical expression is shown in equation (7), where Sx represents the image with fog. Qx represents the image without fog, A represents the global atmospheric illumination, and tx is the perspective ratio. In equation (8), Qcx is a color channel of Q and Qdarkx is the dark channel of Q.(7)Sx=Qxtx+A1−tx,(8)Qdarkx=minc∈R,G,Bminx∈ΩxQcx.The transmission estimation is obtained by dark channel, and the formula is shown as follows:(9)tx=1−ωminc∈R,G,BScxAc,where ω is the regulating factor, which is within the range of (0, 1). According to the relationship between the atmospheric scattering coefficient β and the depth of field d, the image depth is calculated as follows:(10)tx=e−β⋅dx,dx=lntx−β.According to the prior dark channel theory, the depth of field is related to the distance between the object and the photographer, and the haze concentration is positively correlated with the image depth. In this paper, the haze concentration distribution in the image is obtained according to the image depth, and the subimage is enhanced with different scales according to the depth of field of the image, which can enhance the image details and improve the defogging effect.


### 3.2. Spectral Clustering Algorithm for Image Depth Clustering

K-means clustering algorithm [41, 42] uses distance as evaluation index, finds the best clustering center through iterative calculation, and classifies the data. In the process of calculation, the measurement distance of all data is calculated for clustering. When dealing with high-dimensional data, the distance difference between samples is no longer obvious, resulting in high time and space complexity of the algorithm. Compared with distance-based algorithms such as k-means, spectral clustering keeps the relevant information among samples as much as possible and has higher computational efficiency.Based on the idea of graph theory, spectral clustering algorithm [43, 44] regards the sample as points in the space and then connects the vertices through edges. The weight of each edge represents the similarity degree of sample points, and the larger the weight, the higher the similarity between samples. Otherwise, the similarity is smaller. A series of subgraphs are obtained by cutting the constructed graph, which satisfies the goal of maximum edge weight and minimum edge weight in subgraph as far as possible. Each subgraph corresponds to a cluster. Spectral clustering method maps the relationship between high-dimensional data and two-dimensional graph to achieve the purpose of dimension reduction. In this paper, the full connection method based on Gaussian kernel distance is adopted, and the normalized cuts (Ncut) method is used to introduce the flow of spectral clustering algorithm.Algorithm 1: Spectral clustering algorithm.
Input: Sample setX=x1,x2,x3,…,xn;The number of clusters isK;Output: Cluster partitionC=c1,c2,c3,…,ck;(1)
Calculate affinity matrixW;(2)
Calculating degree matrixD;(3)
Computing Laplacian matrixL;(4)
Construction of standardized Laplacian matrixD−1/2LD1/2;(5)
Calculate the firstk small eigenvalues and corresponding eigenvectors in D−1/2LD1/2;(6)
Feature matrixF is constructed from the feature vector and the feature matrix is normalized by row;(7)
K-means clustering is used to cluster n samples in F;(8)
Get cluster partitionC.In this paper, spectral clustering algorithm is used to cluster the image depth, so as to obtain subimages with different depth of field in haze scene.


### 3.3. Adaptive Image Enhancement

Due to the positive correlation between the depth of field and the fog concentration, the local image enhancement can be realized under different haze concentrations. In Retinex algorithm, when the scaleσ is small, the image enhancement details are better, and the overall situation is poor. Retinex algorithm is suitable for the scene with high haze concentration. When the scale σ is large, the enhancement effect is poor, but the fidelity of image color is better. According to the analysis, image depth dand scale σ also have a positive correlation. In this paper, a variable filter is designed according to the self-adaptive value σ mapped by different depths of field d in different images. After spectral clustering as shown in Algorithm 1, the image is divided into n subgraphs with different depths according to the number of clusters. According to equation (11), the average depth DMEANS of each subgraph is calculated. DMEANS=dMEAN1,dMEAN2,…,dMEANn, m is the total number of depth of field values, and dixj,yj is the jth depth of field value of block i subgraph. The mapping of scale σ is designed according to the average depth, as shown in equation (12). The scale σ=σ1,σ2…σn, n is the total number of subgraphs, dMAX is the maximum depth of field, dMIN is the minimum depth of field, and dMEANi is the average value of the ith subgraph. Each pixel in the subgraph has a similar depth. σMAX is the maximum of scale σ and σMIN is the minimum of scale σ. Take σ, where σi∈σ:(11)DMEANS=1m∑i=1n∑j=1mdixj,yj,(12)σ=∑i=1ndMAX−dMEANidMAX−dMIN∗σMAX−σMIN+σMIN.The variable filter is as follows:(13)Fx,y=12πσi2exp−x2+y22σi2.Spectral clustering as shown in Algorithm1 is used to cluster the depth image. The scale σ of different depth regions is calculated according to the variable filter. Retinex algorithm with color gain weighting is used for the image according to different scales for many times. According to different depth subimages, n defogging images can be obtained. Each image is enhanced adaptively, and the final output image is obtained by fusing the subimages. The final fusion image R is expressed as R=∑i=1nPi. Mi∈M, M=m1,m2,…,mn is the sub image in the ith defogging image.


## 3.1. Image Depth Acquisition

Compared with SSR, MSR and MSRCR consider the influence of different scales on haze image enhancement, but they are still global enhancement in essence, without considering the local differences of images. In order to better enhance the local area of haze image adaptively, the paper calculates the image depth based on the principle of dark channel [36–38]. The principle of dark channel is that the image has three RGB channels, and at least one pixel value is low. The principle is based on the atmospheric scattering model [39, 40], and its mathematical expression is shown in equation (7), where Sx represents the image with fog. Qx represents the image without fog, A represents the global atmospheric illumination, and tx is the perspective ratio. In equation (8), Qcx is a color channel of Q and Qdarkx is the dark channel of Q.(7)Sx=Qxtx+A1−tx,(8)Qdarkx=minc∈R,G,Bminx∈ΩxQcx.The transmission estimation is obtained by dark channel, and the formula is shown as follows:(9)tx=1−ωminc∈R,G,BScxAc,where ω is the regulating factor, which is within the range of (0, 1). According to the relationship between the atmospheric scattering coefficient β and the depth of field d, the image depth is calculated as follows:(10)tx=e−β⋅dx,dx=lntx−β.According to the prior dark channel theory, the depth of field is related to the distance between the object and the photographer, and the haze concentration is positively correlated with the image depth. In this paper, the haze concentration distribution in the image is obtained according to the image depth, and the subimage is enhanced with different scales according to the depth of field of the image, which can enhance the image details and improve the defogging effect.


## 3.2. Spectral Clustering Algorithm for Image Depth Clustering

K-means clustering algorithm [41, 42] uses distance as evaluation index, finds the best clustering center through iterative calculation, and classifies the data. In the process of calculation, the measurement distance of all data is calculated for clustering. When dealing with high-dimensional data, the distance difference between samples is no longer obvious, resulting in high time and space complexity of the algorithm. Compared with distance-based algorithms such as k-means, spectral clustering keeps the relevant information among samples as much as possible and has higher computational efficiency.Based on the idea of graph theory, spectral clustering algorithm [43, 44] regards the sample as points in the space and then connects the vertices through edges. The weight of each edge represents the similarity degree of sample points, and the larger the weight, the higher the similarity between samples. Otherwise, the similarity is smaller. A series of subgraphs are obtained by cutting the constructed graph, which satisfies the goal of maximum edge weight and minimum edge weight in subgraph as far as possible. Each subgraph corresponds to a cluster. Spectral clustering method maps the relationship between high-dimensional data and two-dimensional graph to achieve the purpose of dimension reduction. In this paper, the full connection method based on Gaussian kernel distance is adopted, and the normalized cuts (Ncut) method is used to introduce the flow of spectral clustering algorithm.Algorithm 1: Spectral clustering algorithm.
Input: Sample setX=x1,x2,x3,…,xn;The number of clusters isK;Output: Cluster partitionC=c1,c2,c3,…,ck;(1)
Calculate affinity matrixW;(2)
Calculating degree matrixD;(3)
Computing Laplacian matrixL;(4)
Construction of standardized Laplacian matrixD−1/2LD1/2;(5)
Calculate the firstk small eigenvalues and corresponding eigenvectors in D−1/2LD1/2;(6)
Feature matrixF is constructed from the feature vector and the feature matrix is normalized by row;(7)
K-means clustering is used to cluster n samples in F;(8)
Get cluster partitionC.In this paper, spectral clustering algorithm is used to cluster the image depth, so as to obtain subimages with different depth of field in haze scene.


## 3.3. Adaptive Image Enhancement

Due to the positive correlation between the depth of field and the fog concentration, the local image enhancement can be realized under different haze concentrations. In Retinex algorithm, when the scaleσ is small, the image enhancement details are better, and the overall situation is poor. Retinex algorithm is suitable for the scene with high haze concentration. When the scale σ is large, the enhancement effect is poor, but the fidelity of image color is better. According to the analysis, image depth dand scale σ also have a positive correlation. In this paper, a variable filter is designed according to the self-adaptive value σ mapped by different depths of field d in different images. After spectral clustering as shown in Algorithm 1, the image is divided into n subgraphs with different depths according to the number of clusters. According to equation (11), the average depth DMEANS of each subgraph is calculated. DMEANS=dMEAN1,dMEAN2,…,dMEANn, m is the total number of depth of field values, and dixj,yj is the jth depth of field value of block i subgraph. The mapping of scale σ is designed according to the average depth, as shown in equation (12). The scale σ=σ1,σ2…σn, n is the total number of subgraphs, dMAX is the maximum depth of field, dMIN is the minimum depth of field, and dMEANi is the average value of the ith subgraph. Each pixel in the subgraph has a similar depth. σMAX is the maximum of scale σ and σMIN is the minimum of scale σ. Take σ, where σi∈σ:(11)DMEANS=1m∑i=1n∑j=1mdixj,yj,(12)σ=∑i=1ndMAX−dMEANidMAX−dMIN∗σMAX−σMIN+σMIN.The variable filter is as follows:(13)Fx,y=12πσi2exp−x2+y22σi2.Spectral clustering as shown in Algorithm1 is used to cluster the depth image. The scale σ of different depth regions is calculated according to the variable filter. Retinex algorithm with color gain weighting is used for the image according to different scales for many times. According to different depth subimages, n defogging images can be obtained. Each image is enhanced adaptively, and the final output image is obtained by fusing the subimages. The final fusion image R is expressed as R=∑i=1nPi. Mi∈M, M=m1,m2,…,mn is the sub image in the ith defogging image.


## 4. Illumination Estimation Based on Multiscale Guided Filtering

Because the Gaussian filter in Retinex algorithm does not have the ability to preserve the edges and corners, when the filter size is enlarged, the high-brightness area in the illumination component will also be enlarged accordingly, so the phenomenon of white overenhancement around the high-brightness area appears. In order to solve the problem of over enhancement, this paper uses multiscale guided filtering to obtain the illumination component and adjusts the illumination component through the curve function to achieve the purpose of low-brightness enhancement, high-brightness suppression and maintain the edge characteristics.


### 4.1. Obtaining Illuminance Component by Multiscale Guided Filtering

The maximum value of the three channels at each pixel position is used to estimate the illumination component. As shown in equation (14), Lx,y represents the maximum value of three channels of image Scx,y on x,y. A multiscale guided filter with edge and corner preserving characteristics is selected to estimate the illuminance component as shown in equation (15). K is the guide image, r is the filter size, and ⊕GK,r is the guided filter used on Lx,y. The illuminance component Fx,y is obtained by guided filtering.(14)Lx,y=maxc∈r,g,bScx,y,(15)L′x,y=13∑r∈r1,r2,r3Lx,y⊕GK,r,(16)r1=18minh,w,(17)r2=12maxh,w−1,(18)r3=12r1+r2.The size of the filter is set as shown in the above-given formulas, whereh and w are the height and width of the image. The more detailed information is contained in the illuminance component, the larger size of the filter is.


### 4.2. Illumination Adjustment

In order to suppress the pixel value of the high brightness area in the traffic image and improve the pixel value of the low brightness area, it is necessary to balance the illumination components after the above processing. The common methods can only adjust the overall image brightness, but many images are nonuniform illumination images, which will cause overenhancement. In this paper, the curve function is used to adjust the brightness of the illumination component to achieve the suppression of the high brightness area and the enhancement of the low brightness area.(19)Ladjx,y=αL′x,yγ+1−αL′x,y1/γ.As shown in equation (19), Ladjx,y is the output image after equalization, L′x,y is the image to be processed, α and γ are the adjustment coefficients, and the value range is [0.1, 2.0]. Figure 2 is a curve function diagram, the x-axis represents the image to be processed, and the y-axis represents the image after processing. It can be seen that in the curve function, the coefficient γ controls the rate of change of the function. When x ∈ [0, 0.55], the curve is a convex function to enhance the pixel value. When x ∈ (0.55, 1), the curve is a concave function to suppress the pixel value. Therefore, by adjusting the coefficient in the function, the illumination component L′x,y is acted on, and the balanced illumination component Ladj (x, y) is obtained. The traffic haze image is dark as a whole, so it is necessary to improve the illumination of the dark area and suppress the highlight area. Therefore, the value of this paper is set to 0.6, which can reasonably adjust the illumination according to the nonuniform characteristics of the traffic image.Figure 2
Curve function.The reflection component of the image can be obtained by equation (20). Ladjx,y is the illuminance component, Icx,y is the pixel value of the color channel, and Rcx,y is the corresponding reflection component. For the convenience of calculation, it can be completed in the logarithm field by equation (21).(20)Rcx,y=Icx,yLadjx,y,(21)logRcx,y=logIcx,y−logLadjx,y.


## 4.1. Obtaining Illuminance Component by Multiscale Guided Filtering

The maximum value of the three channels at each pixel position is used to estimate the illumination component. As shown in equation (14), Lx,y represents the maximum value of three channels of image Scx,y on x,y. A multiscale guided filter with edge and corner preserving characteristics is selected to estimate the illuminance component as shown in equation (15). K is the guide image, r is the filter size, and ⊕GK,r is the guided filter used on Lx,y. The illuminance component Fx,y is obtained by guided filtering.(14)Lx,y=maxc∈r,g,bScx,y,(15)L′x,y=13∑r∈r1,r2,r3Lx,y⊕GK,r,(16)r1=18minh,w,(17)r2=12maxh,w−1,(18)r3=12r1+r2.The size of the filter is set as shown in the above-given formulas, whereh and w are the height and width of the image. The more detailed information is contained in the illuminance component, the larger size of the filter is.


## 4.2. Illumination Adjustment

In order to suppress the pixel value of the high brightness area in the traffic image and improve the pixel value of the low brightness area, it is necessary to balance the illumination components after the above processing. The common methods can only adjust the overall image brightness, but many images are nonuniform illumination images, which will cause overenhancement. In this paper, the curve function is used to adjust the brightness of the illumination component to achieve the suppression of the high brightness area and the enhancement of the low brightness area.(19)Ladjx,y=αL′x,yγ+1−αL′x,y1/γ.As shown in equation (19), Ladjx,y is the output image after equalization, L′x,y is the image to be processed, α and γ are the adjustment coefficients, and the value range is [0.1, 2.0]. Figure 2 is a curve function diagram, the x-axis represents the image to be processed, and the y-axis represents the image after processing. It can be seen that in the curve function, the coefficient γ controls the rate of change of the function. When x ∈ [0, 0.55], the curve is a convex function to enhance the pixel value. When x ∈ (0.55, 1), the curve is a concave function to suppress the pixel value. Therefore, by adjusting the coefficient in the function, the illumination component L′x,y is acted on, and the balanced illumination component Ladj (x, y) is obtained. The traffic haze image is dark as a whole, so it is necessary to improve the illumination of the dark area and suppress the highlight area. Therefore, the value of this paper is set to 0.6, which can reasonably adjust the illumination according to the nonuniform characteristics of the traffic image.Figure 2
Curve function.The reflection component of the image can be obtained by equation (20). Ladjx,y is the illuminance component, Icx,y is the pixel value of the color channel, and Rcx,y is the corresponding reflection component. For the convenience of calculation, it can be completed in the logarithm field by equation (21).(20)Rcx,y=Icx,yLadjx,y,(21)logRcx,y=logIcx,y−logLadjx,y.


## 5. Experiment and Performance Analysis

MATLAB 2018 is used to compile the algorithm code. The computer is configured with i7 processor, 8G RAM, and Windows 10 operating system. The following figures show the comparison results of our algorithm in haze environment with other algorithms. The experimental scenes include sidewalk, fields, house, intersection, woods, and crossing.Figure3 gives the dark channel images of the new algorithm in Figure 4. The images in Figures 3 and 4 are part of the dataset established by our research group. As can be seen in Figure 4, the overall brightness and contrast of the image are relatively low, and some images have the characteristics of relatively high brightness value in small areas. Some areas of HE become noise due to excessive contrast enhancement; some areas become darker or brighter after adjustment and lose detail information. In the nonuniform illumination environment, it is easy to produce color distortion and overenhancement. MSR has better detail and local contrast than HE algorithm, but when estimating the illumination image, MSR always assumes that the initial illumination image changes slowly; that is, the illumination image is smooth. However, this is not the case in reality, so the illumination change of the image is not smooth at the edge of the area with large difference in brightness. Therefore, in this case, the enhanced image in the area with large brightness difference will produce halo, and the image processed by MSRCR is generally white. For the uneven distribution of haze concentration in the image, the MSRCR algorithm cannot achieve local dynamic enhancement, the texture is not clear enough, and the details are not significantly improved. In this paper, the image enhancement algorithm based on illumination adjustment and depth of field difference has a good effect on haze and nonuniform illumination images captured in different scenes. It can enhance the brightness and contrast of the images, and the results of processing have higher brightness and more obvious details. At the same time, it can maintain the natural color, improve the brightness and contrast of the dark area, and suppress the high brightness area.Figure 3
Dark channel images of proposed algorithm in Figure4.
(a)(b)(c)(d)(e)(f)Figure 4
Comparison of different enhancement algorithms.Next, the obtained image performance indicators are evaluated objectively, and their peak signal-to-noise ratio (PSNR), average local standard deviation, average local information entropy, and structural similarity (SSIM) and Brenner gradient function values are calculated, respectively, to analyze and evaluate the image contrast, detail information richness, and clarity.The peak signal-to-noise ratio (PSNR) quantifies the damage degree of noise to the original image. The higher the PSNR is, the better the denoised image signal is. For imageI and K, the mean square error and PSNR are defined as follows, where the size of the image is M×N:(22)MSE=1M×N∑i=0M−1∑j=0N−1Ii,j−Ki,j2,PSNR=10log102552MSE.Local standard deviation is defined as equation (23). When local window block size n is (2d + 1) ∗ (2d + 1), the average value of local standard deviation of the whole image is the average local standard deviation.(23)Lstdx=1n−1∑x=1nfEx2−1n∑x=1nfEx2.Local information entropy refers to the mean value of local information entropy of the whole image. The definition of local information entropy is shown in the following equation, wherep (r) is the probability of the pixel value r in the local window and rmax is the maximum value of the pixel value:(24)Lepyx,y=−∑r=0rmaxprlog2pr,r=fEx,y,x,y∈2d+1,2d+1.Structural similarity measure (SSIM) is used to measure the similarity and distortion of two images. The definition of structural similarity of two imagesx and y is shown in the following equation: (25)SSIMx,y=2μxμy+c12σxy+c2μx2μy2+c1σx2+σy2+c2,where μx and μy represent the mean values of x and y, σxy represents the covariance of x and y, σx2 and σy2 represent the variances of x and y, and c1 and c2 are constants to maintain stability.The definition of Brenner gradient function is shown in the following equation, wherem and n represent the numbers of rows and columns of the image ƒ. The larger the value of Clty is, the clearer the image is. thr is the limit of Brenner gradient function.(26)Cltyf=1mn∑x=1m−2∑y=1ntx,y,t>thr,tx,y=fx+2,y−fx,y2.As shown in Table1, the image performance index of the new algorithm is better than other algorithms, and the contrast, clarity, effective noise suppression, and texture details of the enhanced image are improved.Table 1
Performance comparison of image enhancement algorithms.
ImageEnhancement algorithmsPeak signal-to-noise ratioLocal standard deviationLocal information entropyStructural similarity measureBrennerSidewalkHE17.54120.57510.2450.09448.152MSR22.18526.72615.5470.10551.454MSRCR26.95126.95716.9510.46750.946The paper29.67633.84118.4270.67855.215FieldsHE19.68321.4789.4560.06750.149MSR21.47726.75713.2840.10652.364MSRCR25.94530.47416.8760.47860.247The paper30.47739.65520.4680.70965.151HouseHE22.31823.85712.4530.06451.013MSR25.78330.47814.5490.20754.821MSRCR28.64437.51714.0570.48559.564The paper31.57947.39519.5340.78461.046IntersectionHE18.92319.0729.4510.07546.254MSR21.75427.84811.3450.27149.237MSRCR24.67726.76613.2290.45453.954The paper29.46536.17718.3720.72957.320WoodsHE24.63430.47812.6950.11652.085MSR25.72228.35515.6240.27853.642MSRCR27.95437.93717.7840.46460.532The paper30.42842.08421.6680.85163.954CrossingHE20.57221.37511.0620.09448.265MSR22.27329.65313.2730.29651.254MSRCR26.02433.57916.5240.48755.821The paper29.86438.92720.4320.80460.795


## 6. Conclusion

According to the characteristics of complex traffic scene images, based on Retinex algorithm, a new traffic image enhancement algorithm based on illumination adjustment and depth difference is proposed. The algorithm processes the illumination component and the reflection component separately, obtains the image depth of field by using the dark channel principle, divides the image depth into the molecular graph through the spectral clustering algorithm, and estimates the local haze concentration according to the image depth of field. The improved multiscale guided filter estimates the illumination component and adjusts the curve function to solve the problem of uneven illumination. The results show that the algorithm can effectively enhance the uneven illumination and haze images in road traffic scene and avoid overenhancement and halo blur in local area. Compared with other algorithms, the effect of the new enhancement algorithm is better.



---

*Source: 6612471-2021-07-17.xml*