# A Transfer Learning Method for Meteorological Visibility Estimation Based on Feature Fusion Method
## 2 Methodology
### Method Overview
#### 2.2.2 Subregion Segmentation  
After obtaining the image with outlines of the buildings, it is necessary to segment the image into different detection subregions. Image segmentation is a popular method to divide an image into different feature regions for extracting the objects of interest [28; 29]. Segmentation is a critical step connecting image processing and image analysis.  
There were many threshold selection methods in the past research, among which the maximum between-class variance method was the most widely used [30]. However, this method has the limitation that the target object could not be segmented from the background when the method is applied to images with complex backgrounds. Hence, an adaptive threshold segmentation method had been proposed [31]. Instead of calculating global image thresholds, local thresholds were calculated based on the distribution of brightness in different regions of the image. For different regions of the image, it can calculate different thresholds adaptively [32]. Figure 7 showed the histogram of the gray-level averaged image. We used the gray-level distribution of the histogram to determine the threshold.  
The adaptive threshold algorithm could be applied to image with uneven illumination. In order to compensate the differences in illumination, the brightness of each pixel needs to be normalized before determining whether the pixel was black or white. The gray-weighted average image derived in previous pre-processing steps was used as a reference. Adaptive threshold algorithm was used to determine the threshold value from which we could locate the area containing only fixed structure or buildings.  
Figure 6: Comprehensive image of gray mean square error.  
Figure 7: Gray histogram of Comprehensive image after gray weighted average.  
After applying the adaptive threshold algorithm, we have found two candidates for the threshold value (139 and 88 as shown in Figure 8). As the threshold value 88 can remove the background more effectively, segmentation threshold value of 88 is selected. According to the selected threshold value, the coordinates of the highest and lowest points of the effective area were located.  
Figure 8: Threshold segmentation image after gray weighted average.  
The image is then divided into segments with parallel lines as shown in Figure 9. We could find 5 effective subregions of similar size as shown in Figure 9 and image feature will then be extracted as described in the next session. In summary, the step-by-step procedures for the effective area extraction are described as follows.  
1. Apply gray-level averaging to all the images in the database to derive the comprehensive image.
2. Gaussian blur algorithm was applied to the image to obtain the grayscale distribution of the image.
3. Apply the adaptive threshold segmentation algorithm to find the threshold value.
4. According to the threshold value found in step 3, the images in the database were then segmented into sub-region images with x-y coordinates.
5. Effective subregions are then extracted from the results of step 4.