# AEA-RDCP: An Optimized Real-Time Algorithm for Sea Fog Intensity and Visibility Estimation
## 3 Approximating and Eliminating the Airlight--Reduced DCP (AEA-RDCP)
### Example of Setting and Applying Ambient Light Estimation Thresholds
Generate Dark Channel Image:**  
**For** each image **do**  
- Select the minimum value among the R, G, B channels for each pixel to create the dark channel image. - Apply erosion operation to the dark channel image to obtain the final dark channel image. **3. Select the brightest pixel among the top 0.1% pixels in the Dark Channel image:**  
- Select the top 0.1% brightest pixels in the dark channel image. - Find the brightest pixel among them. **4. Extract a patch around  
Figure 7 illustrates a comparison between two methods: (a) setting the threshold value based on the average pixel values of the top 0.1%, where the pixels identified as atmospheric light are set to 0, and (b) setting the threshold value based on the average pixel values within the designated patch size around the top 0.1% of pixels, also setting the atmospheric light pixels to 0. Comparing these two methods, (a) and (b), demonstrates that using a patch size setting more effectively reduces the influence of atmospheric light, setting the pixel values to 0. This approach helps accurately identify and mitigate the effects of atmospheric scattering on image quality. The formula used for setting the pixel values to 0 when estimating atmospheric light is defined as follows in Equation (4):  
\[\mathbf{p}^{\prime}(\mathbf{x},\mathbf{y})= \begin{cases}\mathbf{p}(\mathbf{x},\mathbf{y})&\mathbf{If}\ \mathbf{ mean}(\mathbf{p}(\mathbf{x},\mathbf{y}))<\mathbf{T}\\ \mathbf{0}&\mathbf{Otherwise}\end{cases}  \tag{4}\]  
\(\mathbf{p}(\mathbf{x},\mathbf{y})\) denotes the RGB value of the pixel at coordinate \((\mathbf{x},\mathbf{y})\) in the original image, and \(\mathbf{p}(\mathbf{x},\mathbf{y})\) denotes the RGB value of the pixel at coordinate \((\mathbf{x},\mathbf{y})\) in the transformed image. \(\mathbf{mean}(\mathbf{p}(\mathbf{x},\mathbf{y}))\) represents the average RGB value of the pixel at \((\mathbf{x},\mathbf{y})\). T is the atmospheric light estimation threshold. In this formula, the average value of each pixel is first calculated, and, if this average value is less than the threshold, the pixel value is retained; if it is greater than or equal to the threshold, the pixel value is set to 0. This method effectively reduces the influence of atmospheric light in images of sea regions. Figure 6: Dataset for obtaining the atmospheric light estimation threshold. Additionally, Figure 8 shows an example image where the patch size is set to \(301\times 301\) pixels. In this figure, the x-axis and y-axis represent the dimensions of the image, and the blue-highlighted areas indicate the patch size surrounding the top 0.1% brightest pixels in the DC image. These patches, located around the top 0.1% brightest pixels, are shown to be influenced by atmospheric light. To accurately identify pixels affected by atmospheric light, the average values of the R, G, and B channels within the designated patches around the top 0.1% brightest pixels are calculated [35]. The threshold for determining atmospheric light is set at 0.95. This approach precisely identifies and excludes pixels affected by atmospheric light from further analysis, thereby improving the accuracy of fog density estimation. By setting the threshold in this manner, errors caused by reflected sunlight or other external light sources are effectively reduced, enhancing the reliability of detecting atmospheric light effects. As a result, this method provides more accurate and reliable data for subsequent processing and analysis, ensuring that the true conditions of the scene are more faithfully represented.