Single-Image Dehazing Based on Improved Bright Channel Prior and Dark Channel Prior

: Single-image dehazing plays a signiﬁcant preprocessing role in machine vision tasks. As the dark-channel-prior method will fail in the sky region of the image, resulting in inaccurately estimated parameters, and given the failure of many methods to address a large band of haze, we propose a simple yet effective method for single-image dehazing based on an improved bright prior and dark channel prior. First, we use the Otsu method by particle swarm optimization to divide the hazy image into sky regions and non-sky regions. Then, we use the improved bright channel prior and dark channel prior to estimate the parameters in the physical model. Second, we propose a weighted fusion function to efﬁciently fuse the parameters estimated by two priors. Finally, the clear image is restored through the physical model. Experiments illustrate that our method can solve the problem of the invalidation of the dark channel prior in the sky region well and achieve high-quality image restoration, especially for images with limited haze.


Introduction
Complex weather, such as haze, will decrease the visibility of the landscape and affect the image quality. For example, there will be missing colors, low saturation and blurred texture details, which will lead to a decrease in the accuracy of vision system tasks.
Image dehazing methods can be divided into: image enhancement-based, prior-based and deep learning-based methods. Enhanced-based dehazing methods such as Retinex [1], histogram equalization [2] and wavelet transform [3] do not depend on the physical model and improve image quality by increasing contrast and saturation. However, this kind of method does not have a good dehazing effect and does not realize real dehazing physically. Prior-based image dehazing methods generally estimate the parameters (transmission map and atmospheric light) of the atmospheric scattering model (ASM) [4][5][6] and recover sharp images. For example, He et al. [7] proposed the dark channel prior (DCP) to estimate the transmission map. DCP is a well-known prior, which assumes that low-intensity values of at least one color channel in a haze-free image are close to zero [8]. Meng [9] proposed boundary constraints and regularization (BCCR), which uses guided filtering and bilateral filtering to replace time-consuming soft matting to improve computational efficiency. Berman [10] discovered a haze line prior (NonLocal), that is, the color value distribution of the image will change from clusters to lines due to the existence of haze, and used this distribution rule to make a preliminary estimate of the transmission map. Some scholars have also proposed some methods combining total variation and DCP to estimate the parameters [11][12][13]. These prior-based methods, although somewhat successful, rely on estimates of parameters but are prone to problems such as distortion.
Recently, learning-based methods have received more attention. Scholars have begun to explore the use of convolutional neural networks (CNN) for image dehazing. Early image dehazing methods focused on using the estimated transmission map to restore the hazy images. For example, Li [14] proposed an AOD-Net, which reformulated ASM and put a transmission map and atmospheric light into a new variable, and then restored the clear image. Ren [15] proposed coarse-scale and fine-scale networks to roughly estimate and refine the transmission map, respectively. Li [16] proposed a hybrid dehazing network combining the vision transformer. Deep learning-based methods [17][18][19][20][21][22][23][24][25][26][27][28][29][30][31][32] rely heavily on synthetic hazy images, which are prone to overfitting and perform poorly in real-world scenarios.
To solve the above problems, we propose a novel single-image dehazing method based on an improved bright channel prior (BCP) [33] and DCP to more accurately estimate the transmission map and atmospheric light to restore a more clear haze-free image. First, for the failure of DCP in the sky region, we propose the Otsu using particle swarm optimization (PSO) to divide the hazy images into sky regions and non-sky regions, and then estimate the parameters via the improved BCP and DCP. Our work can be summarized as follows: • A Otsu and PSO method is proposed to accurately segment the sky and non-sky regions of hazy images, which allows the different priors in the two regions to estimate the parameters accurately. • We propose an improved BCP to more accurately estimate the transmission map. Inaccurate estimation of the parameters of the sky region can easily amplify noise and cause distortion, so we limit it. • To better fuse the parameters estimated by BCP and DCP, we propose weighted fusion functions to obtain more accurate transmission maps and atmospheric light values, respectively.

Image-Enhancement-Based Methods
Methods based on image enhancement include histogram equalization and the Retinex algorithm. The histogram equalization dehazing method is to transform the gray value of the hazy image into a uniform distribution. Retinex is a color vision model [1]. Differently from traditional methods, Retinex can adaptively enhance various images. However, since the dehazing is not performed physically, such methods are not robust.

Prior-Based Methods
Low visibility in hazy weather is affected by atmospheric particles. The most common ASM is to describe the image degradation process in hazy weather: where q represents the position of a pixel, I(q) denotes the hazy image, J(q) represents the clear image, A is the global atmospheric light and t(q) is the transmission map. The task of image dehazing is to restore J(q) from I(q). Some scholars propose prior knowledge to estimate J(q). The DCP-based algorithm [7] is the first method to combine DCP with ASM for image dehazing. The mathematical expression of the dark channel: where c is a channel combining the three channels of R, G, and B; J dark (q) can be calculated by replacing the gray value of the center point pixel with the minimum gray value in the rectangular area Ω(q). According to DCP theory, J dark (q) is close to zero. DCP is introduced to estimate the values of t(q) and A, and DCP has become the fastest-growing and most widely used image dehazing algorithm. Therefore, many scholars have proposed a large number of improved algorithms based on DCP [34][35][36][37]. However, many DCP-based works cannot provide the dehazing of the sky region and are prone to halo and distortion, and the use of algorithms has high requirements for light intensity. Zhu [38] proposed a color attenuation prior based on the statistical analysis of a large number of hazy images. The method shows that the higher the haze concentration, the larger the depth of field. He et al. [39] converted the parameter estimation into a convex linear optimization problem and introduced the Haar wavelet transform to speed up the solution. It provides good real-time performance. Ehsan [40] proposed a dual-transmission map method to restore the haze-free image and reduce the halo phenomenon.

Learning-Based Methods
There is also a large number of learning-based methods in the field of haze removal. Cai [41] proposed DehazeNet that can directly estimate the transmission map and then completed the reconstruction of the clear image according to ASM. DehazeNet combines the prior knowledge of the traditional dehazing network and obtains refined transmission maps through feature extraction and nonlinear regression, and guided filtering [42]. DehazeNet's dehazing effect is good, but there are certain problems. Due to the different degrees of light absorption, scattering, and transmission in different locations in the real atmospheric environment, the distribution of atmospheric light is uneven, and the atmospheric light obtained by using an assumptions prior cannot be well adapted to various situations in the dehazing task. The processing effect at the change of depth of field is average. Ren [15] proposed a single-image dehazing network (MSCNN), which first estimated the overall transmission map and then further optimized it, and then analyzed the difference between the features acquired by traditional methods and convolutional neural network learning. Li [14] proposed AOD-Net, which unifies the two parameters in ASM into one parameter through the conversion formula, eliminating intermediate steps and reducing the cumulative error in parameter estimation. The network consists of two sub-modules, which are simple in structure and efficient in processing. Engin [43] proposed an enhanced cycle generation adversarial network (Cycle-Dehaze) that can directly generate a haze-free image without estimating the parameters of ASM and in an unpaired manner. The network combines with perceptual loss to improve the cycle consistency loss of CycleGAN architecture. Chen [44] proposed GCANet, which used a smooth dilation technique that inserts dilated residual blocks between codecs to aggregate contextual information without causing grid artifacts. Wu [45] proposed AECR-Net based on contrastive learning, which uses the information of clear images and hazy images as positive samples and negative samples respectively, ensuring that the restored result images are closer to clear images. The network introduces deformable convolution into the dynamic feature enhancement module in AECR-Net so that the sampling grid can dynamically adapt to the shape to expand the receiving field and achieve a better dehazing effect. AECR-Net is based on an autoencoder-like framework, which becomes more compact by reducing the number of layers and the size of the space. Tran et al. [46] proposed a new encoding-decoding network (EDN-GTM) that uses traditional RGB hazy images and transmission maps estimated using dark channel priors as input to the network, U-Net as the core network for image processing, and the spatial pyramid pooling module and the Swish activation function in the network to achieve a better dehazing goal. Zhao [47] proposed a nighttime image dehazing network, which fuses three inputs through white balance. Alenezi [48] proposed an underwater image dehazing network that utilizes the color channels and image features of RGB images to improve overall usability. The output color channel features are fused using softmax weighting to obtain a clear image. Yang [49] proposed a self-enhanced image dehazing framework D4 that focuses on the scattering coefficient and depth information of images. They trained the network through unpaired hazy and clear images to restore the scattering coefficient, depth map, and clear images. Song et al. proposed DehazeFormer [50], which improved the structure of Swin Transformer [51] to make it more suitable for the dehazing task. Song et al. proposed a compact dehazing network gUNet [52] based on UNet [53] and achieved good results. Despite the great success of deep learning-based methods, their generalization performance is unsatisfactory due to heavy reliance on synthetic hazy image datasets.

Methods
The method we propose mainly consists of three steps. We first segment the sky region of the hazy image. Then, we estimate the transmission map and atmospheric light via the proposed improved BCP and DCP. Finally, we fuse the transmission map and atmospheric light and restore the clear image. The overall flowchart is shown in Figure 1.

Otsu Method by Particle Swarm Optimization
We propose an Otsu method [54,55] that uses particle swarm optimization (PSO) [56,57] to find a better segmentation threshold to separate the sky region from the non-sky regions in hazy images. The Otsu method by PSO can more accurately segment the sky and non-sky regions.
We first convert the RGB hazy image into a grayscale image, letting NU M represent the total number of pixels of the image and count(x) the number of pixels with a pixel gray value of x. Then, the number of pixels with a gray value of x that appears in the image probability P(x) can be expressed as: Assuming that t is the threshold value for segmenting the non-sky and sky region of the image, the pixels with gray values ranging from 0 to t are classified as non-sky regions, and the pixels with gray values ranging from t + 1 to 255 are classified as sky regions. Let w1 and w2 denote the probabilities of two regions: Then, get the mean u1 and u2 of the two regions: Then, the mathematical expectation of the overall pixel gray value of the image is: According to the OSTU method [58], the optimal threshold t can be obtained by maximizing the between-cluster variance σ 2 of the image: Then, we use Equation (7) as the fitness function of PSO. We used 500 particles and iterated 400 times to adaptively obtain the optimal segmentation threshold t. Finally, we performed binarization processing and set the pixel value of the sky region whose gray value is greater than the threshold t to 1, and the pixel value of the non-sky area whose gray value is less than or equal to the threshold t to be 0. Figure 2 shows the effect of segmentation.

In the Non-Sky Region
In the non-sky regions, DCP performs very well, so we use DCP for the initial estimation. From Equations (1) and (2), the transmission map estimated by DCP [7] is: where the parameter ω is used to make distant objects have a small amount of haze, which was set to 0.95 in [7]. As for the estimation of atmospheric light A DCP , we also use the method of He [7]. First, we select the 0.1% brightest pixels in the dark channel and then take the average value of the pixel values in the corresponding input image as the estimated value of atmospheric light.

In the Sky Region
Since DCP fails in the sky region [7], we adopt the improved BCP to estimate parameters in the sky region. According to the BCP theory [33], the intensity values of most images containing white objects or light sources in the RGB color channel are particularly large, or even close to 255. For an image J(q), the mathematical expression of the bright channel is: where c is a channel combining the three channels of R, G, and B; Ω(q) is a rectangular area centered at q. According to the BCP theory, J bright (q) is close to 255. From ASM (Equation (1)) and BCP (Equation (9)), it can be deduced that the transmission map is: where c is a channel combining the three channels of R, G, and B; Ω(q) is a rectangular area centered at q. However, the transmission map obtained in this way may be a negative value or may be too small, so we improved it. We let b = max max y∈Ω(q) I c (y) − A c bright , and mean(b) represents the mean of b. Then: where k is the adjustment factor, and it was found through experiments that the value of k is most suitable between 0.05 and 0.15. In addition, in order to prevent the transmission map of pixels from exceeding 1, we made another restriction as follows: t_ bright (q) = min t_ bright (q), 1 For the estimation of atmospheric light A bright based on BCP, according to the BCP, the maximum value of the bright channel in the region where the atmospheric light is located is closest to the atmospheric light, so we take the 0.1-percent brightest pixels of the bright channel and then take the average value of the pixel of the corresponding input image as the atmospheric light estimated value.

Fusion of Sky and Non-Sky Regions
In order to better fuse the estimated parameters of the sky and non-sky region, we propose a more appropriate weighted fusion function.

Transmission Map Fusion
According to the DCP and BCP theories, the transmission map estimated by DCP is suitable for non-sky regions, and the transmission map estimated by BCP is suitable for sky regions. For better fusion, we introduce a weight parameter λ: where Z represents the total number of pixels in the sky region, which can be obtained by calculating the number of pixels whose pixel value is [t + 1, 255]; H and W represent the height and width of the image, respectively; H × W represents the total number of pixels of the image. The fused transmission map t(q) is: where σ = 1 10 e − Z H×W−Z − 0.05 is an adaptive parameter we designed, and the value of σ belongs to [−0.05, 0.05]; Z is the total number of pixels in the sky region; (H × W − Z) is the total number of pixels in the non-sky region; the value of σ in the sky region is a negative number; and the value of σ in the non-sky region is a positive number. The fused transmission map t(q) is then refined by gradient domain guided filtering [59] to reduce blocking artifacts. Experiments verify that the transmission map obtained after σ fine-tuning can make the image recovery better.

Atmospheric Light Fusion
Since the atmospheric light obtained by the bright channel has an atmospheric light value near to that of light in the haze-free state, we fuse the atmospheric light as follows:

Recovering the Clear Image
According to Equation (1), the final recovered clear image J(p) is as follows: where we set a lower limit of 0.1 for the transmission map, retaining a little haze and preventing noise amplification caused by the too-small transmission map. The algorithm of the proposed method is described in Algorithm 1.

Algorithm 1: Single image dehazing based on improved BCP and DCP.
Input: A hazy image I(q) (1) Segmentation I(q) into sky area and non-sky regions using OSTU by PSO.

Experiments on Synthetic Hazy Images
We randomly sampled several images from SOTS-Outdoor (from RESIDE dataset) for experimental comparison. The visual comparison is shown in Figure 3. For Image 1, the result of restoration via DCP is overall darker; the image restored by BCCR is a bit overexposed; the result of restoration by He's method has more haze; the color restoration result of AODNet and Ehsan's method shows a great change; the result of restoration by NonLocal, MSCNN, DehazeNet, and D4 has color distortion; the result of restoration by our method is closest to ground truth (GT)-the sky area is very well protected. For Image 2 and Image 3, the restored results of DCP, BCCR, AODNet, and Ehsan show severe color distortion. He's method was not effective in dehazing, and the restored results of NonLocal, MSCNN, DehazeNet, and D4 show overexposure or overexposure in the sky region. The overall restoration effects of DehazeFormer-T and gUNet-T are better, but the restoration results of the sky region in Image 1 are slightly different from those of GT. The result recovered by our method is closest to that of GT. The comparison of visual effect experiments shows that our method can well protect the sky region of the image, which solves the problem that DCP fails in the sky region.  [7] results, (c) BCCR [9] results, (d) NonLocal [10] results, (e) MSCNN [15] results, (f) DehazeNet [41] results, (g) AODNet [14] results, (h) He [39] results, (i) Ehsan [40] results, (j) D4 [49] results, (k) DehazeFormer-T [50] results, (l) gUNet-T [52] results, (m) our results, (n) ground truth.

Experiments on Real-World Hazy Images
We randomly sampled several images from the O-Haze and NH-Haze datasets for comparative experiments. Both O-Haze and NH-Haze datasets show haze generated by professional haze generators. O-Haze has hazy outdoor scenes, and NH-Haze has uneven haze. Figure 4 shows the dehazing effects of different methods on the O-Haze dataset. In Image 4 of Figure 4, the results restored by DCP, NonLocal, and Ehsan methods are severely distorted in the sky region, and the result of BCCR is that the sky area is overexposed.   [7] results, (c) BCCR [9] results, (d) NonLocal [10] results, (e) MSCNN [15] results, (f) DehazeNet [41] results, (g) AODNet [14] results, (h) He [39] results, (i) Ehsan [40] results, (j) D4 [49] results, (k) DehazeFormer-T [50] results, (l) gUNet-T [52] results, (m) our results, (n) ground truth. Figure 5 is a comparison on the NH-Haze dataset. The haze in each image in this dataset is relatively thick. The images restored by methods such as DCP, AODNet, and Ehsan are too dark or oversaturated. The image recovered by BCCR is overexposed. The images restored by MSCNN, DehazeNet, He, and D4 methods still have more haze; and the images restored by NonLocal have less haze, as shown in Image 8, which may be because the non-local prior has a better dehazing effect on uneven haze, but the scene color shows some distortion. In Image 9, the results recovered by DCP and Ehsan are darker; the result of BCCR is overexposed; and the results recovered by MSCNN, He, DehazeFormer-T, and gUnet-T have more residual haze, such as the area shown in the red box. The scene details restored by NonLocal feel good, but the color of the haze is changed, making it the same in Image 10. The image restored by our method is relatively closer to GT in terms of color and saturation, but there is still a certain amount of haze, which is where our future work can be improved.  [7] results, (c) BCCR [9] results, (d) NonLocal [10] results, (e) MSCNN [15] results, (f) DehazeNet [41] results, (g) AODNet [14] results, (h) He [39] results, (i) Ehsan [40] results, (j) D4 [49] results, (k) DehazeFormer-T [50] results, (l) gUNet-T [52] results, (m) our results, (n) ground truth.

Quantitative Evaluation Experiment
To objectively verify the performance, we conducted a detailed quantitative evaluation using PSNR and SSIM metrics for comparison. Table 1 is the quantitative experimental comparison results of all images in Figures 3-5. In Table 1, the highest PNSR/SSIM scores of Image 1, Image 2, and Image 3 are based on the deep learning method gUNet, which is due to the fact that gUNet learns better features on synthetic data. However, the PNSR/SSIM score of our method was the highest on the remaining real-world hazy images, which illustrates the excellent performance of our method in real-world scenes. In addition, we performed quantitative comparison experiments on all images on the SOTS-Outdoor dataset, O-Haze dataset, and NH-Haze dataset. Table 2 shows the average PNSR/SSIM score results of the three datasets. On the synthetic data, SOTS-Outdoor, our method, scored inferiorly to the latest deep learning methods DehazeFormer-T and gUNet-T, which shows that these two methods perform well on synthetic datasets. However, our method scored the highest on the O-Haze and NH-Haze datasets of real-world hazy images, which further illustrates the excellent dehazing performance of our method in the real world. The performance of deep learning-based methods on real-world images is inferior to that of our method, possibly due to the overfitting of models trained on synthetic datasets. This also shows that deep learning-based methods may have poor generalization ability due to their heavy dependence on datasets.

Application in Traffic Electronic Monitoring
On roads, especially in mountainous areas, haze is prone to occur, and there is much electronic monitoring on roads. Hazy weather may affect the collection of vehicle information by electronic monitoring, such as vehicle color, license plate number, and other information. Our method can also be used for haze removal in hazy images collected by traffic electronic monitoring. We downloaded a hazy traffic scene from the Internet and conducted a comparative experiment. As shown in Figure 6, the results recovered by DCP, BCCR, and Ehsan methods has obvious color distortion. The sky region of the NonLocal restored result is overexposed. The results recovered by MSCNN, DehazeNet, AODNet, and He have distortion in the sky region; and the road part recovered by DehazeNet, AOD-Net, He, Ehsan, and D4 is too dark. The overall effects of the DehazeFormer-T and gUnet-T restoration are superior, but there will be more residual haze, whereas the restoration result of our method reduces distortion while removing haze. Since there is no GT image, it is impossible to quantitatively evaluate the PNSR/SSIM index, but we used a fog aware density evaluator (FADE) [53] to measure the amount of haze. The score of the FADE index indicates the density of haze to a certain extent. In Table 3, the haze density of the image recovered by the DehazeNet method is shown to be the smallest, which reflects that the method has good dehazing ability, but the visual effect is not satisfactory. Our method restores the image fog concentration only 0.024 more than the DehazeNet method. The FADE value of the image recovered by our method is only 0.024 higher than that of the De-hazeNet method, which shows that the dehazing performance by our method is also very good. In addition, it can be seen that the images recovered by MSCNN, DehazeFormer-T, and gUNet-T methods have more residual haze, which illustrates the limitations of these methods for dehazing. Table 3. The FADE index values of images recovered by different methods; see Figure 6. The bold font indicates the best score, and the italic font indicates the next best score. Image Input DCP [7] BCCR [9] NonLocal [10] MSCNN [15] DehazeNet [41] AODNet [14] He [39] Ehsan [40] D4 [49] DehazeFormer-T [50] [7] results, (c) BCCR [9] results, (d) NonLocal [10] results, (e) MSCNN [15] results, (f) DehazeNet [41] results, (g) AODNet [14] results, (h) He [39] results, (i) Ehsan [40] results, (j) D4 [49] results, (k) DehazeFormer-T [50] results, (l) gUNet-T [52] results, (m) our results.

Processing Time of the Algorithm
We used MATLAB 2019a software to execute our algorithm on an Intel i7-7700 3.6 GHz CPU and 8 GB RAM environment to obtain the haze-free images. Table 4 shows the processing times of all images in Figures 3-5. In Table 4, we can see that as the size of the image increases, the processing time of the algorithm increases. Especially for high-definition images with a resolution of 1600 × 1200, the algorithm's processing time increases significantly. The two most time-consuming operations of the algorithm are to use PSO to find the optimal segmentation threshold t and to traverse each pixel of the image to determine whether it belongs to the sky region. This shows that our method takes more time to process high-definition images, which is also the direction of our future improvement.

Conclusions
We propose a simple yet effective dehazing method. In order to solve the famous DCP failure in the sky region, we segment the sky area of the image, use the improved BCP to estimate the parameter in the sky area, and use DCP to estimate the transmission map in the non-sky area and atmospheric light. We then efficiently fuse the parameters of the two regions, and then recover a clear image according to ASM. We conducted visual and quantitative comparison experiments on synthetic and real-world datasets with state-of-the-art methods. The results demonstrate that our method can well preserve sky regions, reduce color distortion and oversaturation, and provide higher PSNR and SSIM scores. Recent learning-based methods have achieved excellent performance on synthetic datasets due to their powerful backbone networks for learning image features, such as UNet and Swin transformer. However, the learning-based method has poor generalization ability due to its heavy dependence on the specific dataset it is trained with, and it may not perform satisfactorily on new scenes. In contrast, our method is unsupervised and performs well in real-world scenarios, which illustrates the effectiveness of physical models and prior knowledge.
In addition, the proposed method cannot fully achieve the effect of dehazing nonuniform thick hazy images, which may be due to the fact that the physical model and prior knowledge are not fully practical in non-uniform haze scenes, which is also the direction of our future work. In the future, we will try to study a more robust physical model that can reflect the imaging process of images with various haze concentrations.
Author Contributions: Writing-original draft preparation, C.L.; writing-review and editing, H.X. and H.Z.; supervision, H.X.; experiment, C.Y., H.P., Y.Y. and Z.W.; funding acquisition, H.X. All authors have read and agreed to the published version of the manuscript.