## 2 Method
### Preprocessing Module for Dehazing Design
#### 2.2.2 Weighted Aggregation-Guided Filtering  
According to the transmission formula 6, it is evident that, aside from brighter areas such as the sky [33], the dark channel values of objects in the image are generally low or even close to zero. In contrast, the dark channel values of the sky or other objects with high pixel values are relatively large. Consequently, in regions where object edges and grayscale discontinuities occur, there might be abrupt changes in grayscale pixel information. When conducting minimum filtering on brighter pixel values beyond the edge, it is possible for the pixel values in the brighter areas to decrease. This could lead to an overestimation of the transmission rate, resulting in excessive brightness in the dehazed image. This phenomenon causes a white border, commonly referred to as Halo [33].  
The introduction of weighted aggregation-guided filtering can effectively prevent the occurrence of Halo artifacts. Guided filtering is a means of establishing a linear relationship between the original image and the output image within a manually defined region [34]. In weighted aggregation-guided filtering, different weights can be assigned to different regions during the aggregation stage. If \(\omega_{k}\) represents the region with pixel \(k\) as the center,\(I\) represents the guidance image, and \(Q\) represents the output image, then the mathematical expression for weighted aggregation-guided filtering is given by the following [35]:  
\[Q_{i}=I_{i}{\sum}_{i,k\in\omega_{k}}\frac{\beta_{k}}{\|\beta_{k}\|}\alpha_{k}I_{ i}+{\sum}_{i,k\in\omega_{k}}\frac{\beta_{k}}{\|\beta_{k}\|}\beta_{k} \tag{8}\]  
The normalization coefficient \(\|\beta_{k}\|\) can be obtained from the equation \(\|\beta_{k}\|={\sum}_{q\in\omega_{k}}\beta_{i}\). The expression for the aggregation weight \(\beta_{k}\) of the window \(\omega_{k}\) is as follows:  
\[\beta_{k}=\exp(-\frac{e_{k}}{\eta}) \tag{9}\]  
where \(\eta\) is a constant, usually an empirically determined value set by humans, and \(e_{k}\) represents the mean squared error within the window \(\omega_{k}\), expressed as follows:  
\[e_{k}=\frac{1}{|\omega|}{\sum}_{i,k\in\omega_{k}}(a_{k}I_{i}+b_{k}-P_{i})^{2} \tag{10}\]  
Additionally, \(a_{k}\) and \(b_{k}\), respectively, denote the linear coefficients in the local window \(\omega_{k}\). Within the window \(\omega_{k}\), a cost function \(E\) is needed to evaluate the difference between the pre-filtered image \(P\) and the post-filtered image \(Q\). The mathematical expression for \(E\) is given by the following:  
\[E(a_{k},b_{k})={\sum}_{i,k\in\omega_{k}}\{a_{k}I_{i}+b_{k}-P_{i}\}^{2}+\varepsilon \overline{P_{k}} \tag{11}\]  
where \(Pi\) is the input image, \(\overline{P_{k}}\) is the mean of the input image within the window \(\omega_{k}\), and \(\varepsilon\) is called the regularization parameter, which is generally a small value. The expressions for \(a_{k}\) and \(b_{k}\) are given as follows:  
\[a_{k}=\frac{\frac{1}{|\omega|}{\sum}_{i\in\omega_{k}}I_{i}\overline{P_{i}}- \mu_{k}\overline{P_{k}}}{\sigma_{k}^{2}+\varepsilon} \tag{12}\]  
\[b_{k}=\overline{P_{k}}-a_{k}\mu_{k} \tag{13}\]  
In the above equation, \(|\omega|\) represents the number of pixels in the window \(\omega k\), \(\mu k\) denotes the mean within the window \(\omega_{k}\), and \(\sigma_{k}^{2}\) represents the variance within the window \(\omega_{k}\).  
After obtaining all the parameters mentioned above, with a filtering radius of 35, a regularization parameter \(\varepsilon\) of 0.001, and a constant \(\eta\) of 0.03, the objects in the image can maintain clear boundary information while smoothing out texture.