Regional Atmospheric Light Optimisation Algorithm for Heterogeneous Image Dehazing

Under foggy and other severe weather conditions, image acquisition equipment is not effective. It often produces an image with low contrast and low scene brightness, which is difficult to use in other image-based applications.+e dark channel prior dehazing algorithm will cause the brightness of the image to decrease and sometimes introduce halos in the sky area. To solve this problem, we proposed a region similarity optimisation algorithm based on a dark channel prior. First, a vector comprising RGB layer dark channel value was obtained as the original atmospheric ambient light, and then, the proposed regional similarity linear function was used to adjust the atmospheric ambient light matrix. Next, the transmittance of different colour channels was derived and the multichannel soft matting algorithm was employed to produce more effective transmittance. Finally, the atmospheric ambient light and transmittance were substituted into the atmospheric scattering model to calculate clean images. Experimental results show that the proposed algorithm outperformed the existing mainstream dehazing algorithms in terms of both visual judgement and quality analysis with nonhomogeneous haze datasets.+e algorithm not only improves the image details but also improves the brightness and saturation of the dehazing result; therefore, the proposed algorithm is effective in the restoration of the hazy image.


Introduction
Fog is a near-surface atmospheric weather phenomenon caused by the desublimation of suspended water droplets in the air. Foggy conditions cause considerable inconvenience to human life and production, especially in imaging. Because of the light scattering caused by various particles in a foggy atmosphere, such as PM2.5, image acquisition equipment tends to produce images with fewer details, low contrast, low scene brightness, and whitish hue, which not only renders a poor intuitive visual experience but also affects the normal operation of the work system in image-related fields, such as image recognition.
us, research on haze removal technology is valuable and significant.
At present, image dehazing technology is mainly divided into three categories [1][2][3]: image enhancement methods, physical model-based methods, and deep learning-based methods using neural networks. Among them, representative image enhancement algorithms [4][5][6][7][8][9] include histogram equalisation, homomorphic filtering, wavelet transform, and MSR algorithm based on the Retinex (SSR) theory. e histogram equalisation algorithm nonlinearly stretches and rearranges the dense part of the whole grey histogram to achieve approximately uniform distribution, thus enhancing the local image contrast. e Retinex model proposed by Edwin Land was based on the colour constancy theory [4]. Based on the theory of the single-scale SSR algorithm, Ma and Wen [5] combined edge detection within a Gaussian filtering algorithm to amend the estimated value of the reflection component and mitigate the loss of image edge information. Zheng et al. [6] proposed an adaptive structure decomposition-integrated multiexposure image fusion dehazing method. It linearly adjusts the underexposed images through gamma correction to enhance the visual effect after dehazing, but the calculation complexity is high.
Zhu et al. [7] proposed an image fusion-based algorithm that reduces haze effects via gamma correction. is algorithm can enhance the saturation of images and can be applied to geographic remote sensing and underwater images. Shu et al. [8] proposed a hybrid regularised variational framework to improve the scene depth of images along with dehazing. In addition, a two-step correction mechanism is employed to address the problem of colour distortion in the sky area.
Physical model-based methods use the traditional atmospheric scattering model [10] as the main research object and then estimate atmospheric ambient light and transmittance via a priori hypothesis to make them similar to the real scene, thus realising image defogging processing [11][12][13][14][15][16][17][18][19][20][21][22][23][24]. Kaiming He et al. [13] proposed a single-image dehazing algorithm using the dark channel prior theory. is method adopts soft matting method to refine the transmittance and has a remarkable effect. Later, He et al. [14] substituted guided filtering for soft matting in transmittance refinement to improve the operating efficiency, but phenomena such as overall bluish and caliginous hue and colour distortion in the sky area still exist. Zhu et al. [15] obtained the mapping relation by training a linear model built from a colour attenuation prior. is algorithm achieves less colour distortion and outperforms most traditional algorithms. Meng et al. [16] employed a regularisation algorithm to effectively constrain the boundary of the sky region to obtain a restored image. is method causes image detail loss and artifacts in the image boundary. Sulami et al. [17] assumed that the scene chrominance was uncorrelated with the transmittance and calculated the transmittance using statistical laws, resulting in a poor effect in images with relatively single colour features. Berman et al. [18] proposed a nonlocal prior within each type of pixel cluster; the pixel points will have a linear relationship according to the difference in fog concentration. ey estimated the scene depth based on this prior and accordingly restored the fog-free image. Ju et al. [19] introduced a novel light absorption coefficient parameter to attain an enhanced ASM (EASM).
is model increases the visibility of hazy images while dehazing outdoor hazy images. Later, Ju et al. [20] proposed an image dehazing method using blended priors. is algorithm combines multiple modules, including the atmospheric light estimation module to increase brightness and multiple prior constraint modules to create a nonlocal prior, local prior, and global prior, which improve the brightness and saturation of images. Wang et al. [21] proposed an additional channel method based on quad-tree subdivision and refined the transmittance using Gaussian blurring. ese measures prevent the phenomena of oversaturation and halo effects from happening and tackling the problem of distortion in the brightest areas.
In recent years, machine learning has become an important topic for its wide application and methods based on deep learning and neural networks have also made progress in image defogging [25][26][27][28][29][30][31][32][33][34]. Chen et al. [25] proposed a single-image dehazing method based on CNN, obtained the detailed features of foggy images via convolution layer operation and multiscale convolution kernel operation, and then fitted the transmittance map using nonlinear regression. In contrast to CNN, Cai et al. [26] proposed a trainable end-to-end transmission medium estimation model called DehazeNet, which directly learns and estimates the mapping relationship between foggy images and transmittance. However, this algorithm still uses atmospheric light as a global constant, leading to a loss in the precision of the image to a certain degree. Li et al. [27] improved the traditional atmospheric scattering model and used a convolutional neural network to estimate the residual image containing atmospheric light and transmittance. Qin et al. [28] proposed an end-to-end feature fusion dehazing network. is network structure can adaptively learn different weights of different-level feature information. e results show significant dominance in image detail restoration and colour fidelity. Liu et al. [29] designed and enhanced the CNN learning method for ship detection, which incorporated nonmaximum suppression to accurately obtain the results and construct a mixed loss function balance class during the training phase. Like the relative fine dehazing results as those aforementioned networks have, the deep learning-related algorithm relies considerably on big data; this is difficult to implement under sparse samples.
Algorithms, such as the dark channel a priori based on the traditional atmospheric scattering model, ignore most of the image detail information when estimating the atmospheric ambient light. To solve this problem, we made the following modifications based on the dark channel a priori theory: (1) e dark channel values were obtained for each of the three RGB colour channels of the hazy image, and the regional mean value of each pixel in each dark channel was considered as the corresponding atmospheric ambient light value, after which the entire atmospheric ambient light was linearly transformed with its top 1% value to obtain the final atmospheric ambient light value. is reduces the influence of image noise to a certain extent. (2) In this study, we proposed to refine the transmittance through guided filtering and selected the V channel in the HSV with the best effect as the guided map for transmittance optimisation through experiments to obtain a transmittance closer to the real scene. In this study, we ran experiments on the O-Haze dataset, NTIRE 2021 dataset, and real images and analysed the results from both subjective and objective aspects. e results show that the proposed algorithm effectively improves the brightness and saturation of the image and the haze-free image after dehazing has high colour contrast and good visual effect and also improves the problem of blue and dark images after the dark channel a priori algorithm processing.

Background
Under foggy and other severe weather conditions, the light will scatter when it meets suspended small particles in the air during propagation, resulting in degraded images produced by image acquisition devices. Nayer and Narasimhan improved the atmospheric scattering model [10] in 1999, and this model ( Figure 1) is widely used in computer vision and computer graphics.
It can be formulated as 2 Scientific Programming where I(X) refers to the hazy image received by imaging equipment, J(X) is the real-scene radiation, A is the atmospheric ambient light value, and t(X) is the transmittance, which can be expressed as where β is the atmospheric scattering coefficient and d(X) is the distance between the actual scene and the photographed point, that is, the depth of the field. As per the formula, J(X) can be obtained via formation simplification after estimating atmospheric ambient light A and transmittance t(X) of input I(X).
Kaiming He et al. [13] conducted experiments on large quantities of outdoor haze-free images and found that in the vast majority of nonsky regions in haze-free images, some pixels in a certain region have at least one colour channel with a rather low value. In dark channels, they pointed out that dark channel values tend to zero in nonsky areas. e dark channel value in a local patch Ω(X), with the centre pixel x, is denoted by J dark (X) as follows: In practice, small particles inevitably exist in the atmosphere. e presence of haze is fundamental for observers to perceive scene depth. erefore, after minimisation on both sides of equation (3), the parameter ω (0 < ω ≤ 1) is introduced to maintain a certain amount of haze, thus enhancing the visual experience of observers, as shown in where c represents the RGB colour channels, c ∈ r, g, b , I c is the hazy image of each colour channel layer, and A c is the atmospheric ambient light of each colour channel layer. e dark channel prior is subject to limitations in that it does not hold in the sky area and white object area; therefore, results with images containing such areas will display local image distortion and a widespread halo in the sky area.

Proposed Algorithm
Due to the unrobustness of the dark channel prior, its dehazing results are subject to problems such as bluish hue and colour distortion in the sky area. e proposed algorithm refines the estimation of the atmospheric ambient light and transmittance based on the original dark channel prior algorithm through the region similarity correction, thus obtaining more effective estimate values, which significantly improves the dehazing effect. e flowchart of the proposed algorithm is shown in Figure 2.
As shown in Figure 2, (a) is the input hazy image, we first select the low brightness pixels in a moving windows from (a) as the dark channel image (b). en, we use the region similarity correction method to estimate the enhanced atmospheric light image (c). By using the dark channel prior, the rough transmittance map can be calculated as (d). In addition, the input image are transferred to HSV domain (e) to get the intensify map (f ). e detailed transmittance map (g) is generated by a guide filter which employed the intensity map (f ) as the guide map. Finally, the enhanced atmospheric light (e) and detailed transmittance (g) are submitted to the atmospheric scattering model to get the dehazing output (h).

Estimating the Dark Channel Value.
For a hazy image with a size of m × n, we designed a window Ω(X) centered around it and chose the average value of the lowest grey value for each pixel in the R, G, and B colour channels, respectively. Furthermore, within the range of Ω(X), because of the dark channel value of this pixel, we obtain an m × n × 3 RGB dark channel matrix J c,dark (X) (equation (6)): e size of Ω(X) has an impact on the dark channel image; the larger its value, the darker the pixel points it contains and the darker the generated image; the experimental effect will not be suitable. e smaller the value, the less the information of the dark channel included, and the difference with the original image is not significant. erefore, s � 31 was chosen in this study to achieve the best balance.
We further compute the atmospheric ambient light using it.

Estimating the Atmospheric Ambient Light.
To better realise region selection, for each pixel in the obtained J c,dark (X) as the starting point, we determined a square window Ω(X) from four different directions, including the upper left, upper right, lower left, and lower right of the pixel independently to calculate the mean dark channel value from within as the atmospheric light A c (X) of this pixel and where J c,dark (i, j) represents the dark channel value of the pixel with coordinates (i, j), c � R, G, B, s ′ is the length of the neighbourhood window, and x and y are the abscissa and ordinate, that is, Provided that the size of the square window size at the image edge is less than Ω(X), then we select the window with side length min x, y, m − x + 1, n − y + 1 . Larger atmospheric ambient light values will make the image brighter, while too small values will result in a darker image overall and affect the accuracy of the estimated transmittance t(X). is is particularly obvious in the dense haze region. erefore, in this study, we proposed an improvement scheme, in which the obtained A c (X) values are first arranged in a descending order and the first 1% of them are considered as the ideal values of the atmospheric ambient light to ensure that the atmospheric ambient light is more consistent with the real scene as shown in where the positive integer N refers to the corresponding value of the 1% pixel of the whole image (rounded down).
Refactoring the m × n vector rearranged from A c (X) as Re c (h 0 ), then the pixel with coordinates (x, y) can be formulated as follows: where h 0 is the subscript position of the A value with the original coordinates (x, y). Subsequently, we rearrange Re c (h 0 ) in descending order and denote the new column vector as De c (h). Next, we rearrange the entire m × n atmospheric light matrix according to their linear proportion. en, we mark the minimum atmospheric light value as minA c and the maximum value of the optimised value A ′ c (X) as maxA c .
e minimum value minA ′ c of the optimised atmospheric By simplifying (11), we can obtain the rearranged value of each pixel A ′ c (X) from the original A c (X), which leads to e calculation and rearrangement steps of the atmospheric light are shown in Figure 3.
As shown in Figure 3, a dark channel image (a) was input to obtain the refined atmospheric ambient light image. Considering the pixel point at coordinate (1, 1) as an example, Ω(X) is selected down to the right (as shown in the red box in (a)) and the mean value of the region Ω(X) (i.e., (b)) is calculated as the rough atmospheric ambient light value at coordinate (1, 1) (as shown in the red box in the upper left of (c)). ereafter, we arrange the atmospheric ambient light value of (c) into the right matrix of (d) in descending order and linearly stretch the first 1% of the pixel points into the new atmospheric ambient light values (as shown in the left matrix of (d)), which is later mapped back to the original coordinate positions for subsequent dehazing (as shown in the change process of the red pixel points from (c) to (e)).

Estimating the Transmittance.
Based on the principle that visible light of different wavelengths has different transmittances, transmittances of different colour channels are obtained in this study, as shown in where t c (x) represents the three-layer colour channel transmittance matrix.
Experimental analysis indicates that V channel overperforms other choices as the guiding map to employ guided filtering to transmittance t c , and we obtain a more effective transmittance t ′ c , as the following formulas show: where I v is the guiding image, that is, the V channel of the hazy image represented in the HSV image system, cov k is the covariance of the window w k , and σ 2 k and u k are the variance and mean value of I v in window w k , respectively. e parameter ω also plays a decisive role in the transmittance; the smaller its value, the less obvious the defogging effect. After extensive experiments, we fixed ω to 0.9 and the minimum transmittance was set as 0.1 to avoid excessive enhancement of the image after fog removal.
A comparison of the transmittance t′ c with and without the guided filter is shown in Figure 4. ereafter, we submit the improved atmospheric ambient light A ′ and transmittance t ′ d into equation (1) to obtain clean images.

Experimental Results
To evaluate the feasibility and effectiveness of our algorithm more intuitively, we performed comprehensive experiments on a large dataset containing the public O-Haze image dataset, NTIRE 2021 dataset, and real-world images. e O-Haze dataset contains 45 outdoor scene images with the same visual content recorded under fog-free and foggy conditions, from which we stochastically selected six images as the testing set for neural network algorithms and used the others as the training set. e real-world image dataset comprises approximately 150 images, including a public dataset that is available online and self-collected images. e NTIRE 2021 dataset includes 35 pairs of real and outdoor nonhomogeneous hazy images. All operations were performed under the Windows 10 operating system, MATLAB R2020a operating environment, and Intel(R) Core (TM) i7-7500U CPU @2.70 GHz 2.90 GHz processor, with 8 GB RAM hardware configuration. We compared our  [18], IDE [19], DehazeNet [26], and AOD [30] from both subjective and objective aspects. According to the experimental analysis, we set the window size as s ′ � 31 in this study. Image evaluation has extremely important application value in image dehazing, image compression, video compression, and other fields. Image evaluation methods are mainly divided into subjective evaluation and objective evaluation. Among them, subjective evaluation refers to the perceptual judgement based on observers' subjective feelings and is widely used in neural networks, image recognition, and other fields; however, it is susceptible to many capricious factors, such as personal preference, and is relatively ex parte.
To solve the problem of differentiation caused by subjective factors, it is necessary to formulate a standard for image quality evaluation (QA), that is, to use a specific mathematical model to quantify the difference between each image, to objectively evaluate the image quality. We adopted the image visibility evaluation criterion and image structure similarity evaluation criterion using the peak signal-to-noise ratio (PSNR), structural similarity (SSIM), and natural image quality evaluator (NIQE) evaluation indicators to conduct a comprehensive evaluation and analysis of the aforementioned eight main dehazing algorithms. e PSNR uses the mean square error (MSE) to calculate the different values of the image pixels. e larger the value, the better the quality of the restored image. e calculation formula is shown in Its MSE is calculated using where I and K refer to a hazy image of size m × n and a processed image, respectively. e pixel value is represented by a B-bit binary number. In this study, the image pixel domain is [0, 255]; therefore, B � 8. e MSE represents the comparison result of the pixel-by-pixel difference between two images. e structural similarity formula is implemented via brightness comparison formula (18), contrast comparison formula (19), and structure comparison formula (20): where μ i and μ j represent the mean values of i and j and σ 2 i and σ 2 j are the variances of i and j, respectively. σ ij is the  Scientific Programming covariance of i and j; C 1 � (k 1 L) 2 and C 2 � (k 2 L) 2 are constants with default values k 1 � 0.01 and k 2 � 0.03 to avoid the case where the denominator is zero during the calculation. Equation (21) shows how the SSIM operates: Considering α � β � c1, the calculation formula of SSIM can be obtained as SSIM has symmetry, which implies that SSIM(i, j) is equivalent to SSIM(j, i). e domain of SSIM is [0, 1]. e larger the value, the smaller the difference between the dehaze image and the original image. Images with large values show better integrity and a more reasonable structure. e evaluation criterion can also be used as an evaluation standard for the SR technology.
e NIQE algorithm evaluates the image quality by calculating the distance between the multivariate Gaussian (MGV) feature parameters extracted from the dehazing images and the pretrained model parameters, as shown in where v 1 and v 2 are the mean vectors of the natural MVG model and Σ 1 and Σ 2 are the covariance matrices of the distorted image's MVG model. e characteristic of NIQE is that no haze-free image is required as a reference. e smaller the value is, the smaller the gap between the haze-free image and the pretrained model is and the higher the image quality is. erefore, this paper takes it as the evaluation index of real-world images.

Experiment on the O-Haze Dataset and NTIRE Dataset.
Substantial experiments were performed on the entire O-Haze and NTIRE datasets. e O-Haze dataset contains 45 paired hazy and haze-free images, whose hazy conditions are manufactured by a professional haze-making machine. e NTIRE dataset includes 35 pairs of outdoor nonhomogeneous hazy images. Part of the defogging results (with a size of 512 × 512) is shown in Figure 5 to facilitate comparison and analysis.
For the first image in the O-Haze dataset, the results of the DCP, Fattal, and AOD methods present an overall bluish hue; the Berman algorithm has a better foreground effect, but the distant details are fade, while our method, IDE, and the Meng algorithm retain clear distant details and show the best restoration effect; the IDE algorithm significantly increases the brightness. For the 11th image in the O-Haze dataset, all the algorithms achieved an insignificant dehazing effect on distant trees but our method outperformed the others on colour restoration in close-range processing. For the 12th image in the O-Haze dataset, our method achieved the most significant dehazing effect and the result is close to the real scene, whereas the results of the Fattal and AOD methods are overall bluish and DehazeNet has a poor dehazing effect. For the 31st image in the O-Haze dataset, our algorithm has no obvious effect on the processing of the branches in the upper left corner, the overall colour of the Fattal algorithm is yellow, and the image of the Berman algorithm is distorted. For the 33rd image in the O-Haze dataset, all traditional algorithms have bright strips on the left side of the image and the effects of the two neural network algorithms are not obvious. Our algorithm and IDE algorithm achieved the best effect; for the 41st picture in the O-Haze dataset, our algorithm and Berman's algorithm are better than other algorithms in processing the sky area. For the 2nd image in the NTIRE dataset, our algorithm has the most thorough dehazing effect, the Berman algorithm has severe colour distortion, and the results of all other algorithms are bluish. For the 7th image in the NTIRE dataset, all algorithms have a poor dehazing effect owing to the heavy fog concentration, especially in the middle area above the image, but our algorithm and IDE algorithm have a better dehazing effect than other algorithms in the near field. For the 9th image in the NTIRE dataset, the DehazeNet algorithm does not have a significant dehazing effect. Our algorithm has the best defogging, but the hue is darker, and the other algorithms have different degrees of bluishness. In summary, our algorithm has certain advantages in terms of the subjective dehazing effect. e results of the objective evaluation indexes PSNR and SSIM are listed in Table 1. As can be observed from the table, our algorithm has certain advantages over the other seven methods in both evaluation indexes. Most SSIM of our algorithm is optimal in most images in the O-Haze dataset and suboptimal in the NTIRE dataset, indicating that the gap between the defogging image and the original image is small and the structural integrity is strong. e DCP algorithm has a higher value when processing the 33rd image in the O-Haze dataset; however, from the perspective of the subjective defogging effect of the image, the brightness of the defogging image of DCP and the other four algorithms is low, whereas our algorithm significantly improves the overall brightness of the image, solves the problem of the bluish hue of dark channel dehazing, and is more in line with the characteristics of the real fog-free image. Although in the seventh image picture in the NTIRE dataset, the PSNR and SSIM of our algorithm are not the highest, the subjective feeling effect is better than that of other algorithms, which also shows that there is still room for improvement where the haze is particularly thick and efforts are required.

Experiment on Real-World Images.
To further verify the effectiveness of the algorithm in this study, real-scene images were selected for the experiment. e results are shown in Figure 6. e size of the foggy image was 512 × 512. As shown in Figure 6, when processing the first and third images, the Meng, Fattal, and Berman algorithms exhibit serious colour distortion problems in the sky area, while the algorithm in this study has an ideal processing effect. For the second image, the detailed processing of the Fattal algorithm in the building part is not obvious, and the sky area shows a dark   Table 2. It can be seen that in the images of road, urban area, and urban rail, IDE algorithm obtains low parameter values due to overexposure of the images, but obviously, it cannot be applied to all the images. As for image parameters of urban area images, IDE obtains the highest parameter values among the 8 algorithms. e proposed algorithm is more consistent with people's subjective feelings in the road image, and the detail processing of the distant houses in the city rail image are better than the IDE algorithm. e proposed algorithm obtains relatively low values in the processing of urban images and is second only to the DehazeNet algorithm in the housing images. e reason is that there exits colour distortion in the upper left corner of the image. But, the DehazeNet algorithm has a poor haze-removing effect in terms of subjective perception. Comprehensively, we believe that our algorithm preserves more original colour information in the image dehazing process and the effect is better.
From the above experimental comparison, it can be observed that the proposed algorithm can achieve a finer effect in the processing of image details and the resulting images are more realistic, providing people with a better visual experience. e parameters PSNR and SSIM are   higher than those of the other algorithms in most cases. However, the algorithm proposed in this study has a poor effect in thick haze areas. is is because, under the influence of large white areas, the significance of the regional similarity value is lost, which leads to excessive brightness exposure in such regions after dehazing, resulting in regional white blocks.

Conclusion
In this paper, a dehazing algorithm for heterogeneous images based on the optimisation of regional atmospheric ambient light was proposed to solve the problem of image colour distortion and the overall bluish and somber hue, which exists in the dark channel prior algorithm. In this method, the regional mean value of the RGB three-layer dark channel in a foggy image was solved and the corresponding regional atmospheric ambient light value was obtained by linear stretch correction. Subsequently, according to the transmittance obtained by the dark channel prior theory, the V channel of the foggy image is considered as the guiding graph for guiding filtering according to different channels to approach the real image transmittance and the atmospheric scattering model is used for defogging processing. e experimental results show that the image dehazing optimised by the proposed algorithm is superior to most classical dehazing algorithms in both subjective vision and objective quantification indexes and the problem of the dark hue is well solved. However, the algorithm in this study should traverse the entire image when calculating the atmospheric ambient light value, leading to a long execution time of the algorithm. To achieve better defogging efficiency, this study will continue to explore a better solution.
Data Availability e research data used to support the findings of this study are available from the corresponding author only under license and so cannot be made freely available. Requests for access to these data should be made to the corresponding author.

Conflicts of Interest
e authors declare that they have no conflicts of interest.