# Tilt-Induced Error Compensation with Vision-Based Method for Polarization Navigation
## 2 Principle of Visual Horizontal Attitude Angle Measurement
### Dark Channel Defogging Algorithm Based on Retinex Theory  
To enhance the algorithm's detection performance in low illumination and hazy circumstances, this paper proposes a dehazing-enhancement method that integrates the Retinex theory with the dark channel prior. The Retinex theory decomposes an observed image \(I(x)\) into two components: the reflectance component \(R(x)\) and the illumination component \(L(x)\), with \(R(x)\) representing the intrinsic color or reflectivity of objects, and \(L(x)\) corresponding to the intensity of ambient illumination [27]. Retinex theory posits that the original image \(I(x)\) can be mathematically expressed as the product of these two components:  
\[I(x)=R(x)\cdot L(x) \tag{1}\]  
where \(x\) denotes the pixel position in the image. By decomposing the image, we can independently enhance either the illumination or reflectance components, thereby improving image quality. A logarithmic transformation is applied to the image to achieve this decomposition:  
\[\log(I(x))=\log(R(x))+\log(L(x)) \tag{2}\]  
The illumination component \(L(x)\) is assessed by image smoothing. Typically, this component can be obtained by applying Gaussian filtering to the input image:  
\[L(x)=G(x,\sigma)*I(x) \tag{3}\]  
where \(G(x,\sigma)\) represents the Gaussian filter kernel, whereas \(\sigma\) denotes the standard deviation that controls the scale of the filter. After obtaining the illumination component \(L(x)\), the reflectance component \(R(x)\) is derived by removing the illumination component from the original image:  
\[R(x)=\exp(\log(I(x))-\log(L(x))) \tag{4}\]  
Since the haze accumulation effect predominantly affects the illumination component, we apply the dark channel prior specifically to the illumination component for haze removal [28], thereby preserving critical texture details in the reflectance component. The dark channel computation is performed on the illumination component as follows:  
\[J^{dark}(x)=\min_{y\in\Omega(x)}(\min_{c\in\{r,g,b\}}L^{c}(y))\to 0 \tag{5}\]  
where \(\Omega(x)\) is the local region centered at pixel \(x\), and \(c\) denotes the RGB channel. Figure 1: Flowchart of the horizon attitude estimation method. Next, the atmospheric light \(A\) is estimated by selecting the top 0.1% brightest pixels in \(J^{dark}(x)\). This selection strategy ensures a robust estimation by avoiding noise from isolated bright pixels while still focusing on regions heavily influenced by atmospheric scattering [29]. These selected pixels correspond to regions in the original enhanced image \(I_{enh}(x)\), from which we calculate the mean values across RGB channels to determine the atmospheric light components. Using the estimated atmospheric light \(A\), the atmospheric transmission \(t(x)\) is then computed through:  
\[t(x)=1-\omega\cdot\min_{c\in\{r,g,b\}}\left(\min_{y\in\Omega(x)}\frac{L^{c}(y) }{A^{c}}\right) \tag{6}\]  
where \(\omega\) denotes the dehazing parameter, generally assigned a value of 0.95. By using the estimated atmospheric light \(A\) and transmission map \(t(x)\), we recover the haze-free illumination component through the following formulation:  
\[L^{\prime}(x)=\frac{L^{c}(x)-A^{c}}{\max(t(x),t_{0})}+A^{c} \tag{7}\]  
where \(t_{0}\) denotes the lower bound of transmission (typically set to 0.1). Subsequently, the reflectance component \(R(x)\) undergoes enhancement via histogram equalization to augment image contrast and brightness. The enhanced reflectance component \(R^{\prime}(x)\) achieves greater detail prominence while compensating for illumination inhomogeneity. Finally, the enhanced reflectance component \(R^{\prime}(x)\) and the dehazed illumination component \(L^{\prime}(x)\) are multiplied to obtain the final dehazed-enhanced image:  
\[I^{\prime}(x)=R^{\prime}(x)\cdot L^{\prime}(x) \tag{8}\]  
The comparative analysis was conducted across three different scenes: individual Retinex enhancement, standalone dark channel prior, and the proposed integrated dehazing-enhancement algorithm.