An underwater image enhancement method for complex environments
By combining an improved white balance algorithm with adaptive gamma transform technology and logarithmic domain gamma transform technology, the color and contrast problems of underwater images in complex environments are solved. The U-Net network is used to improve image quality and adapt to different underwater environments.
Patent Information
- Application Number
- CN202510695225.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-05-28
AI Technical Summary
Existing underwater image enhancement technologies have poor generalization capabilities, high computational complexity, and insufficient adaptability to lighting changes in complex environments, making it difficult to ensure image quality.
An improved white balance algorithm is used to correct color cast, and adaptive log-domain gamma transform and contrast-limited histogram equalization techniques are combined to perform feature extraction and deblurring through a U-Net network to enhance underwater images.
It effectively improves the color shift problem of underwater images, enhances brightness uniformity and contrast, removes noise, retains image details, and adapts to different underwater environments.
Smart Images

Figure CN120219263B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of ship digitization, and in particular relates to an underwater image enhancement method for complex environments. Background Art
[0002] With the rapid development of underwater detection technology, underwater image processing plays a vital role in the fields of marine science, environmental monitoring, underwater target detection and identification, military reconnaissance and marine resource development. However, due to the complexity of the underwater environment, image quality is difficult to guarantee, mainly manifested in the following aspects: (1) Due to the absorption and scattering characteristics of water to light, red light is absorbed relatively more, making underwater images appear blue-green, resulting in color distortion and color shift; (2) The underwater environment has uneven lighting, some areas appear dim due to light attenuation, and some areas appear overexposed due to local reflection, resulting in low image contrast and loss of details; (3) Suspended particles in the water can cause light scattering, resulting in blur and noise, further reducing the clarity of the image; (4) Under low light conditions, underwater imaging equipment is prone to noise, affecting image quality.
[0003] Underwater image enhancement technology has developed into three main research directions: physical model-based methods, image processing-based methods, and deep learning-based methods. Physical model-based methods rely on physical models of underwater light transmission to simulate light attenuation, scattering, and color to correct image quality. Image processing-based methods do not rely on physical models but directly improve visual quality through color correction, contrast enhancement, and filtering. Deep learning-based methods enhance underwater images through trained networks. Du Feiyu, based on the U-Net framework, combined a multi-head attention mechanism with adversarial learning to optimize feature extraction and output, improving results. These methods have improved underwater image quality to a certain extent, but still have some shortcomings, such as poor generalization in complex environments, high computational complexity, and insufficient adaptability to lighting changes. Summary of the Invention
[0004] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide an underwater image enhancement method for complex environments. The present invention uses an improved white balance algorithm to improve the color cast problem caused by optical characteristics, providing a correct color basis for subsequent processing, and then uses logarithmic domain gamma transformation to adjust the pixel distribution, reduce the importance of bright details, further enhance the dark areas, and make the overall brightness distribution more uniform.
[0005] In order to achieve the above invention purpose, the technical solution provided by the present invention is as follows:
[0006] A method for underwater image enhancement in complex environments, the method specifically comprising the following steps:
[0007] S1, obtains the underwater original image, identifies the color cast of the original image through the improved white balance algorithm, and compensates the color cast of the original image;
[0008] S2, divides the original image into multiple blocks, calculates the local histogram for each block, extracts statistical features, determines the adaptive gamma value of each block, and determines the brightness value of each block through adaptive log-domain gamma transformation;
[0009] S3 enhances the original image using contrast-limited adaptive histogram equalization. The original image is first divided into multiple small blocks, and the grayscale histogram is calculated for each small block. The grayscale histogram is trimmed according to the set clipping threshold. Histogram equalization is performed on the trimmed grayscale histogram, and then all the processed small blocks are spliced into the output image.
[0010] S4, performing weighted averaging based on the pixel values of the output image, and eliminating noise interference of the output image through bilateral filtering technology;
[0011] S5, extracts the features of the output image through the U-Net network, deblurs the output image to generate a clear image, and finally outputs the enhanced underwater image.
[0012] Furthermore, the improved white balance algorithm identifies the color cast of the original image and compensates for the color cast of the original image by obtaining the red, green, and blue channels of the original image and the average values of the red, green, and blue channels, and supplementing the red and blue channels with the green channel to obtain compensated red and blue channels;
[0013]
[0014] in, 、 are the red channel and blue channel after compensation; 、 and are the red, green, and blue channels of the original image; 、 and represents the average value of each channel, Indicates the compensation scale and takes the value of 1.
[0015] Furthermore, the statistical features include the mean, variance and maximum value of the local histogram of the image, and the brightness value of each area block determined by the adaptive logarithmic domain gamma transform is specifically:
[0016]
[0017] in, For the original image at position The brightness value at For the original image at position The brightness value at , c is a constant used to normalize the result of logarithmic transformation, is the adaptive gamma value, calculated based on local contrast, is the base gamma value, is the adjustment coefficient, is the variance of the local area, The mean of a local area.
[0018] Furthermore, the grayscale histogram of each small block is calculated as follows:
[0019] in, For small pieces Medium gray value The number of occurrences of is the grayscale value, is the indicator function, when When , the value is 1, otherwise it is 0. Indicates small pieces Middle position The gray value of Grayscale, value is 0-255.
[0020] Furthermore, the setting of the clipping threshold to trim the grayscale histogram is specifically as follows:
[0021]
[0022] When the gray level count of a small block exceeds the clipping threshold, it is clipped. is the trimmed histogram value, CL is the clipping threshold, Indicates small pieces The total number of pixels;
[0023] The total number of pixels to be pruned from the small block is calculated as follows:
[0024] ,
[0025] in, is the total number of pruned pixels;
[0026] Redistribute the cropped parts according to the calculated total number of cropped pixels, and evenly distribute the cropped parts to all gray levels: .
[0027] Furthermore, the histogram equalization of the pruned grayscale histogram is specifically performed as follows: calculating the cumulative distribution function, for each small block, calculating the cumulative distribution function of the pruned histogram, and finally normalizing the cumulative function:
[0028]
[0029] in, For small pieces Medium gray The cumulative frequency of is the cumulative function after final normalization.
[0030] Furthermore, the processed small blocks are stitched together to form an output image by smoothing the overlapping areas of the stitched images using bilinear interpolation, interpolating between four given known pixel points, and calculating the value of the target point based on the relative distance of the input point to these known points:
[0031]
[0032] in, is the interpolation result of the target point, are the values of four known points, Target point In the horizontal direction, the relative position Target point In the vertical direction, the relative position , , and are the position coordinates of the four known points.
[0033] Furthermore, the bilateral filtering technology eliminates noise interference of the output image specifically by: eliminating the noise interference of the image through a bilateral filter according to the spatial information and pixel intensity information of the original image;
[0034]
[0035] in, is a spatial Gaussian function, and the weight is calculated based on the spatial distance. is an intensity Gaussian function, and the weights are calculated based on the similarity of pixel values. Represents a normalization factor to ensure that the weights sum to 1.
[0036] Furthermore, the U-Net network includes two paths: an encoder and a decoder. The encoder and the decoder are connected via a jump connection. The encoder extracts high-level features of the image and reduces the resolution, and obtains abstract features layer by layer through convolutional layers, ReLU activation functions and maximum pooling layers. The jump connection passes the feature map of the encoder directly to the decoder, combining high-level semantic features with low-level spatial features to generate an accurate restored image.
[0037] Based on the above technical solution, the present invention's patented underwater image enhancement method for complex environments has achieved the following technical advantages through practical application:
[0038] 1. This method, designed for underwater image enhancement in complex environments, utilizes an improved white balance algorithm to mitigate color casts caused by optical properties, providing a correct color foundation for subsequent processing. It then uses log-domain gamma transform to adjust pixel distribution, reducing the importance of bright details and further enhancing dark areas, resulting in a more uniform overall brightness distribution.
[0039] 2. The present invention provides an underwater image enhancement method for complex environments. This method divides the image into multiple small blocks through contrast-limited adaptive histogram equalization, which is then enhanced separately. This method can balance the overall performance of the underwater image in terms of brightness and contrast, while avoiding excessive stretching of dark or bright areas in the underwater image, preventing oversaturation or unnatural visual effects, and avoiding noise amplification.
[0040] 3. The present invention provides an underwater image enhancement method for complex environments. By using bilateral filtering, the method does not require prior knowledge of edge positions, effectively removes noise while retaining edge details, and then deblurs the underwater image based on the U-Net network architecture. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 This is a flow chart of underwater image enhancement in an underwater image enhancement method for complex environments according to the present invention.
[0042] Figure 2 It is an original underwater image and three-color histogram of a shallow water area in an underwater image enhancement method for complex environments of the present invention.
[0043] Figure 3 It is an underwater image and a three-color histogram after red and blue channel compensation in a shallow water area in an underwater image enhancement method for complex environments of the present invention.
[0044] Figure 4 It is an original underwater image and three-color histogram of a deep water area in an underwater image enhancement method for complex environments of the present invention.
[0045] Figure 5 The present invention discloses an underwater image and a three-color histogram after red channel compensation in a deep water area in an underwater image enhancement method for complex environments.
[0046] Figure 6 It is the original underwater image in the underwater image enhancement method for complex environments of the present invention.
[0047] Figure 7 It is an underwater image obtained by gamma transforming the original underwater image in the underwater image enhancement method for complex environments according to the present invention.
[0048] Figure 8The underwater image is obtained by histogram equalization of the original underwater image in the underwater image enhancement method for complex environments of the present invention.
[0049] Figure 9 It is an underwater image obtained by bilateral filtering of an original underwater image in an underwater image enhancement method for complex environments according to the present invention.
[0050] Figure 10 It is an underwater image obtained by deblurring the original underwater image through U-Net in the underwater image enhancement method for complex environments of the present invention.
[0051] Figure 11 This is a schematic diagram of a linear interpolation method in an underwater image enhancement method for complex environments according to the present invention.
[0052] Figure 12 This is a U-Net structure diagram of an underwater image enhancement method for complex environments in the present invention.
[0053] Figure 13 This is a comparison chart of experimental results of various algorithms in the underwater image enhancement method for complex environments of the present invention; Figure 13 (a) in the figure is the original underwater image. Figure 13 (b) is the underwater image after DCP processing. Figure 13 (c) in the figure is the underwater image after Retinex processing. Figure 13 (d) in the figure is the underwater image processed by UWCNN. Figure 13 (e) in the figure is the underwater image processed by FUnIE-GAN. Figure 13 (f) in the figure is the underwater image processed by the present invention.
[0054] Figure 14 This is a comparison chart of the ablation experiment results of each module in the underwater image enhancement method for complex environments of the present invention; wherein, Figure 14 (a) in the figure is the original underwater image. Figure 14 (b) is the underwater image after white balance processing. Figure 14 (c) in the figure is the underwater image after gamma processing. Figure 14 (d) is the underwater image processed by Clahe. Figure 14 (e) in the figure is the underwater image after bilateral filtering. Figure 14 (f) in the figure is the underwater image after deblurring by U-Net. DETAILED DESCRIPTION
[0055] To make the objectives, technical solutions, and advantages of the present invention more clearly apparent, the present invention is described below using specific examples shown in the accompanying drawings. However, it should be understood that these descriptions are merely illustrative and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present invention.
[0056] Example 1
[0057] like Figure 1-14 As shown, the underwater image enhancement method of this example includes the following steps:
[0058] S1, obtains the underwater original image, identifies the color cast of the original image through the improved white balance algorithm, and compensates the color cast of the original image;
[0059] S2, divides the original image into multiple blocks, calculates the local histogram for each block, extracts statistical features, determines the adaptive gamma value of each block, and determines the brightness value of each block through adaptive log-domain gamma transformation;
[0060] S3 enhances the original image using contrast-limited adaptive histogram equalization. The original image is first divided into multiple small blocks, and the grayscale histogram is calculated for each small block. The grayscale histogram is trimmed according to the set clipping threshold. Histogram equalization is performed on the trimmed grayscale histogram, and then all the processed small blocks are spliced into the output image.
[0061] S4, performing weighted averaging based on the pixel values of the output image, and eliminating noise interference of the output image through bilateral filtering technology;
[0062] S5, extracts the features of the output image through the U-Net network, deblurs the output image to generate a clear image, and finally outputs the enhanced underwater image.
[0063] The improved white balance algorithm identifies the color cast of the original image and compensates for the color cast of the original image by obtaining the red, green, and blue channels of the original image and the average values of the red, green, and blue channels, and supplementing the red and blue channels with the green channel to obtain compensated red and blue channels;
[0064]
[0065] in, 、 are the red channel and blue channel after compensation; 、 and are the red, green, and blue channels of the original image; 、 and represents the average value of each channel, Indicates the compensation scale and takes the value of 1.
[0066] By utilizing an improved white balance algorithm to improve the color cast caused by optical characteristics, a correct color foundation is provided for subsequent processing. Logarithmic domain gamma transform is then used to adjust pixel distribution, reducing the importance of bright details and further enhancing dark areas to make the overall brightness distribution more uniform.
[0067] The statistical features include the mean, variance and maximum value of the local histogram of the image. The brightness value of each area block is determined by adaptive logarithmic domain gamma transform as follows:
[0068]
[0069] in, For the original image at position The brightness value at For the original image at position The brightness value at , c is a constant used to normalize the result of logarithmic transformation, is the adaptive gamma value, calculated based on local contrast, is the base gamma value, is the adjustment coefficient, is the variance of the local area, The mean of a local area.
[0070] Through contrast-limited adaptive histogram equalization, the image is divided into multiple small blocks and enhanced separately, which can balance the overall performance of the underwater image in terms of brightness and contrast, while avoiding excessive stretching of dark or bright areas in the underwater image, preventing oversaturation or unnatural visual effects, and avoiding noise amplification.
[0071] The grayscale histogram of each small block is calculated as follows:
[0072] in, For small pieces Medium gray value The number of occurrences of is the grayscale value, is the indicator function, when When , the value is 1, otherwise it is 0. Indicates small pieces Middle position The gray value of Grayscale, value is 0-255.
[0073] The clipping threshold set to trim the grayscale histogram is specifically:
[0074]
[0075] When the gray level count of a small block exceeds the clipping threshold, it is clipped. is the trimmed histogram value, CL is the clipping threshold, Indicates small pieces The total number of pixels;
[0076] The total number of pixels to be pruned from the small block is calculated as follows:
[0077]
[0078] in, is the total number of pruned pixels;
[0079] Redistribute the cropped parts according to the calculated total number of cropped pixels, and evenly distribute the cropped parts to all gray levels: ;
[0080] The histogram equalization of the pruned grayscale histogram is specifically as follows: calculating the cumulative distribution function, for each small block, calculating the cumulative distribution function of the pruned histogram, and finally normalizing the cumulative function:
[0081]
[0082] in, For small pieces Medium gray The cumulative frequency of is the cumulative function after final normalization.
[0083] The processed small blocks are stitched together to form the output image by smoothing the overlapping areas of the stitched images using bilinear interpolation, interpolating between four given known pixels, and calculating the value of the target point based on the relative distance of the input point to these known points:
[0084]
[0085] in, is the interpolation result of the target point, are the values of four known points, Target point In the horizontal direction, the relative position Target point In the vertical direction, the relative position , , and are the position coordinates of the four known points.
[0086] The bilateral filtering technology eliminates noise interference of the output image specifically by: eliminating the noise interference of the image through the bilateral filter according to the spatial information and pixel intensity information of the original image;
[0087]
[0088] in, is a spatial Gaussian function, and the weight is calculated based on the spatial distance. is an intensity Gaussian function, and the weights are calculated based on the similarity of pixel values. Represents a normalization factor to ensure that the weights sum to 1.
[0089] By using bilateral filtering, it is not necessary to know the edge position in advance, effectively removing noise while retaining edge details, and then deblurring the underwater image based on the U-Net network architecture.
[0090] The U-Net network includes two paths: an encoder and a decoder. The encoder and the decoder are connected via a jump connection. The encoder extracts high-level features of the image and reduces the resolution. Abstract features are obtained layer by layer through convolutional layers, ReLU activation functions, and maximum pooling layers. The jump connection passes the encoder's feature map directly to the decoder, combining high-level semantic features with low-level spatial features to generate an accurate restored image. Example 2
[0091] An underwater image enhancement method for complex environments:
[0092] Step 1: The color cast of underwater images affects people's ability to extract the true color information underwater. To correct the color cast of underwater images, the present invention proposes an improved white balance algorithm;
[0093] The improved white balance algorithm is based on four key observations and principles:
[0094] (1) The green channel is more preserved: Compared with the red and blue channels, the green channel attenuates less underwater. This is because long-wavelength light (such as red light) disappears first in clear water, while green light attenuates more slowly. Therefore, the green channel can retain more color information in underwater images.
[0095] (2) Compensation method for red light attenuation: The green channel contains color information relative to the red channel, so compensating for red light attenuation is particularly important. By introducing part of the green channel information into the red channel, the loss of red light can be effectively compensated. Tests have shown that using only the green channel information to compensate for red light can better restore the overall color spectrum while maintaining the natural appearance of the background (water area). Although initial attempts were made to introduce both the green and blue channels into the red channel, it was ultimately found that using only the green channel worked best.
[0096] (3) Determination of the compensation ratio: The intensity of compensation should be determined based on the difference between the average green value and the average red value. Based on the gray world assumption (i.e., the average values of each channel are equal in the absence of attenuation), this difference reflects the imbalance between red and green attenuation. By using this ratio compensation, distorted color information can be restored more accurately.
[0097] (4) Red Channel Enhancement Strategy To avoid oversaturation of the red channel due to compensation for red light loss, the red channel enhancement should mainly act on pixels with smaller red channel values. In other words, the green channel information will only be transferred to areas with lower red channel values, without changing those pixels that already have significant red components. This ensures the rationality of the overall image color balance.
[0098] To sum up, the mathematical expression formula of its compensation is as follows:
[0099]
[0100] in, 、 Indicates the red and blue channels after compensation; 、 and Represents the red, green, and blue channels of the original image; 、 and represents the average value of each channel, Indicates the compensation scale and takes the value of 1.
[0101] In poor water quality, both the red and blue channels need to be compensated, and the algorithm introduces a threshold, K. When the ratio of the green to blue channel is greater than K, both red and blue channels are compensated; otherwise, only the red channel is compensated. The K value is typically selected between 1.1 and 1.5. A K value greater than 1.1 indicates less attenuation in the green channel, requiring appropriate compensation for the red and blue channels. When K is ≤ 1.1, the green and blue channels are similar, and generally only red compensation is required. In deep water or highly turbid areas, a higher K value, between 1.5 and 2.0, may be required, as the green channel still dominates in deeper waters. Specific scenario factors: In clear shallow water, a K value close to 1.1 is recommended. In turbid deep water, a K value of 1.5 or above is recommended, as the blue channel is more scattering, leading to a dominant green channel. This mechanism allows for flexible adaptation to varying water quality conditions and improves the robustness of the algorithm.
[0102] Figure 2 The original underwater image of the shallow water area in the image shows the water body with mainly light blue and green, which has high light transmittance. The image color is mainly affected by suspended matter or refraction. Figure 2 The histogram in shows that the green channel increases significantly in the high pixel value range, indicating that the water is rich in green components and less in red components; Figure 3 As shown, the processed image makes the yellow and orange colors of the jellyfish more obvious, improves the saturation of the background color, enhances the visual effect, shows that the frequency of the blue channel is uniform, and the red channel is improved in the high pixel value range, which enhances the color performance of the jellyfish.
[0103] Figure 4 The original underwater image of the deep water area is mainly blue, reflecting the deep sea environment. Figure 4 The histogram in the figure shows that the blue channel increases significantly in the high pixel value range, and the blue light component is rich. The green channel has a high frequency in the medium and low intensity range, indicating the presence of plants in the water or the refraction of light. The red channel is low in low intensity and has a small red component. Figure 5 As shown, the processed image is colorful and highlights the image details. It shows that the red channel has a low frequency at low intensity, but has increased at high intensity, indicating that more red light components are introduced.
[0104] Through the above improvements, the improved white balance algorithm can not only restore accurate colors when processing underwater images, but also maintain the natural feeling of the background, achieving a more realistic visual effect.
[0105] Step 2: Underwater lighting is often uneven, resulting in brightness differences, and white balance processing often overbrightens the image. Gamma transform is widely used due to its simplicity and effectiveness, but traditional methods that manually set parameters cannot cope with local lighting differences and produce unsatisfactory results.
[0106] Log-domain gamma transform is an image enhancement technique that combines the advantages of logarithmic and gamma transforms. It is primarily used to improve the dynamic range and contrast of an image, and is particularly effective in processing dark details. Log-domain gamma transform can be considered a nonlinear transformation that enhances image brightness and contrast based on logarithmic and gamma functions. Its core concept is to use logarithmic operations to process brightness information and then apply gamma transform to the result.
[0107] The general formula for the log-domain gamma transform is:
[0108]
[0109] in, represents the brightness value of the input image, Indicates the brightness value of the output image. c is a constant used to amplify or reduce the output brightness (usually greater than zero). is the gamma value, which controls the degree of nonlinear transformation.
[0110] Adaptive gamma transform is an image processing technology that dynamically adjusts the gamma value based on local features. Unlike traditional global gamma transform, it can achieve more precise brightness and contrast adjustment. Its core idea is to apply different gamma values to different areas.
[0111] Log-domain gamma conversion and adaptive gamma conversion can be combined to simultaneously utilize the detail enhancement capabilities of logarithmic conversion and the flexibility of adaptive gamma adjustment. This combination can apply different gamma values to different image areas, thereby more effectively improving brightness and contrast.
[0112] The transformation steps are as follows:
[0113] First, the input image is divided into multiple small blocks, and then the local histogram is calculated for each small block to extract statistical features (such as mean, variance, maximum value, etc.), which will be used to determine the adaptive gamma value required for the block. Then, the gamma value of each small block is determined based on the local brightness histogram and characteristics. A smaller gamma value is set in the darker area, while a larger gamma value is selected in the brighter area. Finally, the logarithmic domain gamma transform is applied to each small block using the combined transformation formula:
[0114] Assume that the brightness value of the input image is , the formula combining logarithmic transformation and adaptive gamma transformation can be expressed as:
[0115]
[0116] in, Indicates that the input image is at position The brightness value at Indicates that the output image is at position , c is a constant used to normalize the result of the logarithmic transformation (usually equal to 255), is the adaptive gamma value, calculated based on local contrast, is the base gamma value, is the adjustment coefficient, is the variance of the local area, The mean of a local area.
[0117] like Figure 6 As shown in Figure 7, the original image is bluish-green and lacks bright color contrast, which may be due to the absorption and scattering effects of water. The image after gamma transformation is shown in Figure 7, which enhances the contrast of the image, makes the colors richer, and the details more obvious.
[0118] Step 3: Underwater environments often have poor lighting conditions, especially in deep or turbid waters, resulting in low image contrast and difficulty discerning details. Li Chengcheng et al. implemented histogram equalization using an FPGA, optimizing the algorithm and achieving the goal of improving image contrast and detail.
[0119] This paper uses contrast-limited adaptive histogram equalization (CLAHE) to enhance underwater images. This improved adaptive histogram equalization (AHE) avoids noise amplification by limiting contrast. The calculation process of the algorithm of the present invention is as follows:
[0120] (1) The input image is divided into multiple small blocks (regions), which are usually overlapping. The size of each block can be set according to the specific application, such as 8x8, 16x16, etc.
[0121] (2) For each divided block, calculate its grayscale histogram and count the frequency of each grayscale level.
[0122]
[0123] in, Indicates small pieces Medium gray value The number of occurrences of is the indicator function, when When , the value is 1, otherwise it is 0. Indicates small pieces Middle position The gray value of Grayscale, value is 0-255.
[0124] (3) Contrast limit: To avoid noise caused by excessive contrast, a clipping threshold (clip limit) needs to be set. , Indicates small pieces The total number of pixels.
[0125]
[0126] Clipping histogram: If the count of a certain gray level exceeds the clipping threshold, it is clipped, is the pruned histogram value.
[0127]
[0128] Calculate the trimmed portion: the total number of trimmed pixels
[0129]
[0130] Redistribute the clipped parts: Distribute the clipped parts evenly to all gray levels:
[0131]
[0132] (4) Use the pruned histogram to perform histogram equalization.
[0133] Compute the cumulative distribution function (CDF): For each small block, calculate the cumulative distribution function of the pruned histogram: For small pieces Medium gray The cumulative frequency of , and the final normalized CDF is .
[0134]
[0135] (5) All processed small blocks are stitched together into the final output image, and the overlapping areas are smoothed using bilinear interpolation to avoid obvious edges at the stitching, such as Figure 11 shown.
[0136] The basic idea of bilinear interpolation is to interpolate between four given known points (pixels) and calculate the value of the target point based on the relative distance of the input point to these known points.
[0137]
[0138] in, is the interpolation result of the target point, are the values of four known points, Target point The relative position in the horizontal direction (0 to 1), Target point The relative position in the vertical direction (0 to 1), , , , are the position coordinates of the four known points.
[0139] Step 4: Underwater images are often subject to noise caused by suspended particles. Using bilateral filtering, we combine spatial information with pixel intensity information to smooth the image while preserving edges. The core idea is to perform a weighted average of pixel values, with the weights determined by spatial distance and pixel value similarity, ensuring that closer and more similar pixels have a greater influence on the current pixel.
[0140] Bilateral filter output Defined as:
[0141]
[0142] in, Represents a spatial Gaussian function, which calculates weights based on spatial distance. represents the intensity Gaussian function, and the weights are calculated based on the similarity of pixel values. Represents a normalization factor to ensure that the weights sum to 1.
[0143] like Figure 6 As shown in the figure, the original image details are slightly blurred, and the particles in the water and the influence of light make the whole scene look a little hazy. Figure 9 As shown, the noise and color of the image are significantly reduced, and the overall picture is clearer, but some details may be lost.
[0144] Step 5: Water has a higher refractive index than air. Light will refract when it enters the water, causing the object's position to deviate from its true position and causing inaccurate focus. At the same time, water absorbs and scatters light, blurring the image, especially in areas far from the light source.
[0145] This paper uses the U-Net network, known for its excellent feature extraction capabilities, as the foundational network for underwater image enhancement. This network fully extracts underwater image features, effectively enhancing underwater images in various scenarios. U-Net is a classic convolutional neural network architecture, originally proposed by Olaf Ronneberger et al. in 2015 for biomedical image segmentation. Due to its efficient feature extraction capabilities and skip connection design, it is widely used in various image processing tasks, including image deblurring, segmentation, and denoising.
[0146] The core structure of U-Net is as follows Figure 12 As shown, the U-shaped network consists of two symmetrical paths: the encoder (downsampling portion) and the decoder (upsampling portion). The encoder extracts high-level image features and reduces resolution, acquiring abstract features layer by layer through convolutional layers, ReLU activation functions, and max pooling layers, but this loses spatial information. The decoder is responsible for restoring image resolution and generating output. Each layer includes upsampling and convolution operations to incorporate contextual features. Skip connections pass the encoder's feature maps directly to the decoder, combining high-level semantic features with low-level spatial features to produce a more accurate restored image. They effectively preserve the spatial details lost during downsampling, addressing the problem of vanishing gradients or feature loss in deep networks.
[0147] This paper uses the Underwater Image Enhancement Benchmark (UIEB) dataset, which consists of two subsets: 890 original underwater images and their corresponding high-quality reference images; and 60 challenging underwater images. These images are divided into multiple scenes and provided along with corresponding reference images for evaluating and comparing underwater image enhancement algorithms. 70% of the dataset is used for training, and 30% for validation.
[0148] As shown in Figure 6, the details in this image are blurred due to scattering from the water and insufficient lighting. The deblurred image is shown in Figure 10. After U-Net deblurring, the image's clarity is significantly improved. The color and structure of the bottom grid also become more distinct, enhancing overall visibility.
[0149] Step 6: To verify the effectiveness of the proposed method, the unreferenced underwater color image quality measure (UIQM) was used as the evaluation standard. UIQM (underwater image quality measures) generates a comprehensive quality measurement by linearly superimposing three independent metrics: chroma, saturation, and contrast. Higher UIQM values indicate better image quality and a higher degree of consistency with human vision.
[0150]
[0151] in, Measures the color saturation of an image. It usually reflects the structural information of the image, mainly looking at the texture and edge features of the image. Combines the sharpness and contrast of the image; generally, higher values mean the image is clearer and has more contrast. are weight coefficients, which are 0.0282, 0.2953, and 3.5753 respectively;
[0152] UCIQE (underwater color image quality evaluation metric) is a comprehensive evaluation indicator that reflects the overall quality of an image. It is obtained through a linear combination of hue, saturation, and brightness contrast. Generally speaking, a higher UCIQE value means better image quality.
[0153]
[0154] in, is the chromaticity deviation, is the brightness contrast, is the average saturation, are weight coefficients, which are 0.4680, 0.2745, and 0.2576 respectively.
[0155] In addition, the full-reference evaluation metrics peak signal-to-noise ratio and structural similarity index were selected for objective evaluation.
[0156] Peak signal-to-noise ratio (PSNR) is an objective measure of the difference between a compressed image and the original image. The greater the difference, the worse the compressed image quality. For full-reference evaluation, PSNR is defined by the maximum pixel value (MAX) and the mean square error (MSE). The higher the PSNR, the smaller the distortion after compression. The calculation formula is:
[0157]
[0158] in, 、 Respectively represent the size The reference image and distorted image, Indicates the maximum value of the pixel of the image. If each pixel is represented by an 8-bit binary number, The value is 255. If it is a color image, you need to calculate the RGB three channels , and then divide by 3.
[0159] The structural similarity index (SSIM) takes into account the sensitivity of the human visual system to structural information by integrating brightness similarity, contrast similarity, and structural similarity. Let x represent the reference image and y represent the distorted image to be tested. The calculation formula is:
[0160]
[0161] in, is the mean value of x, is the mean value of y, is the standard deviation of x, is the standard deviation of y, is the covariance of x and y, is a constant to avoid the denominator being zero.
[0162] Table 1 shows the comparative experimental results of each model on the dataset; Figure 13 As shown in the table, our method performs well across multiple image quality assessment metrics. Its UIQM score is 2.2758 (complex), the highest among all methods. Its UCIQE scores are 0.6656 (original) and 0.6534 (complex), also leading the pack. Its PSNR reaches 33.0493 under complex conditions, demonstrating a good signal-to-noise ratio. Its SSIM score is 0.9513, demonstrating its superiority in structural similarity. Compared with other methods, particularly those using dark channel priors, real-time underwater image enhancement models based on conditional generative adversarial networks, and deep underwater image and video enhancement inspired by underwater scene priors, our method demonstrates superior image quality across all scenarios, making it suitable for image processing challenges in practical applications. These results underscore its effectiveness and reliability.
[0163] Table 1 Comparative experimental results of various models on the UIEB dataset
[0164]
[0165] In the table, UIQM is the unreferenced underwater color image quality evaluation index, UCIQE is the comprehensive underwater color image quality evaluation index, PSNR is the peak signal-to-noise ratio, and SSIM is the structural similarity index.
[0166] Step 7: To verify the effectiveness of the fusion of each module, an ablation experiment is conducted. The ablation experiment is conducted on the dataset of the same experimental environment as above and the results are reported in Table 2. Some images are shown in Table 2. Figure 14 shown.
[0167] Table 2 shows the results of sequentially stacking the various image processing modules, demonstrating the comprehensive performance of different methods in improving image quality. The UIQM, UCIQE, PSNR, and SSIM scores vary across the different processing steps, indicating that the combination of these methods significantly impacts the final image quality. For example, white balance achieved excellent results in terms of UIQM and SSIM (2.0882 and 0.9913, respectively), while log-domain gamma transform also performed well in terms of PSNR (18.6406). This demonstrates that sequentially stacking the modules can improve the overall visual quality of the image, with different modules contributing different amounts to different metrics.
[0168] Table 2 Ablation experiment results of each module
[0169]
[0170] Note: The above is the result of sequentially superimposing each module, not the result of a single module. In the table, UIQM is the unreferenced underwater color image quality evaluation index, UCIQE is the comprehensive underwater color image quality evaluation index, PSNR is the peak signal-to-noise ratio, and SSIM is the structural similarity index.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to preferred embodiments, ordinary technicians in the field should understand that the specific implementation methods of the invention can still be modified or some technical features can be replaced by equivalents without departing from the spirit of the technical solutions of the present invention. They should all be included in the scope of the technical solutions for which protection is sought in the present invention.
Claims
1. A method for underwater image enhancement in complex environments, characterized in that: The method specifically comprises the following steps: S1, obtains the underwater original image, identifies the color cast of the original image through the improved white balance algorithm, and compensates the color cast of the original image; S2, divides the original image processed in S1 into multiple area blocks, calculates the local histogram of each area block, extracts statistical features, determines the adaptive gamma value of each area block, and determines the brightness value of each area block through adaptive log-domain gamma transformation; The statistical features include the mean, variance and maximum value of the local histogram of the image. The brightness value of each area block is determined by adaptive log-domain gamma transform as follows: , , in, For the input image at position The brightness value at For output image at position The brightness value at is a constant used to normalize the result of logarithmic transformation, is the adaptive gamma value, calculated based on local contrast, is the base gamma value, is the adjustment coefficient, is the variance of the local area, The mean of a local area; S3 enhances the original image processed in S2 by contrast-limited adaptive histogram equalization. The original image processed in S2 is first divided into multiple small blocks, and the grayscale histogram is calculated for each small block. The grayscale histogram is trimmed according to the set clipping threshold. Histogram equalization is performed on the trimmed grayscale histogram, and then all the processed small blocks are spliced into the output image. S4, performing weighted averaging based on the pixel values of the output image, and eliminating noise interference of the output image through bilateral filtering technology; S5, extracts the features of the output image through the U-Net network, deblurs the output image to generate a clear image, and finally outputs the enhanced underwater image.
2. The underwater image enhancement method for complex environments according to claim 1, characterized in that: The improved white balance algorithm identifies the color cast of the original image and compensates for the color cast of the original image by obtaining the red, green, and blue channels of the original image and the average values of the red, green, and blue channels, and supplementing the red and blue channels with the green channel to obtain compensated red and blue channels; , , in, 、 are the red channel and blue channel after compensation; 、 and are the red, green, and blue channels of the original image; 、 and represents the average value of each channel, Indicates the compensation scale and takes the value of 1.
3. The underwater image enhancement method for complex environments according to claim 1, characterized in that: The grayscale histogram of each small block is calculated as follows: , in, For small pieces Medium gray value The number of occurrences of is the grayscale value, is the indicator function, when When , the value is 1, otherwise it is 0. Indicates small pieces Middle position The gray value of Grayscale, value is 0-255.
4. The underwater image enhancement method for complex environments according to claim 3, characterized in that: The clipping threshold set to trim the grayscale histogram is specifically: , , When the gray level count of a small block exceeds the clipping threshold, it is clipped. is the trimmed histogram value, CL is the clipping threshold, Indicates small pieces The total number of pixels; The total number of pixels to be pruned from the small block is calculated as follows: , in, is the total number of pruned pixels; Redistribute the cropped parts according to the calculated total number of cropped pixels, and evenly distribute the cropped parts to all gray levels: .
5. The underwater image enhancement method for complex environments according to claim 4, characterized in that: The histogram equalization of the pruned grayscale histogram is specifically as follows: calculating the cumulative distribution function, for each small block, calculating the cumulative distribution function of the pruned histogram, and finally normalizing the cumulative function: , , in, For small pieces Medium gray The cumulative frequency of is the cumulative function after final normalization.
6. The underwater image enhancement method for complex environments according to claim 5, characterized in that: The processed small blocks are stitched together to form the output image by smoothing the overlapping areas of the stitched images using bilinear interpolation, interpolating between four given known pixels, and calculating the value of the target point based on the relative distance of the input point to these known points: , , in, is the interpolation result of the target point, are the values of four known points, Target point In the horizontal direction, the relative position Target point In the vertical direction, the relative position 、 、 and are the position coordinates of the four known points.
7. The underwater image enhancement method for complex environments according to claim 1, characterized in that: The bilateral filtering technology eliminates noise interference of the output image specifically by: eliminating the noise interference of the image through the bilateral filter according to the spatial information and pixel intensity information of the original image; , in, is a spatial Gaussian function, and the weight is calculated based on the spatial distance. is an intensity Gaussian function, and the weights are calculated based on the similarity of pixel values. Represents a normalization factor to ensure that the weights sum to 1.
8. The underwater image enhancement method for complex environments according to claim 1, characterized in that: The U-Net network includes two paths: an encoder and a decoder. The encoder and the decoder are connected via a jump connection. The encoder extracts high-level features of the image and reduces the resolution. Abstract features are obtained layer by layer through convolutional layers, ReLU activation functions, and maximum pooling layers. The jump connection passes the encoder's feature map directly to the decoder, combining high-level semantic features with low-level spatial features to generate an accurate restored image.