# Investigations into Picture Defogging Techniques Based on Dark Channel Prior and Retinex Theory
## 3 The Proposed Methods
### Dark Channel Prior Compensation  
When calculating the dark channel values of regions with large changes in the depth of field edges of the image, the minimum value filter used may cause the dark channel values to be on the low end, leading to the overestimation of the transmittance values, which in turn causes serious halo effects in the defogged image, so the mean value filter is used to obtain the mean dark channel map. Considering that the mean filter can improve the dark channel value and reduce the transmittance value of the local area, but it may also cause the overall color of the recovered image to be dark, we use the weighted value of the mean filter and the minimum filter as the new dark channel value of the halo area to inhibit the halo effect and, at the same time, to reduce the overall color of the dark effect. First, the enhanced image is minimized to determine the \(R\), \(G\), and \(B\) channel minima \(I_{\text{min}}(x)\), as in Equation (15):  
\[I_{\text{min}}(x)=\min_{c\in\{R,G,B\}}\left(I_{E}^{c}(x)\right) \tag{15}\]  
where \(c\) denotes the \(R\), \(G\), and \(B\) color channels. Subsequently, the results obtained from Equation (15) are subjected to minimum filtering and mean filtering to derive the dark channel map and the mean dark channel map, respectively. The expressions are as follows:  
\[I_{dark1}(x)=\min_{x\in\Omega(x)}\left(\min_{c\in\{R,G,B\}}I_{E}^{c}(x)\right) \tag{16}\]  
\[I_{dark2}(x)=\underset{x\in\Omega(x)}{mean}\left(\min_{c\in\{R,G,B\}}I_{E}^{c }(x)\right) \tag{17}\]  
where \(I_{dark1}(x)\) denotes the original dark channel image, and \(I_{dark2}(x)\) represents the mean dark channel image. Mean value filtering can increase the dark channel value in the local area, thus reducing the value of the transmittance in the area and improving the defogging effect, but it may lead to an overall dark color of the image after defogging. Therefore, this paper adopts the weighted value of the mean filter and minimum filter as the new dark channel value of the halo region, in order to inhibit the halo effect and minimize the dark effect of the overall color. The halo region value is calculated as follows. Figure 2: Image defogging algorithm flow. The absolute value image of the corresponding pixel point difference between the original dark channel image \(I_{dark1}(x)\) and the minimum value grayscale map \(I_{\text{min}}(x)\) is calculated to obtain the difference image \(V(x)\), as in Equation (18):  
\[V(x)=|I_{dark1}(x)-I_{\text{min}}(x)| \tag{18}\]  
where \(V(x)\) denotes the edge image obtained by the difference, which refers to the halo regions. Finally, an adaptive threshold \(T_{0}\) is introduced, whereby pixels with a \(V(x)\) difference greater than or equal to \(T_{0}\), identified as edge pixels, require correction. This correction is achieved through the weighted fusion of the original dark channel map and the mean dark channel map, resulting in a refined dark channel image \(I_{dark}(x)\). The optimal value of \(\alpha\), determined through multiple experiments, is 0.8, as in Equations (19) and (20):  
\[T_{0}=\frac{\text{max}(V(x))}{4} \tag{19}\]  
\[I_{dark}(x)=\left\{ \begin{array}{cc}(1-\alpha)I_{dark1}(x)+\alpha I_{dark2} (x)&,V(x)\geq T_{0}\\ I_{dark1}(x)&,V(x)\leq T_{0}\end{array} \right. \tag{20}\]  
The weighting coefficient \(\alpha\) = 0.8 is determined by minimizing the halo artifact metric \(H\) defined as the gradient variance in depth-discontinuous regions:  
\[H(\alpha)=\sum_{p\in\varepsilon}\left(\
abla t(p)-\overline{\
abla t}\right)^ {2} \tag{21}\]  
where \(\varepsilon\) denotes edge pixels. As shown in Figure 3d, \(H(\alpha)\) reaches its minimum at \(\alpha\) = 0.8 across 100 test images fromc RESIDE dataset. Values within [0.75, 0.85] yield comparable results (\(H<\) 1.2 min(H)), confirming robustness. Figure 3 presents the enhanced foggy image, the minimum value dark channel map, the mean-compensated dark channel image, and a sensitivity analysis of the weighting coefficient \(\alpha\).