Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 11, No. 1, 2025 80 Optimization of Underwater Images Based on Gray World Algorithm and Jaffe‐McGlamery Models Wendong Wu *, Minmin Yao School of Geography Geomatics and Planning, Jiangsu Normal University, Xuzhou, Jiangsu, China * Corresponding author: Wendong Wu (Email: jsnuwwd@163.com) Abstract: In this paper, a comprehensive scheme for underwater image processing is proposed based on the grayscale world algorithm and the Jaffe-McGlamery model. Firstly, a color bias detection based on grayscale world theory, a low light detection based on HSV color space, and a fuzzy detection method based on frequency domain and Laplace operator are designed to classify different types of image degradation. Subsequently, the corresponding scene degradation models are constructed for different degradation types through the simplified Jaffe-McGlamery model, and the image features under different water conditions are analyzed. Next, an improved gray world algorithm is used to eliminate color bias, the limiting contrast adaptive histogram equalization (CLAHE) technique is utilized to improve the image quality under low-light conditions, and the dark- channel a priori algorithm is optimized by the depth estimation and parameter adaptation modules to remove blurring. The proposed method in this study significantly improves the image quality in different scenarios and provides a new idea for underwater image processing. Keywords: Underwater Image Processing; Gray-world Algorithm; Jaffe-McGlamery Model; CLAHE. 1. Introduction In this paper, we comprehensively use the gray-scale world algorithm [1] and Jaffe-McGlamery model [2], etc., aiming to cope with the color deviation, low light and blurring produced by underwater images, and to improve the visual effect and information quality of underwater images [3]. First, based on the gray world theory, the research designed the color bias detection algorithm [4], which accurately identifies the color biased image by analyzing the average value of the color channel of the image. Secondly, a simplified Jaffe- McGlamery model was used to construct a processing model for low-light and blurred images, and the image degradation characteristics in different scenes were studied. In addition, the Constrained Contrast Adaptive Histogram Equalization (CLAHE) algorithm [5] is used to improve the low-light images, and the dark-channel a priori algorithm is optimized by combining the depth estimation and parameter adaptive modules [6] to remove the blur effectively. Finally, the effects of different algorithms in specific scenes are evaluated by comparing the traditional physical inversion enhancement model with the optimized MLLE model. 2. Underwater Image Classification and Multi-Perspective Analysis In this section, different methods are used for statistical analysis and the images are classified into different degradation types including color-biased, low light and blurred. For this purpose, in order to distinguish the color- biased images, the gray world theory is used to calculate the average value of the red, green, and blue channels of each image. (1) For normal images, the average values of the three parts do not differ much. (2) For color-biased images, there will be an abnormality in the average value of a certain channel, and the study determines whether the image is a color-biased image by finding this abnormality. (3) For the detection of low-light images, a multi-feature fusion detection algorithm is used to comprehensively recognize low-light images by extracting image features, brightness, dark pixel ratio and contrast. (4) Compared with some drawbacks of general Laplace fuzzy detection, this section adopts Laplace and Fourier weighted score discrimination method, which has an intuitive computational process, can reflect global and local features, and is more superior to the fuzzy detection effect. 2.1. Grayscale World Algorithm The grayscale world algorithm assumes that the average value of the three RGB components of a natural image is approximate. Three-channel average calculation: ∑ ∑ , ∑ ∑ , ∑ ∑ , (1) The standard deviation between the three indicators is calculated. Thus, the color shift function is: 1 0 (2) Where is the color shift threshold. To further classify the degradation types, we calculated the color cast score, low light score, and blur score of the image, and did statistical analysis, and then further strengthened the classification through the score. This is shown in Figure 1 and Figure 2. 81 Figure 1. Score distribution Figure 2. Type of demotion 2.2. Multi-Feature Fusion Detection Algorithm Brightness Characteristics: ∑ ∑ , ∗ 255 (3) Dark pixel ratio: ∑ , (4) Contrast characteristics: ∑ (5) Marginal features: (6) Local variance characteristics: (7) Total Score: ∗ ∗ 1 ∗ ∗ ∗ (8) Figure 3 shows the Implementation process: 2.3. Spatial Domain Joint Frequency Domain Dual Evaluation Laplace Analysis: 0 1 0 1 4 1 0 1 0 (9) Application Laplace: ∗ (10) Energy Ratio Calculation: high total ∗ 0.7 mid total ∗ 0.3 (11) Weighted combination: ∗ ∗ (12) 82 Figure 3. Testing process analysis 3. Underwater Image Degradation Analysis This section uses the Jaffe-McGlamery model, a physical property-based degradation model, to address underwater image degradation models. The model represents the image degradation as a combination of the direct component of light, the forward scattering component and the backscattering component: ∗ ∗ 1 (13) The transmittance of light is expressed as: (14) For different scenarios, there are several scenarios as follows. 3.1. Color Shift Model , ∈ , , (15) , ∈ , , (16) This is the specific attenuation coefficient for the red, green and blue channels, and is related to the depth. 0 (17) is the turbidity of the water body. 3.2. Low-Light Models (18) ∗ (19) 0 ∆ , , (20) Among them is the spatially varying background light ∆ , , : ∆ , , 0 ⋅ 1 ⋅ , (21) 3.3. Fuzzy Modeling The fuzzy properties can be modeled using the point spread function PSF, which should be degraded as follows: , , ⨂ , , (22) , , , (23) 0 (24) 4. Underwater Image Enhancement Analysis 4.1. Color Bias Correction Model In this paper, we use an improved grayscale world algorithm with a depth factor to add a depth factor to the traditional grayscale world algorithm, which can better adapt to the gain intensity in different depth environments, and reduce the problem of “overcorrection”, which the original algorithm may over calibrate, especially in the dark area. By introducing the depth factor, the calibration intensity can be adjusted according to the depth of the scene, avoiding the image distortion caused by over-calibration. 4.2. Low Light Enhancement Model The CLAHE algorithm is mathematically visualized in Figure 4 below. Figure 4. CLAHE Visualization 83 4.3. Defuzz the Model Figure 5. Comparison of before and after removal of color deviation As shown in Figure 5, after processing the image, by comparing the effect before and after image enhancement, it can be observed that the overall brightness of the enhanced image is improved, the details are clearer, and the contrast enhancement makes the light and dark levels richer, the colors are more vivid and natural, and the color bias problem is effectively reduced. In terms of detail processing, the algorithm successfully extracts the detail information of the dark areas, while avoiding overexposure of the highlight areas and maintaining rich texture details and sharp edges. This comparative analysis can not only help us evaluate the processing effect of the algorithm, but also find out whether there are problems such as over-enhancement and noise amplification, as well as the adaptability of the algorithm to different scenes and lighting conditions. Calculation formula for each indicator: 10 ∙ log (25) MAX is the maximum value of the image pixels, and MSE is the mean square error. ∙ ∙ ∙ (26) Where is the standard deviation of chromaticity, which is the contrast of brightness, and is the average saturation. Calculate UIQM: ∙ ∙ ∙ (27) : Color Measure. : Sharpness measure. : Contrast measure. Calculating Edge Strength (EI): (28) Where and are the gradients of the horizontal and vertical directions of the image, respectively. Table 1 shows the results of the calculation of each indicator. Table 1. The results of each indicator are calculated ID PSNR UCIQE UIQM EI 1 13.4504 40.5993 0.0298 0.006 2 15.5399 24.2551 0.0255 0.007 3 13.2525 27.0151 0.0414 0.012 5. Underwater Image Enhancement for Complex Scenes In this section, the MLLE model is used, and its principle is shown in Figure 6. Figure 6. MLLE schematic In this section, an underwater image enhancement method based on minimum color loss and local adaptive contrast enhancement is proposed, aiming to address the quality degradation caused by scattering and absorption of 84 underwater images. In particular, the minimum color loss module analyzes the underwater image formation process based on a physical model and maintains the original color characteristics of the image by minimizing the loss of information in the color correction process. Local Adaptive Contrast Enhancement adaptively adjusts parameters based on local area characteristics to avoid over-enhancement and noise amplification, thus improving image details and edge sharpness. The technical advantage of this method is that it can better maintain the original color information and achieve natural balanced detail enhancement with strong adaptability and stability. The results of the specific evaluation indicators are shown in Table 2. Table 2. Evaluation indicator results ID PSNR UIQM UCIQE 1 8.0892 0.0336 28.2507 4 9.872786 2 14.3858 0.1165 24.5331 4 9.574799 3 11.4169 0.0586 24.7549 5 9.832558 6. Conclusion In this study, an underwater image processing method based on the gray world algorithm and a simplified Jaffe- McGlamery model is proposed. By analyzing the images from multiple perspectives, the underwater images are classified into three categories, and corresponding enhancement strategies are developed for each degradation type. Specifically, an improved grey-scale world algorithm is used to remove color bias, the Constrained Contrast Adaptive Histogram Equalization (CLAHE) technique is used to improve the images under low-light conditions, and the depth estimation and parameter adaptation modules optimize the dark channel prior algorithm to remove blur. The results show that the proposed method performs significantly in improving the visual quality and various evaluation metrics of underwater images, especially in complex underwater environments, and the combination of multiple models can be applied to cope with image degradation more effectively. In summary, this study provides a systematic enhancement framework for underwater image processing, emphasizes the importance of customizing the processing strategy according to the type of image degradation, and promotes the development of underwater image technology. References [1] An Zhinan, Wei Yun. A low-light image enhancement algorithm combining gray world and Retinex [J]. Small Microcomputer Systems,2024,45(02): 477-482. DOI: 10. 20009/ j. cnki.21-1106/ TP. 2022-0455. [2] Ma Shilong. Research on image enhancement and image stitching technology based on underwater imaging model [D]. Harbin Engineering University, 2023. DOI: 10. 27060/ d. cnki. ghbcu. 2023.002346. [3] Zhang Tianchi, Liu Yuxuan. Research progress on deep learning-driven underwater image processing[J]. Computer Science,2024,51(S1):283-294. [4] LI Zhijiang, Hu Zunlan. Color bias detection algorithm based on color feature analysis[J]. Computer System Applications, 2017, 26(09): 116-121.DOI: 10.15888/ j.cnki. csa.005947. [5] Zhang Jiupeng, Zhang Wei. Inversion-based improved algorithm for de-fogging of restricted contrast adaptive histogram equalized images[J]. Internet of Things Technology, 2015, 5(02):10-12+16.DOI: 10.16667/j.issn.2095-1302.2015. 02. 030. [6] Zhao, Ling Na. An improved dark channel a priori low-light image enhancement algorithm [J]. Journal of Jiamusi University (Natural Science Edition),2024,42(08):42-44+41.