## 2 Methodology
### Method Overview
#### 2.4.1 Image Preprocessing  
Due to the interference from the moving objects such as hull and the clouds in the sky during the process of image collection, the moving objects will change their shapes and positions in the images. Therefore, these images need to be preprocessed to identify the locations of the effective subregions before feature extraction. First, gray weighted averaging is applied to all the images in the database and a comprehensive gray average image \(\overline{G}[I]\) is obtained. After designing the threshold value, the images in the database were adaptively segmented to obtain the subregion images. Samples of database images with interference from moving objects were shown in Figure 5. As the viewing angle of the camera was fixed while the background objects in the image (e.g., hull and clouds) changed with time, the background moving objects will interfere the visibility evaluation and it will cause error in visibility estimation. In order to obtain accurate visibility estimation, it was necessary to eliminate these interferences and background objects from the images. Therefore, it was preferable to extract the effective subregions with removal of redundant background moving objects from the images.  
In Figure 5, the main components of the images were the sky, buildings and the hulls in the water area. However, only buildings and stationary objects were relevant for the visibility estimation while the water area and sky cannot provide useful information for the visibility estimation. Buildings and fixed landmark objects could be considered as static objects in the image while moving hull or clouds in the sky are dynamics objects in the image. Visibility measurement can be considered as the largest distance that could be observed from the viewing point. As the moving objects (e.g., sky, water and hull) are changing in positions or shape with time, they should not be used as reference for accurate visibility assessment. Therefore, we should filter out or remove the dynamic objects so as to extract the effective area with static objects that can provide useful image features for visibility estimation. The effective subregions cover the buildings or stationary structure (e.g., island) at different landmark distances from the viewing point. In this paper, we have used the gray average weighted image to locate the effective subregions of the images.  
The gray-level average weighted image of the image database was obtained by applying the gray-level weighted average to each data point of the images in the database.  
Figure 5: Image samples with interference from moving objects.  
Image with 1920 \(\times\) 1080 pixels were used in this paper. The average gray level of the pixels at coordinate \((x_{n},y_{m})\) (\(n=1\dots\ n_{max}\), \(m=1\dots\ m_{max}\)) given by Equation (6).  
\[\overline{g}(x_{n},y_{m})=\frac{1}{N}\sum_{j=1}^{N}g_{j}(x_{n},y_{m}) \tag{6}\]  
where \(g_{j}(x_{n},y_{m})\) is the gray level of the \(j\)th image at coordinate \((x_{n},y_{m})\) (\(j=1\dots\ N\)). An example of the comprehensive gray average image was shown in Figure 6. The images in the database are sorted according to their collecting time. These sequences of image can provide the moving trajectories of the moving objects. After extensive simulations, it has been found that moving objects could be filtered out if we perform the gray-level averaging for these sequences of images. Fixed or static objects will be remained in the comprehensive gray weighted average image. Image features in the effective subregions with static objects could be extracted for visibility estimation. By performing gray-level average processing on the images in the entire database, the overall gray-level average image could be obtained.