# Investigations into Picture Defogging Techniques Based on Dark Channel Prior and Retinex Theory
## 2 Theoretical Foundations and Key Components
### Image Enhancement  
Retinex theory involves one of the models describing how the visual system perceives the surface reflectance of a scene in order to explain the color vision of the human eye [18]. The main goal of the theory is to try to decompose a given image into two different images: the physical reflectance image and the illumination image. That is, for a coordinate point, the following equation can be used:  
\[I(x)=L(x)R(x) \tag{1}\]  
where \(I(x)\) denotes a foggy image, \(L(x)\) denotes a light image, and \(R(x)\) denotes a reflectance image.  
It has been shown that the visual system is more sensitive to relative changes in light and darkness in a scene, i.e., the contrast of the scene, and insensitive to the absolute intensity of light [35]. Thus, changes in light and dark in a scene excite the visual system to produce a corresponding neural response that can be approximated using visual contrast. Considering Retinex theory's claim that the visual system has a preferential perception of physical reflectance, the reflectance \(R(x)\) in this paper is approximated using the method of calculating contrast. The classical CSR model implements a method for calculating image contrast [36], as in Equation (2):  
\[R(x)=\log I(x)-\log S_{\sigma}(x) \tag{2}\]  
where \(S_{\sigma}(x)\) denotes a neighborhood mean of the foggy image \(I(x)\), which is generally calculated using a Gaussian smoothing window, as in Equation (3):  
\[S_{\sigma}(x)=I(x)*w_{\sigma}(x) \tag{3}\]  
where \(*\) denotes the convolution operator, \(w_{\sigma}(x)\) denotes the Gaussian smoothing window, and \(\sigma\) denotes the Gaussian window standard deviation. According to the literature [36], Equation (2) is also approximately equal to the reflectance image contrast of the point.  
The \(R(x)\) obtained in Equation (2) represents a contrast image with a distribution of positive and negative values. Since the responses of the visual system to optical stimuli are all positive, this paper uses Equation (4) as an expression for the perceived intensity of the visual system to the physical reflectance, i.e., the reflectance \(R_{p}(x)\):  
\[R_{p}(x)=\max[0,R(x)+1] \tag{4}\]  
After obtaining \(R_{p}(x)\) according to Equation (4), the perceived light \(L_{p}(x)\) is given by Equation (1):  
\[L_{p}(x)=\frac{I(x)}{R_{p}(x)} \tag{5}\]  
Since light images have a large dynamic range, the dynamic range of the light image is adjusted to achieve the goal of enhancing the details in the shadow areas.  
Experimentally, it has been demonstrated that the output of the retinal response to light intensity is proportional to the power of light intensity [35]. In other words, the retinal neural response is proportional to the gamma transformation of physical light with the following expression in Equation (6):  
\[L_{M}(x)=\omega(\frac{L_{p}(x)}{\omega})^{\frac{1}{\gamma}} \tag{6}\]  
where \(L_{M}(x)\) denotes the adjusted illumination image, and \(\omega\) and \(\gamma\) are constants, where for an 8-bit image, \(\omega\) = 255. It is found that when the value of \(\gamma\) is in the range of [2.0, 3.0], better visual quality can be obtained, and a larger \(\gamma\) can lead to a greater dark area enhancement effect, but it can also cause over-enhancement more easily. In this paper, using the recommended value of \(\gamma\) = 2.2 can achieve a better balance between enhancing the details of dark areas and avoiding the over-enhancement of images.  
Finally, the reflectance image \(R_{p}(x)\) and light image \(L_{M}(x)\) obtained by solving Equations (4) and (6) are substituted into Equation (1) to obtain our final enhanced image \(I_{E}(x)\), as in Equation (7):  
\[I_{E}(x)=R_{p}(x)L_{M}(x) \tag{7}\]