*5.5. Comparative Experiments and Analysis of Gray Scale Correction Methods for Side-Scan Sonar Images*

The existing gray level correction methods for side-scan sonar images are realized by experiments. As the TVG method and sonar propagation attenuation model needs to know some side-scan sonar parameters, we only compared the histogram method, the non-linear gray level compensation method, and the function fitting method with our mean filtering method. Figure 15 shows that various methods improve the gray distortion of the original side-scan sonar image after gray correction. The corrected images obtained by the histogram and non-linear compensation methods show that some areas of the image are too strong, then the left and right ends of the image are too weak, which leads to an unsatisfactory enhancement effect of the whole corrected image. The function fitting method and the method proposed in this paper are better than the other two methods.

**Figure 15.** Comparison experiments of common methods used to correct side-scan sonar images: (**a**) The original side-scan sonar image, (**b**) histogram, (**c**) non-linear compensation, (**d**) function fitting, and (**e**) our method.

Figure 16 depicts a histogram comparison of the enhanced images. The histogram correction method results in overweight correction, which produces a particularly high gray value in some areas of the image. The non-linear compensation and function fitting methods have too many parts with low gray values, which proves that the image correction is inadequate. The histogram of the side-scan

sonar image enhancement method proposed in this paper shows that the gray value distribution of the side-scan sonar image after correction is uniform, and the correction result of the algorithm is satisfactory.

**Figure 16.** Histograms corresponding to the images in Figure 15: (**a**) the original side-scan sonar image (**b**) histogram, (**c**) non-linear compensation, (**d**) function fitting, and **(e**) our method.

To better analyze the contrast effect of the different enhancement methods, we enlarged the enhanced image locally. The enlarged image is shown in Figure 17. We found that the texture of the side-scan sonar image is destroyed by the function fitting method. The enhanced side-scan sonar images obtained by function fitting, histogram, and non-linear compensation methods have low gray values at the left and right ends of the image, and the effect of gray correction is not obvious. However, our method still enhances the local enlargement image very clearly.

**Figure 17.** Local enlargement of Figure 15: (**a**) the original side-scan sonar image, and the images produced using the (**b**) histogram, (**c**) non-linear compensation, (**d**) function fitting, and (**e**) our methods.

Only visually observing the corrected image may not be sufficient to differentiate the methods. We also contrasted the image enhancement indexes for the local enlarged image, as shown in Table 3. The enhanced image in this paper is superior to other methods in information entropy and average gradient.



Our method was compared with the commonly used gray level correction method for side-scan sonar images. According to the experimental results, our method is superior to the other methods. Compared with other common methods and the latest optical image methods based on Retinex, the gray scale correction effect of side-scan sonar images using our method is better than those of these methods, as shown by the experimental results and data indicators.

#### **6. Expansion of Our Method**

The proposed method is not only suitable for gray level correction of side-scan sonar images, but can also be used to enhance low illumination optical color images. The steps for low illumination color image enhancement are shown in Figure 18. Firstly, we separate the three channels of the color image into R, G, and B channels. Then, we use the above-mentioned method (gray image smoothing filtering), and add a constant *a* as the illumination image *L*. Using Equation (15), the three channels are separately removed from the illumination image *L* and multiplied by constant coefficient *A* to obtain the enhanced images of the three channels. Finally, the three channels are merged into the final color enhanced image.

$$S'\_{r\S b} = A \ast \frac{S\_{r\S b}}{L} \tag{15}$$

To verify the speed of our proposed algorithm for low illumination color image enhancement, we conducted an experiment. The smoothing method used in the experiment was mean filtering. The size of the filter template was one-seventh of the original image. *A* was set to 160 and *a* was set to 17. All the experiments were conducted on a PC running Windows 10 (Microsoft, Redmond, US) OS with 8 G RAM and a 3.7 GHz CPU. Our code was implemented using C++ and OpenCV, which is an image processing library.

As shown in Figure 19, we selected four low illumination color images of different sizes for enhancement. Table 4 shows the time required for low illumination color image enhancement with different-sized images. Because of its speed, this algorithm can meet the real-time video processing requirements. If GPU is used to accelerate the processing, the algorithm will be faster.

**Figure 18.** Low illumination color image enhancement process.

**Figure 19.** Enhancement effect of four low illumination color scene images: (**a**) scene 1, (**b**) scene 2, (**c**) scene 3, and (**d**) scene 4.


4 1024 × 683 963 KB 0.206

**Table 4.** Time required to enhance different-sized low illumination color images.

As shown in Figure 19, the first three low-illumination color images are better enhanced by our image enhancement method, but the fourth image is enhanced with an obvious halo phenomenon. The halo phenomenon occurs after the image is enhanced in areas where the gray gradient changes greatly. This mainly occurs because the smoothing method adopted in this paper is too simple, which results in the obtained illumination map being too rough and the illumination distribution of the original image is not well expressed. Thus, our enhancement method is more suitable for side-scan sonar images that where the gray gradients changes are not so abrupt.

#### **7. Conclusions**

Side-scan sonars are widely used in ocean exploration. As the original side-scan sonar images are affected by gray distortion, gray scale correction is needed before any further image processing. Considering the difference between side-scan sonar images and visible images, we proposed a gray correction method for side-scan sonar images based on Retinex, which is simple and easy to implement. Compared with the commonly used gray scale correction methods for side-scan sonar images, this method avoids the limitations of the current gray scale correction methods, such as the need to know the side-scan sonar parameters, the need to recalculate or reset the parameters for different side-scan sonar image processing, and the poor image enhancement effect. Compared with the latest image enhancement algorithms based on Retinex, our proposed methods have similar image enhancement indexes, and our method is the fastest. When it is necessary to adjust the brightness of the corrected image, only the magnitude of constant coefficient *A* in the algorithm needs to be adjusted. Our method can also be used to enhance low illumination color images, and the experimental results show that the algorithm is fast.

**Author Contributions:** Conceptualization, X.Y. and H.Y.; Data curation, H.Y.; Formal analysis, H.Y.; Funding acquisition, X.Y.; Investigation, X.Y. and C.L.; Methodology, X.Y.; Project administration, P.L.; Resources, C.L. and Y.J.; Software, H.Y., Y.J. and P.L.; Supervision, C.L.; Validation, H.Y.; Visualization, Y.J.; Writing – original draft, X.Y.; Writing – review & editing, X.Y.

**Funding:** This work was supported by the National Natural Science Foundation of China (Grant No. 41876100), the National key research and development program of China (Grant No. 2018YFC0310102 and 2017YFC0306002), the State Key Program of National Natural Science Foundation of China (Grant No.61633004), the Development Project of Applied Technology in Harbin (Grant No.2016RAXXJ071) and the Fundamental Research Funds for the Central Universities (Grant No. HEUCFP201707).

**Acknowledgments:** To verify the adaptability of the parameters of our algorithm, we used side-scan sonar images from previous studies. Thank you to the authors of these papers.

**Conflicts of Interest:** The authors declare no conflict of interest.
