Abstract
GPS monitoring systems and the development of driverless vehicles are almost inseparable from camera images. The images taken by traffic cameras often contain certain sky areas and noise, the traditional dark channel prior (DCP) algorithm easily produces color distortion and halo effect, when processing the hazy traffic images with sky and high brightness areas. An optimized Retinex model and dark channel prior algorithm (ORDCP) is proposed in this paper. Firstly by adjusting the calculation method of dark channel image, the proportion of dark channel is improved; Then, the transmittance image is corrected and smoothed by guided filtering and mean filtering. Finally, the Retinex model is fused to save the details.ORDCP corrects the inaccurate calculation of scene transmittance value in DCP algorithm,and modifies some dehazing problems, such as the loss of details, halo effect, contrast and color distortion,etc. Using information entropy (IE) as the objective evaluation index, combined with the subjective evaluation, it is concluded that the algorithm proposed in this paper can effectively retain the detailed information of the image, and eliminate the halo effect. Meanwhile, it meets the visual characteristics of human eyes better, and has some practicality and applicability in traffic control and intelligent detection.
Introduction
Modern intelligent traffic monitoring systems can intuitively monitor the escape direction, license plate and color of hit and run vehicles.However, on hazy days, the imaging equipment is affected by atmospheric suspended particles and atmospheric light. It reduces the image contrast, blurs the details, and greatly reduces the image quality.As a result, the captured images cannot be directly applied to video surveillance [34], traffic surveillance [9], driver assistance [20], etc., adding difficulty to traffic control. If the traffic monitoring system directly uses the degraded image or videos for image processing, the system will not be able to normally collect image or video information and road monitoring, which will cause hidden dangers to traffic safety,there have been many traffic accidents caused by haze in the world. In order to reduce the occurrence of traffic accidents and improve the impact of weather conditions on image quality, exploring good adaptive image dehazing methods has become the research focus of many scholars. Statistics show that due to the driving speed of vehicles, a certain perspective shooting is required when take photos for the traffic areas.The collected traffic images often contain sky areas,and mixed areas of sky roads and buildings, the images may also contain a certain amount of noise due to haze.Therefore, the clarity of the mixed area and the problem of denoising should be considered when image dehazing. Only by better solving this problem,traffic image dehazing can better serve traffic control and computer vision image processing equipment.
The image dehazing algorithms are usually used on two types of images: multiple images and single images.Multiple images dehazing should get many images in the same scene to obtain multiple reference conditions to achieve dehazing, based on the video of multiple images [25] achieved image dehazing. As its essence is also dealing with a single image, more scholars focus on the dehazing algorithm of a single image. At present, single image dehazing methods are mainly divided into three kinds: methods based on atmospheric scattering physical model, image enhancement and methods based on deep learning.
Nayer and Narasimhan [22] described and deduced the atmospheric scattering model in detail and were widely referenced by later researchers [12, 21]. It mainly analyzed the leading causes of haze image degradation from the perspective of mathematics, according to some prior information, set parameters, established mathematical model, and realized image restoration.He et al. [11] proposed the dark channel prior (DCP) dehazing method based on amount of image experiments, but because of the soft matting method adopted for the transmission map, the processing speed is slow, and the halo effect is easy to appear when dealing with hazy images containing sky aeras.In order to solve these problems, there are many subsequent improvement studies based on dark channels, such as [4, 24]. Literature [10, 24] used guided filtering to replace soft matting,in order to optimize the transmission image,but there is still a problem that the hazed image is not very clear.Literature [31] used dark channel prior and bright channel prior combined with multi-scale retina algorithm, to dynamically optimize the transmission map, which improves the dehazed image. In order to reduce the processing time,in [13] a global dehazing method (IDGCP) was proposed, by using gamma correction preprocessing (GCP), and uniform virtual transformation on hazy images. However, due to the inherent limitations of the atmospheric scattering model (ASM), the fuzzy effect will appear in the restoration results. In order to solve this problem, Ju et al. [14] obtained an enhanced ASM (EASM) by introducing light absorption coefficient into ASM, then gray-world-assumption-based technique called IDE is developed to enhance hazy images.
The dehazing algorithms based on image enhancement are to adjust the brightness, chroma and saturation of the hazy images, highlight the region of interest information, and suppress the information of the uninterested part to achieve the purpose of dehazing. The classical algorithms mainly include histogram equalization enhancement [6, 30], Retinex theoretical model based methods [8, 37] and filtering enhancement optimizations [5, 32]. Methods based on histogram equalization usually considers the global or local problems, as well as background enhancement and noise suppression. Contract limited adaptive histogram equalization (CLAHE) [15] used block processing and contrast limitation, combined with interpolation to realize haze removal, but some processed images had a little color distortion; For reducing color distortion and block effect, Kim et al. [16] proposed a partially overlapped sub block histogram algorithm, which determined the step size and the center point of the sub block through sub block’s size,it optimized the gray value of the dehazed image.Retinex theoretical model was proposed by Edwin land et al [8] in 1963,it enhanced the image according to its structural features and the theory of color constancy, [37] used it to realize haze and noise removal. Literature [18, 33] made an in-depth study on the application of Retinex in traffic image haze removal and traffic sign recognition, concluded that Retinex can be used for image haze removal. The dehazing algorithm based on deep learning [1, 36] usually trains images, according to the constructed neural network to realize dehazing, because there are so many images to be trained, the computational complexity is high. Literature [19, 27] combines Retinex model with other algorithms to optimize haze removal. [19] uses Retinex and guided filter to extract the edge of lane line, suppress the noise in the dark of lane line, and improve the detection success rate of auxiliary driving system.
The dark channel prior algorithm is more suitable for haze images with moderate illumination, on which it can get a better visual effect. However, due to the problems of channel selection and merging, the restored image will be darkened, and color distortion and halo effect will easily appear in the sky or river area.But the restored image darkens due to the problems of channel selection and merging, and the sky or river area is prone to color distortion and halo effect. A series of dehazing algorithms based on Retinex model can restore the color of the enhanced image to a high degree, keep the original brightness and structural features of the image, and suppress the halo to a certain extent. However, the mosaic effect is easy to appear when the processing is based on the structural characteristics. The purpose of traffic image dehazing is mainly reflected in traffic sign recognition. The traffic signboard is in a relatively high position and is vulnerable to the influence of haze in the sky, while the information such as vehicle license plate is in a relatively low position and is vulnerable to the influence of ground dust particles. In order to correct the limitations of the above methods, this paper proposes the ORDCP algorithm optimized by the improved Retinex model and the dark channel prior, which shows a good processing effect for foggy images with sky area and high brightness areas. The ORDCP algorithm is mainly innovated and improved from the following three points:
The first point is to adjust the dark channels of the calculation, increase the proportion of dark channel, and optimize the dark channel image;
Secondly, the guided filter and mean filter are used to optimize the initial transmittance, and the flexible weighted average is used to correct the transmittance, so as to take into account the maintenance and denoising of image edge and other details;
Thirdly, considering the advantages of Retinex model in color retention, the specific quantization ratio is given by integrating Retinex model and optimized dark channel dehazing algorithm. The algorithm proposed in this paper can effectively process hazy traffic images, especially those with sky area, and can effectively repair color distortion and the Mosaic effect.
Theoretical basis
Theoretical analysis of retinex dehazing
Retinex theoretical dehazing algorithm is abbreviated as SSR algorithm [35, 37], which is based on the consistency of color sense. The theory holds that the color of an object is determined by the ability of the object to reflect longwave, mediumwave, and short wave light. These three waves correspond to red, green, and blue, and the illumination heterogeneity does not affect the object’s color. The mathematical expression of the algorithm is:
where (x, y) is the coordinate of pixel point, I (x, y) is the original hazy image, t (x, y) is the incident image with low-frequency information, and J (x, y) is the desired reflected image with high-frequency information such as image details. The core of the Retinex method is to estimate t (x, y) components from the image I (x, y) and then remove the influence t (x, y) to obtain the original reflection component J (x, y). In specific processing, the image is usually transferred to the logarithmic domain, convolved with Gaussian filter, and then represented to estimate the clear image of the original image after dehazing, so as to match the characteristics of human eye brightness perception.
The process of the Retinex model combined with the Gaussian filtering dehazing algorithm is as follows: After logarithmic transformation, in the frequency domain after Fourier transforms, the Gaussian function H (x, y) is convolved with the Fourier transform result of the original image I (x, y) to obtain the low-pass filtered image D (x, y), namely:
In the logarithmic domain, subtract the low-pass filtered image from the original image to obtain the high-frequency enhanced image:
Take the inverse function of C (x, y) to obtain the enhanced output image: J (x, y)
The single-scale Retinex model has strong robustness in the dehazing effect, but it lacks color-level continuity for traffic image dehazing. One of the classical algorithms to improve the SSR algorithm is the multi-scale Retinex algorithm (MSRCR algorithm), which is based on Gaussian kernel to obtain the estimated dehazing image, expressed as [2]:
Where N is the total scale number, * is the convolution symbol, and H
n
(x, y) is the Gaussian circumferential function,
The image degradation process on haze days can usually be represented by the following atmospheric scattering model [11]:
Where
The purpose of dark channel dehazing is to calculate the target value J (
where x is the pixel position, J c represents one of the R, G, and B channels of J, Ω (x) represents the local area centered on pixel X, and J dark is the final dark channel.
He et al. took Equation (5) as the constraint condition for solving Equation (4) and obtained the image J ( Transmittance estimation: Get the atmospheric light value A from the hazy image with the help of dark channel image, then the transmittance is estimated in combination with constraint condition Equation (5), record this transmittance as where ω ∈ (0, 1], usually take ω = 0.95. Soft matting and recovering the scene radiance: restrict the transmission t (
DCP algorithm in the image to haze has achieved great success, but in the process of solving, assumptions t (
ORDCP algorithm framework
Since single-scale Retinex can not give attention to the problem of natural color transition while highlighting the details, and the MSRCR algorithm enhances three color channels together, these color channels may affect each other, making the dehaze image prone to unnatural color transition. DCP algorithm can easily cause Halo effect in hazy image with sky region, as shown in Fig. 1.

Comparison of haze removal between Retinex model and dark channel prior.
Traffic control cameras have a certain demand for tracking images, so traffic images often contain certain sky areas and dust particle noise. Based on this, a new algorithm is proposed in this paper to complete the dehazing of traffic images containing sky are as to prepare for the next step of traffic sign recognition. The flow of ORDCP algorithm is shown in Fig. 2 below:

The flow of the ORDCP algorithm.
The process of this algorithm is mainly divided into three steps: By observing the characteristics of a large number of hazy images containing sky regions, optimized and adjusted the calculation method of dark channel image, and further smoothed the dark channel image by using a median filter; then calculated the global light value A and the initial transmittance; The initial transmittance is optimized jointly by guided filtering and mean filtering, and the transmittance is modified flexibly; Weighted fusion of Retinex dehazing and optimized dark channel dehazing algorithm is used. Different weight coefficients can be selected according to different images.
In terms of subjective and objective indexes, the algorithm proposed in this paper can effectively remove hazy images containing sky regions.
Dark channel optimization
Optimization algorithm is mainly realized by modifying the calculation method of dark channel image and optimizing the transmittance map. First of all, the histograms of dark channel images of some images with sky regions are counted, we find that the dark channel histogram of DCP algorithm basically shows a right deviation distribution. Because the scope is too large, the proportion of dark channels in the DCP algorithm is too small, which easily leads to a dark defogging effect, and the defogging effect is poor for images with sky areas or large white areas, as shown in Fig. 3. The histogram deviation to the right may be caused by high brightness areas such as sky area, so the new algorithm selects part of the color channel to be reversed and revises the dark channel’s calculation method to enhance brightness. The improved dark channel in this paper is as follows:
In Equation (8), J r represents the red channel, x, Ω (x) and J dark has the same meaning as that in Equation (5).
In order to remove the influence of haze and dust in traffic images, the 3 × 3 median filter is used to replace the minimum filter in DCP to further smooth dark channels and remove noise. Dark channel graphs and histograms of images before and after dark channel optimization are shown in Figs. 3-4 below.

The dark channel and histogram of Traffic 1.

The dark channel and histogram of Road.
As can be seen from Figs. 3-4, the improved dark channel image boundary is clearer, as the median filter can maintain the details such as image edges. The gray level of the improved dark channel gray histogram decreases to less than 50% of the maximum brightness of 255. If less than 25 gray levels are used as dark channels, the proportion of dark channels is greatly increased by the improved dark channels. This is because the sky is very far from the shooting point, the depth of field d(x) is considerable, while the DCP algorithm is based on dark channel preference, that is, assuming that t(x) ⟶ 1. As t (
The first 0.1% pixel is taken from the dark channel map according to the brightness size, find the value of the corresponding point in these positions, let the highest brightness in the original foggy image as the global atmospheric light value A. Then, according to Equation (6), the initial transmittance based on the dark channel prior is calculated.
Transmission optimization
DCP algorithm adopts the soft image matting algorithm when optimizing the transmission graph, which will consume much memory and slow the processing speed. In order to solve the problems, the guided filter method is adopted in this paper to replace the soft matting algorithm to optimize the transmitted image. A guided filter can suppress noise, smoothing details, and enhancing image edge information. Moreover, the running speed of guided filtering is independent of the size of the filtering window. Using the idea of the least square method, frame filtering, and integral image technology, it has the advantage of fast calculation speed. Median filter is good at smoothing noisy images. In order to better maintain image detail information and denoising, guided filtering and mean filtering are used to optimize and smooth transmittance, let t1 (
As can be seen from Fig. 5, the noise points of the transmittance map after comprehensive filtering are somewhat suppressed, the halo problem in the transmittance diagram is suppressed, and the details such as edges are kept better and look clearer.

Transmittance modification effect.
Retinex model-based dehazing algorithm uses color constancy principle of natural objects and Gaussian function to enhance the image. After dehazing, the image can maintain the original brightness and suppress the Halo effect. In order to compensate for the color distortion and halo effect caused by DCP algorithm when defogging image with sky or white areas, Retinex enhancement algorithm is introduced, and the algorithm is improved. The images are enhanced by matching appropriate weight according to different proportions, and finally weighted combination is carried out.
After the transmittance optimization, the dehazing image output according to Equation (7) is denoted as J1 (
Where t1, t2 are the weight coefficients, and t1 + t2 = 1. Under different weights, the effect of dehazing of different images presents a certain difference. Through a large number of experiments, it has been found that traffic images containing sky areas can achieve a better effect of dehazing when t1 = 0.00005 t2 = 0.99995 .
Comparison of experimental results
Subjective evaluation
In order to verify the performance of the algorithm in this paper, 12 different images, such as Road, are selected from the network or photographed by ourselves, and compared with the traditional DCP algorithm, SSR algorithm, and MSRCR algorithm,CLAHE algorithm [15] and IDGCP algorithm [13]. The experiment is completed by Matlab R2020. The comparison of the subjective hazing effect is shown in Fig. 6.

Comparison of dehazing effect (From top to bottom, the hazy images are Road, Building, Traffic1— Traffic10).
As can be seen from Fig. 6, the algorithms SSR and MSRCR based on Retinex model, maintain good details of the hazy image, but the depth of dehazing is limited; DCP algorithm has a good dehazing effect on the lower half of the image, but in the upper half of the image, the mixed area of sky and building is prone to color distortion and halo effect; The color of the image processed by CLAHE algorithm is a little white, and IDGCP has a good performance in dehazing, but for the junction of sky and building or haze shrouded scenes, the dehazed image is prone to block blur. The ORDCP algorithm proposed in this paper shows better flexibility and stability for images with sky areas.Although the dehazing depth in the distance is not good enough, it avoids the color distortion and block mosaic effect,especially at the junction of the sky and buildings, and the visual effect is better.
Objective evaluation methods of image dehazing can be divided into two categories: referenced images and unreferenced images according to the requirement of reference information. However, there is often no real image for reference in actual dehazing so that no reference method can be used only [35]. When evaluating the quality and visual effect of haze-removed images, the clarity of details and the degree of color restoration are two critical indicators. We adopt Information Entropy [17] as an objective evaluation index. It can be realized without reference.
In the above formula, n (0≤n≤255) represents the total number of gray levels contained in image J, E represents the expectation equation, and P i represents the probability of occurrence of the ith gray level in image J, which can be obtained from the gray histogram statistics.
The image information entropy can be used to evaluate the quality of dehazing images. If the information entropy of the dehaze image increases, it shows that the defog image contains more information than the original hazy image, which effectively removes the influence of fog and restores the detailed texture included in the image. As hazy traffic images are the primary source of obtaining visual information, the amount of information contained in them directly affects its utilization value. So information entropy can be used as an important parameter to evaluate the results of hazy traffic images. The information entropy results of different algorithms are shown in Table 1.
Information entropy of different algorithms
From Table 1 above, the algorithm presented in this paper has a better processing effect for hazy images with sky region. ORDCP algorithm has a higher information entropy than the other 8 algorithms, such as Road and Traffic3-Traffic9.Compared with DCP,MSRCR and CLAHE, ORDCP algorithm has higher IE,and retains more details and texture information while dehazing. Although the IE of Building and Traffic1-2 is slightly lower, the restoration degree of color retention and sky boundary is superior to other 5 algorithms from the subjective image restoration effects (Fig. 5). IDGCP gets a higher IE on traffic2, however, it can be seen from the dehazed image, the lower half is a little dark, while the sky in the upper half is overexposed. Refer to Fig. 6, ORDCP algorithm eliminates the halo effect of buildings and sky in DCP or IDGCP dehazing images. It modifies the color distortion of the traditional algorithm when dehazing the sky area. Considering the subjective and objective comparison, the algorithm proposed in this paper has a good dehazing ability, especially on traffic images with sky areas.
This paper proposes an optimized Retinex model and dark channel prior algorithm (ORDCP), it integrates the advantages of Retinex model and dark channel prior. By adjusting the values of some dark channels, the problem that the prior condition is not satisfied when d(x) is large in DCP algorithm is modified, this algorithm can deal with highlighted areas such as the sky more accurately. Guided filtering and mean filtering can optimize the transmittance and denosie,so more details such as image edges can be saved after dehazing, and color restoration can be realized with high fidelity.Experimental results show that for the hazy traffic images with sky areas, the contour of the hazed image is clearer, and the details remain more complete after dehazing by using this algorithm. ORDCP algorithm corrects the color distortion of the DCP and IDGCP algorithms, optimizes the brightness problem that the details are not bright enough in the Retinex model dehazing, and has a low running time complexity. However, when dealing with simpler image scenes, the color of the upper part is easy to fade after dehazing. In the next step,we will further study and improve the algorithm, strive to find better traffic image dehazing algorithms, and improve the dehazing ability for different image scenes, so as to better serve intelligent transportation.
