# UV3D: Underwater Video Stream 3D Reconstruction Based on Efficient Global SFM
## 3 SFM Preliminaries
### UW Image Enhancement  
Due to the complexity of the marine environment, the quality of images underwater is influenced by the attenuation and scattering of light. Regarding light attenuation, different propagation characteristics of light with different wavelengths in water result in issues such as color distortion, blurred vision, and reduced contrast in images collected by the underwater optical sensor. In addition, light scattering resulting from suspended particles may cause images to be noisy and smoggy, and this leads to problems such as blurred edges and a lack of detail. Additionally, when the light irradiates the object in the water, it will scatter when it meets the impurities in the water and it will be directly received by the camera, resulting in the low contrast of the image. Considering images acquired in different environments, here we use two algorithms to enhance the image sequence automatically: method 1 targets underwater images with red channel degradation, and method 2 targets images with impaired sharpness. Figure 3: Clustering dendrogram. **Method 1**: For shallow water environments with enough natural light, there is no need for external lighting equipment. Still, the longer-wavelength red light will decay faster than blue or green light, and blue-green tones will dominate the image. In this paper, we perform the image fusion based on a red channel prior method [18] with improved histogram equalization. The red channel prior method is improved based on the dark channel prior (DCP) method [19], and it recovers some of the visibility while correcting the color attenuation. The histogram equalization method can compensate for the difficulty in differentiating gray levels visually, making it a powerful tool for adaptive contrast enhancement. The complete algorithm flow is shown in Figure 4.  
Firstly, we restore the original image with the red channel prior method and obtain the initial restoration image. Secondly, as our method specifically aims at the red channel, we eliminate the low-frequency regions before histogram equalization. In our method, we use the gradient as the standard of filtration, whereby the area where the gradient value is close to 0 is the low frequency region, so we note the gray value of the area as 0 and obtain a new grayscale histogram. In the end, histogram equalization is applied to further enhance the red channel, and then we remerge the three channels to obtain the final restored image. Our results are shown in Figure 5, (b) and (d) are histograms of the original image (a) and enhanced image (c) respectively, the R/G/B histograms of (a) and (c) has pixels in the range of 0-255, and the pixel values are evenly distributed on the x-axis, and the y-axis represents the number of pixels corresponding to each pixel value. We can see the color histogram is more balanced after enhancement, and the red component is significantly increased. From another point of view, it can be seen from (c) that the image quality and color is improved comparing with (a), and there are more details in image (c) so more feature points can be detected. We also use UIQM [32], which is a linear combination of a color measurement index (UICM), clarity measurement index (UISM), and contrast measurement index (UIConM). It targets the degradation mechanism and imaging characteristics of underwater images, whereby the larger the value, the better the color balance, clarity, and contrast of the image. Figure 4: Image enhancement algorithm flow chart. **Method 2**: As for water without enough light, it is necessary to use external lighting equipment, and the image quality will be reduced due to the scattering of suspended objects. In such situations, we switch to another mode [33] to enhance the images. The method proposed by [PERSON] and [PERSON] et al. improves the quality of the whole picture; enhances the quality of the most important, useful, and task-related information; and weakens the information of areas of no interest.