Method for recovering color of turbid water body

By obtaining the turbidity factor and color imbalance index, an iterative strategy is adopted to dynamically stretch and gain compensate the red, green, and blue channels of the underwater image, which solves the color cast problem of images in turbid water bodies and achieves higher quality underwater image restoration effects.

CN120634871APending Publication Date: 2025-09-12NANTONG MARINE ADVANCED RESEARCH INSTITUTE SOUTHEAST UNIVERSITY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510798464.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing technologies have difficulty effectively solving the problem of image color cast in turbid water environments. Traditional methods have limited effectiveness in high turbidity or water quality changes, resulting in poor visual readability of underwater images.

Method used

The turbidity factor is obtained through a turbidity meter or image visual estimation, the color imbalance index is calculated, and an iterative strategy is used to stretch the dynamic range and adjust the gain compensation of the red, green and blue channels to gradually approach color balance.

Benefits of technology

It achieves more accurate restoration of the intrinsic colors of underwater scenes under different water quality environments, and the output image colors are more balanced and natural, improving the visual information quality of underwater monitoring and target recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120634871A_ABST
    Figure CN120634871A_ABST
Patent Text Reader

Abstract

The invention discloses a method for recovering the color of a turbid water body, which comprises the following steps of: acquiring a water body turbidity factor through a turbidimeter or a visual estimation means based on image analysis, and calculating the average brightness and color cast degree of a color channel for an input turbid underwater image to obtain a color imbalance index. And in combination with the turbidity factor and the color imbalance index, dynamic stretching and gain compensation adjustment are performed on each color channel by adopting an iteration mode. In each round, the correction step length is determined according to the turbidity factor, the stretching proportion and the gain coefficient are adaptively set, the strength difference between channels is gradually eliminated, and effective color correction in the high-turbidity environment is achieved. And after multiple iterations, finishing convergence output when the color unbalance degree is reduced to be within a threshold value. The model can also select color spaces such as HSV or Lab to further finely adjust the saturation and the brightness, so that the visual effect of the image is better. The color recovery strength can be adaptively controlled under different turbidity conditions, and the problems of color cast and distortion of underwater images are remarkably solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for restoring the color of a turbid water body, and belongs to the technical field of underwater image processing. Background Art

[0002] With the growing demand for ocean exploration and river monitoring, the quality of underwater images is crucial for research and application. Clear underwater images are essential for observing the behavior of marine life, identifying species characteristics, and observing seafloor topography. Poor image quality can lead to misclassification of organisms or misjudgment of geological structures. However, in turbid water environments, due to the absorption and scattering of light by the water and suspended particles, different wavelengths of light attenuate at different rates, resulting in severe color casts or even color loss in the images.

[0003] We use traditional color correction methods to process images, such as direct white balancing or histogram equalization. White balancing is achieved by adjusting the white reference point in the image to eliminate the color cast caused by differences in light source color temperature, restore the true color representation of neutral colors, and ensure RGB numerical balance. Histogram balancing, on the other hand, expands the pixel grayscale distribution range and remaps the pixel values ​​concentrated in a narrow interval to the full dynamic range to enhance contrast. However, these two methods often cannot fully solve the color cast problem caused by the attenuation differences of different wavelengths in turbid waters, and may even cause new distortion. In addition, physical model methods are easily affected by the complex water environment when estimating multiple parameters (such as scattering coefficient, background light, etc.), making it difficult to obtain accurate results.

[0004] To address these deficiencies, traditional underwater image color correction methods, including grayscale world white balance assumptions, histogram equalization, and algorithms based on prior models, can correct underwater image color shifts to a certain extent. However, in highly turbid waters or when water turbidity changes, correction algorithms with fixed parameters have limited effectiveness. For example, in highly turbid waters, dark channel prior (DCP) methods may fail because the prior assumptions are no longer met, while simple white balance algorithms also struggle to restore true colors due to the complete loss of red light. More effective dynamic inter-channel balancing strategies are still needed.

[0005] Therefore, there is an urgent need for a method for restoring the color of turbid water bodies that can make the output image closer to the color distribution under natural lighting conditions, thereby improving the visual readability of turbid underwater images and solving the problems mentioned in the above background technology. Summary of the Invention

[0006] The content of this application is used to briefly introduce concepts that will be described in detail in the detailed description section below. The content of this application is not intended to identify key features or essential features of the technical solution for which protection is sought, nor is it intended to limit the scope of the technical solution for which protection is sought.

[0007] In response to the problems and shortcomings of the prior art, the present invention aims to provide a method for color restoration in turbid water. This method uses a turbidity meter or image-based visual estimation to obtain the turbidity factor of the ambient water. The color imbalance index of the image is calculated to quantify the degree of deviation in each color channel. Dynamic range stretching and gain compensation are then performed on the red, green, and blue channels of the image, using the turbidity factor and color imbalance index as control parameters. An iterative strategy is employed to gradually approach color balance, ultimately outputting a corrected image. This method more accurately restores the intrinsic colors of underwater scenes, resulting in more balanced and natural-looking images. This method provides higher-quality visual information for underwater monitoring and target recognition, addressing the issues raised in the aforementioned background art.

[0008] To achieve the above object, the present invention provides the following technical solutions:

[0009] The present invention discloses a method for restoring the color of turbid water, comprising the following steps:

[0010] Step 1, in response to acquiring a turbid original underwater image;

[0011] Step 2, obtaining a turbidity factor using a turbidity meter or by image visual feature estimation based on the original underwater image;

[0012] Step 3, calculating the average value of each color channel of the original underwater image, and calculating the color imbalance index according to the color channel average value;

[0013] Step 4, performing iterative dynamic stretching and gain compensation correction on the color channel according to the turbidity factor and the color imbalance index;

[0014] Step 5: After the iteration conditions are met, a new underwater image with color correction is output.

[0015] Preferably, the calculation of the turbidity factor in step 2 further comprises the following steps:

[0016] Step 2.1, performing scaling on the acquired original underwater image;

[0017] Step 2.2, extract the image average gradient amplitude, image brightness standard deviation and image pixel saturation average in grayscale domain and HSV color space simultaneously;

[0018] Step 2.3, calculating the turbidity score based on the image average gradient amplitude, the standard deviation of the image brightness, and the average value of the image pixel saturation;

[0019] Step 2.4: normalize the turbidity score to obtain a turbidity factor corresponding to the actual physical turbidity.

[0020] Preferably, the calculation of the color imbalance index in step 3 further includes the following steps:

[0021] Step 3.1, summing the grayscale values ​​of all pixels in each color channel of the original underwater image;

[0022] Step 3.2, dividing the sum of pixel grayscale values ​​by the total number of pixels in the original underwater image to obtain the average grayscale value of each color channel;

[0023] In step 3.3, the maximum average value is taken as the maximum average grayscale value Il, the minimum average grayscale value Is, and the middle average grayscale value Im, and the color imbalance index is calculated using them.

[0024] Preferably, in step 4, the channel corresponding to the maximum average grayscale value I1 is first regarded as the dominant color channel, and the channels corresponding to the medium average grayscale value Im and the minimum average grayscale value Is are regarded as subordinate color channels, and the following steps are further included:

[0025] Step 4.1, initialize and set the iteration count k and color imbalance threshold ε;

[0026] Step 4.2, determining the gain adjustment step Δg and the stretch ratio Δs according to the turbidity factor;

[0027] Step 4.3, stretching the dominant color channel to a predetermined output range;

[0028] Step 4.4: Dynamically compensate and superimpose the stretched image of the dominant color channel onto the subordinate color channel according to the gain proportional coefficient.

[0029] Preferably, in step 4.3, according to the grayscale distribution of the dominant color channel, the pixel intensity of the dominant color channel is stretched using a minimum-maximum linear stretch based on quantile truncation, the minimum pixel value in the dominant color channel is mapped to 0, the maximum pixel value is mapped to 255, and other pixel values ​​are proportionally mapped to the range of [0,255].

[0030] Preferably, in step 4.4, the calculation of the gain proportional coefficient is based on the maximum average grayscale value Il of the dominant color channel before stretching, (Il-Im) / Il is used as the gain proportional coefficient of the middle average grayscale value Im, and (Il-Is) / Il is used as the gain proportional coefficient of the minimum average grayscale value Is; then the pixel value of the dominant color channel is superimposed on the corresponding subordinate channel according to the product of the gain proportional coefficient and the turbidity factor.

[0031] Preferably, in step 4.4, the dynamic gain compensation of the slave color channel is specifically as follows:

[0032] Compare the relative difference between the average gray value of the color channel and the maximum average gray value of the three color channels;

[0033] When the average gray value of the color channel is lower than (1–δ) times the maximum average gray value, it is dark and the gain g is given. k+1 >1 overlay;

[0034] When the average grayscale value of the color channel is higher than (1+δ) times of the maximum average grayscale value, it indicates that it is bright and is given a gain g. k+1 <1 decay;

[0035] Here, δ is a deviation value and is relaxed as the turbidity factor increases linearly.

[0036] Preferably, in step 5, the color imbalance index of the current underwater image needs to be recalculated after each iteration. If the color imbalance index of the current underwater image is not higher than the color imbalance threshold, the iteration is completed and a corrected new underwater image is obtained.

[0037] Preferably, after step 5, the new underwater image obtained after color correction is converted from RGB space to HSV space, the spatial components are adjusted by threshold and linear compression gain in HSV space, and the saturation or brightness is locally fine-tuned before being converted back to RGB space.

[0038] As a second aspect of the present application, the present invention further discloses a turbid water color restoration system, comprising:

[0039] Turbidity analysis and color loss calculation module, used to calculate the turbidity factor and color imbalance index based on the original turbid underwater image;

[0040] The dominant channel dynamic stretching module is used to treat the channel with the maximum average grayscale value for calculating the color imbalance index as the dominant color channel and perform stretching adjustments on it;

[0041] A slave channel gain compensation module is used to treat the medium average gray value channel and the minimum average gray value channel for calculating the color imbalance index as slave color channels and dynamically adjust their gains;

[0042] The iterative optimization and convergence module is used to iteratively update and correct each color channel, recalculate the corrected color imbalance index, and end the iteration when the corrected color imbalance index is no higher than the color imbalance threshold.

[0043] Compared with the prior art, the present invention has the following beneficial effects:

[0044] This invention provides a method for color restoration in turbid water. The method uses a turbidity meter or image-based visual estimation to determine the turbidity factor of the ambient water. It then calculates a color imbalance index (CLI) to quantify the degree of deviation in each color channel. Using the CLI and CLI as control parameters, the algorithm performs dynamic range stretching and gain compensation on the red, green, and blue color channels of the image, respectively. An iterative strategy is employed to gradually approach color balance. Finally, a color-corrected image is output. By incorporating turbidity factor estimates derived from external turbidity sensor readings or visual image features, the algorithm detects water clarity in real time and adaptively adjusts the color restoration effort, improving the algorithm's adaptability to varying water quality environments. An iterative, small-step correction approach is employed to dynamically stretch and gain compensate each color channel, avoiding new distortion caused by overcorrection and ensuring smooth convergence of color restoration. The CLI introduces a CLI to fine-tune the correction process by combining ambient turbidity with image color deviation. This approach, unlike traditional methods that rely solely on empirical data or single-image statistics, achieves excellent results even in high turbidity and complex lighting conditions. The proposed method can more accurately restore the intrinsic colors of underwater scenes, resulting in more balanced and natural-looking images, providing higher-quality visual information for underwater monitoring and target recognition. It is applicable to natural water environments with a variety of turbidity levels, including rivers, lakes, offshore areas, and water tanks, and can be implemented in real time or offline on platforms such as underwater robots and submersibles. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The drawings constituting a part of this application are used to provide a further understanding of this application and make other features, purposes and advantages of this application more apparent. The drawings and descriptions of the exemplary embodiments of this application are used to explain this application and do not constitute an improper limitation on this application.

[0046] In the attached figure:

[0047] Figure 1 This is a connection diagram of the main steps of the method for restoring the color of turbid water in an embodiment of the present invention;

[0048] Figure 2 This is an overall flow chart of the method for restoring the color of turbid water according to an embodiment of the present invention;

[0049] Figure 3 The turbid water color restoration method is used in the embodiment of the present invention to enhance the turbid underwater image effect before and after, the image band data and histogram comparison diagram;

[0050] Figure 4 2 is a comparison chart of underwater effects of output before and after enhancement under different turbidities in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0052] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.

[0053] The present invention discloses a method for restoring the color of turbid water. The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. Figure 1 and Figure 2 As shown, it mainly includes the following steps:

[0054] Step 1, in response to acquiring a turbid original underwater image;

[0055] Step 2: Obtain a turbidity factor using a turbidity meter or by estimating the visual features of the original underwater image;

[0056] Step 3, calculating the average value of each color channel of the original underwater image, and calculating the color imbalance index based on the color channel average value;

[0057] Step 4, performing iterative dynamic stretching and gain compensation correction on the color channel according to the turbidity factor and color imbalance index;

[0058] Step 5: After the iteration conditions are met, a new underwater image with color correction is output.

[0059] The present invention discloses a method for obtaining a turbid original underwater image based on the acquired water turbidity information, and then clarifying the subsequent color correction steps through the information. First, the turbidity factor T is obtained by turbidity measurement or image analysis of the environmental water body. In this embodiment, the turbidity factor can be calculated by a turbidity meter and an image visual estimation method. When conditions permit, a turbidity meter can be used to directly measure the physical turbidity of the water body, obtain a turbidity value expressed in NTU (Nitride Unit), and normalize it to a turbidity factor T that can be used by the algorithm. However, the cost of using a turbidity meter is relatively high, mainly due to its high-precision sensor and real-time monitoring function. Therefore, in the absence of a dedicated turbidity sensor, we can use the image visual estimation-based method disclosed in the present invention to calculate an equivalent turbidity factor T.

[0060] The image visual estimation method of the present invention determines water turbidity by analyzing the clarity and color distribution of the original image. Statistical features such as edge gradient intensity, brightness standard deviation, and color saturation are calculated, and these features are combined to construct a score reflecting the turbidity level. The method also includes the following steps:

[0061] Step 2.1, scaling the acquired original underwater image;

[0062] Step 2.2, extract the image average gradient amplitude, image brightness standard deviation and image pixel saturation average in grayscale domain and HSV color space simultaneously;

[0063] Step 2.3, calculate the turbidity score based on the image average gradient amplitude, the standard deviation of image brightness, and the average image pixel saturation;

[0064] In step 2.4, the turbidity score is normalized to obtain the turbidity factor corresponding to the actual physical turbidity.

[0065] Specifically, the original underwater image obtained in step 1 is scaled to a uniform size and then three statistical features are extracted in the grayscale domain and HSV color space, namely, the image average gradient amplitude, the standard deviation of the image brightness, and the average image pixel saturation. Then the turbidity score is expressed as,

[0066]

[0067] Among them, G represents the average gradient amplitude of the image, which reflects the clarity of the image edge. L It represents the standard deviation of image brightness, which reflects the contrast of the image. The image's average pixel saturation value reflects the vividness of the image's colors. a, b, and c are weight coefficients, and ∈ is a minimum constant to avoid division by zero. The image's average gradient magnitude G is obtained by applying the Sobel operator to the grayscale image to obtain the horizontal and vertical gradients, and then taking the average of the gradient magnitudes of each pixel. The image's brightness standard deviation σ is L The global standard deviation of the brightness channel in Lab or HSV space is taken, the RGB image is converted to Lab or HSV space, the channel data is extracted and the global standard deviation is calculated. Take the average value of the S channel in the HSV space, convert the RGB image to the HSV color space, extract the S channel data to calculate the matrix and find the average value. Channel S represents the color purity.

[0068] Turbidity score T v The maximum-minimum range is normalized to the turbidity factor T corresponding to the actual physical turbidity, and the turbidity score T is v The linear transformation is expressed as [0, 1].v Convert it into a turbidity factor in the interval [0, 1], eliminate the dimension difference, and make its value correspond to the turbidity factor T in terms of dimension. When the turbidity of the water body is higher, the image tends to have lower gradient and brightness contrast and weaker color saturation, so the turbidity score T v will increase, whereas in clear water the turbidity score is T v The turbidity factor T obtained in this way can be understood as a measure of the degree of image degradation caused by the water environment and can be used as a reference in subsequent steps.

[0069] After obtaining the turbidity factor T, the color imbalance index Lc is calculated for the original underwater image to quantify the degree of image color shift. Color imbalance is usually manifested as an imbalance in the average brightness of each color channel, that is, one channel is significantly stronger or weaker than other channels. The larger the value of this index, the more serious the overall color imbalance of the image (that is, the more obvious the color cast). For example, in a typical underwater image, the brightness of the red channel is much lower than that of other channels, so Lc will obtain a larger value. The initial Lc is calculated as a reference for the subsequent degree of color correction. The calculation of the color imbalance index also includes the following steps:

[0070] Step 3.1, sum the grayscale values ​​of all pixels in each color channel of the original underwater image;

[0071] Step 3.2: Divide the sum of pixel grayscale values ​​by the total number of pixels in the original underwater image to obtain the average grayscale value of each color channel;

[0072] In step 3.3, the maximum average value is taken as the maximum average grayscale value Il, the minimum average grayscale value Is, and the middle average grayscale value Im, and the color imbalance index is calculated using them.

[0073] Specifically, the grayscale values ​​of all pixels in each color channel of the input image (original underwater image) are summed and then divided by the total number of pixels in the image. Specifically, the grayscale values ​​of all pixels in the three channels R, G, and B of the original underwater image are summed, respectively, and expressed as S R 、S G and S B Then divide each by the total number of pixels N of the original underwater image to get the average grayscale value of the three channels and Finally, sort the three average grayscale values ​​from largest to smallest. The channel with the largest average grayscale value is designated as the maximum average grayscale value Il, the channel with the middle average grayscale value is designated as the medium average grayscale value channel Im, and the channel with the smallest average grayscale value is designated as the minimum average grayscale value channel Is. The color imbalance index Lc is calculated using the expression Lc = (Il – Im) + (Il – Is).

[0074] The channel corresponding to the maximum average grayscale value Il, which has the largest average grayscale value, is designated as the dominant color channel, and the channels corresponding to the other medium average grayscale value channels Im and the minimum average grayscale value channel Is are designated as subordinate color channels. Combined with the turbidity factor T and color imbalance indicator Lc obtained in the above steps, dynamic stretching is performed on the dominant color channel, and gain coefficient compensation is applied to the subordinate color channels. Specifically, the following steps are included:

[0075] Step 4.1, initialize and set the iteration count k and color imbalance threshold ε;

[0076] Step 4.2, determining the gain adjustment step Δg and the stretch ratio Δs according to the turbidity factor;

[0077] Step 4.3, stretching the dominant color channel to a predetermined output range;

[0078] In step 4.4, the stretched image of the dominant color channel is dynamically compensated and superimposed on the subordinate color channel according to the gain ratio coefficient.

[0079] Specifically, the iteration count k and color imbalance threshold ε are initialized to 0. The color imbalance threshold ε represents the acceptable degree of color shift under turbidity guidance. The initial correction strength parameter is determined based on the turbidity factor T. Specifically, the gain adjustment step is represented by Δg (Δg = Δg_0(1 + 0.8T)), and the stretch ratio is represented by Δs (Δs = Δs_0(1 + 0.6T)). Δg_0 and Δs_0 are determined based on experiments with clear water samples. The dominant color channel image is stretched, dynamically mapping pixel values ​​to a wider range based on the grayscale distribution of the current channel. Specifically, the pixel intensities of the dominant color channel are linearly stretched to a predetermined output range using a quantile-based minimum-maximum linear stretch. Linear stretching is performed between the 1% and 99% quantiles of the channel histogram, extending the pixel range to [0, 255] to increase its dynamic range and contrast. Upper and lower quantile cutoffs are set to eliminate extreme values ​​and prevent outliers from interfering with the stretching results. Data outside the quantile boundary is replaced with the boundary value, and the truncated data is then linearly mapped to the target interval. In this embodiment, when linearly stretching the dominant color channel, the original minimum pixel value of the channel is mapped to 0, the maximum pixel value is mapped to 255, and other pixel values ​​are proportionally mapped to the range [0, 255].

[0080] Based on the gain compensation of the slave color channels, the gain coefficient g is calculated based on the turbidity factor T and the difference between the average values ​​of each slave color channel and the dominant color channel. The stretched image of the dominant color channel is superimposed on the slave color channel according to the gain coefficient, thereby increasing the intensity of the slave color channel. Using the maximum average grayscale value Il of the dominant color channel before stretch correction as the reference, (Il – Im) / Il is used as the gain coefficient for the median average grayscale value Im, and (Il – Is) / Il is used as the gain coefficient for the minimum average grayscale value Is. The corrected pixel values ​​of the dominant color channel are then superimposed on the corresponding slave color channel according to the product of the gain coefficient and the turbidity factor.

[0081] After stretching, apply a linear gain scaling factor gk+1 to the slave color channels. (c) Compensation is performed (where c∈R,G,B). The gain proportional coefficient is used to correct the overall intensity deviation of the channel relative to other channels. The gain proportional coefficient is determined based on the current color imbalance. For example, if the red channel is obviously dark, the red channel gain proportional coefficient gk+1 is assigned. ( R ) >1 to increase its brightness. The relative difference between the average grayscale value μR of the red channel and the maximum average grayscale value μMAX of the three channels is used to determine the brightness. When μR is lower than (1–δ) times of μMAX, it is considered dark. δ is the deviation value, which is 0.05. It can be linearly increased with the turbidity factor T to relax the judgment in turbid scenes. The rest are normal. On the contrary, for an overly strong channel (i.e., the average grayscale of a color channel is higher than μ MAX (1+δ) times) gives the gain proportional coefficient g k+1 The gain adjustment range is also controlled by the turbidity factor. The higher the turbidity, the greater the gain compensation is required to recover the absorbed color components. However, to avoid introducing too much noise, an upper limit is set for the gain (this upper limit increases linearly with the turbidity factor T). All gains are truncated to the range [1–0.5T, 1+1.2T], which is linearly relaxed with the turbidity factor T to suppress noise amplification.

[0082] Apply the above stretching and gain operations to the three color channels of the image to obtain the image corrected by the k+1th iteration. Then recalculate the color imbalance index of the image The calculation method is the color imbalance method mentioned above, that is, Compare and the color imbalance threshold ε. If If it indicates that the color imbalance has been corrected to an acceptable range, the iteration ends. Otherwise, let k = k + 1 and enter the next round of iterative correction. In order to prevent infinite iteration, the maximum number of iterations Kmax is preset, and the iteration is forced to stop when K reaches Kmax. After the iteration, the new underwater image after color correction is output. Figure 3and Figure 4 As shown, they respectively represent the turbid underwater image effects before and after enhancement, the image band data and the histogram comparison chart, as well as the comparison chart of the underwater image output effects before and after enhancement.

[0083] Through multiple rounds of iteration, the color deviation is corrected slightly and controllably. The method of the present invention can gradually approach the ideal color balance state, and the turbidity factor T provides a key adjustment basis therein. During the whole process, if the environmental turbidity is high, it will always operate with a strong correction force to compensate for the significant color cast caused by turbidity. If the environmental turbidity is low, the correction process is milder, so as to maintain the original details and texture of the image to the greatest extent. The dynamic stretching of each round of iteration improves the contrast, and the gain compensation corrects the color cast. The combination of the two ensures the effectiveness and robustness of color correction.

[0084] After the color correction is basically completed, the image is converted from the RGB space to the HSV or Lab space, and then locally fine-tuned for saturation or brightness and then converted back to RGB, so as to further improve the visual realism of the image. In the HSV space, the S or V component is adjusted by threshold and linear compression (gain) to reduce the over-saturated area or increase the under-bright area without changing the hue H component, so as to enhance local details on the premise of overall color balance. Specifically, first, the distributions of S and V in the whole image are counted, the saturation upper limit S_max is taken by the 95% quantile, and the brightness lower limit V_min is taken by the 5% quantile. For each pixel, if S > S_max, the excess part is compressed by about 0.5 times and then added back (that is, let S gradually approach S_max without being over-saturated); if V < V_min, the under-bright part is stretched by about 0.7 times (let V approach V_min without being over-exposed), and the remaining pixels remain unchanged. During the whole process, the H component remains unchanged, so the overall hue does not shift, the over-saturated and over-dark areas are respectively suppressed and brightened, and local details are enhanced.

[0085] To implement the above embodiments, the present invention also proposes a turbid water body color restoration system, including a turbidity analysis and color loss amount calculation module, which is used to calculate the turbidity factor and the color imbalance index according to the obtained original turbid underwater image. A dominant channel dynamic stretching module, which is used to regard the channel with the maximum average gray value for calculating the color imbalance index as the dominant color channel and stretch and adjust it. A subordinate channel gain compensation module, which is used to regard the medium average gray value channel and the minimum average gray value channel for calculating the color imbalance index as the subordinate color channels and perform dynamic gain adjustment on them. An iterative optimization and convergence module, which is used to iteratively update and correct each color channel, recalculate the corrected color imbalance index, and end the iteration when the corrected color imbalance index is not higher than the color imbalance threshold.

[0086] In addition, in order to implement the above-mentioned embodiment, the present invention proposes an electronic device. The electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus. Typically, the following devices can be connected to the I / O interface: input devices including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices including, for example, a magnetic tape, a hard disk, etc., and communication devices. The communication device can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data.

[0087] The present invention also provides a computer storage medium. The computer storage medium can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0088] In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, a computer-readable signal medium can include a data signal transmitted in baseband or as part of a carrier wave, carrying computer-readable program code. This transmitted data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer storage medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer storage medium can be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof. The computer storage medium can be included in the electronic device or exist independently, not incorporated into the electronic device. The computer storage medium carries one or more programs that, when executed by the electronic device, enable the electronic device to implement a method for restoring the color of turbid water.

[0089] The above description is only an illustration of some preferred embodiments of the present disclosure and the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure.

Claims

1. A method for restoring the color of turbid water, characterized in that: The steps include: Step 1, in response to acquiring a turbid original underwater image; Step 2, obtaining a turbidity factor using a turbidity meter or by image visual feature estimation based on the original underwater image; Step 3, calculating the average value of each color channel of the original underwater image, and calculating the color imbalance index according to the color channel average value; Step 4, performing iterative dynamic stretching and gain compensation correction on the color channel according to the turbidity factor and the color imbalance index; Step 5: After the iteration conditions are met, a new underwater image with color correction is output.

2. The method for restoring the color of turbid water according to claim 1, characterized in that: The calculation of the turbidity factor in step 2 further includes the following steps: Step 2.1, performing scaling on the acquired original underwater image; Step 2.2, extract the image average gradient amplitude, image brightness standard deviation and image pixel saturation average in grayscale domain and HSV color space simultaneously; Step 2.3, calculating the turbidity score based on the image average gradient amplitude, the standard deviation of the image brightness, and the average value of the image pixel saturation; Step 2.4: normalize the turbidity score to obtain a turbidity factor corresponding to the actual physical turbidity.

3. The method for restoring the color of turbid water according to claim 2, characterized in that: The calculation of the color imbalance index in step 3 further includes the following steps: Step 3.1, summing the grayscale values ​​of all pixels in each color channel of the original underwater image; Step 3.2, dividing the sum of pixel grayscale values ​​by the total number of pixels in the original underwater image to obtain the average grayscale value of each color channel; In step 3.3, the maximum average value is taken as the maximum average grayscale value Il, the minimum average grayscale value Is, and the middle average grayscale value Im, and the color imbalance index is calculated using them.

4. The method for restoring the color of turbid water according to claim 3, characterized in that: In step 4, the channel corresponding to the maximum average grayscale value I1 is first regarded as the dominant color channel, and the channels corresponding to the medium average grayscale value Im and the minimum average grayscale value Is are regarded as subordinate color channels, and the following steps are also included: Step 4.1, initialize and set the iteration count k and color imbalance threshold ε; Step 4.2, determining the gain adjustment step Δg and the stretch ratio Δs according to the turbidity factor; Step 4.3, stretching the dominant color channel to a predetermined output range; Step 4.4: Dynamically compensate and superimpose the stretched image of the dominant color channel onto the subordinate color channel according to the gain proportional coefficient.

5. The method for restoring the color of turbid water according to claim 4, characterized in that: In step 4.3, according to the grayscale distribution of the dominant color channel, the pixel intensity of the dominant color channel is subjected to minimum-maximum linear stretching based on quantile truncation, the minimum pixel value in the dominant color channel is mapped to 0, the maximum pixel value is mapped to 255, and other pixel values ​​are proportionally mapped to the range of [0, 255].

6. The method for restoring the color of turbid water according to claim 5, characterized in that: In step 4.4, the gain proportional coefficient is calculated based on the maximum average grayscale value Il of the dominant color channel before stretching, (Il-Im) / Il is used as the gain proportional coefficient of the middle average grayscale value Im, and (Il-Is) / Il is used as the gain proportional coefficient of the minimum average grayscale value Is; then the pixel value of the dominant color channel is superimposed on the corresponding subordinate channel according to the product of the gain proportional coefficient and the turbidity factor.

7. The method for restoring the color of turbid water according to claim 6, characterized in that: In step 4.4, the dynamic gain compensation of the slave color channel is specifically as follows: Compare the relative difference between the average gray value of the color channel and the maximum average gray value of the three color channels; When the average gray value of the color channel is lower than (1–δ) times the maximum average gray value, it is dark and the gain g is given. k+1 >1 overlay; when the average grayscale value of the color channel is higher than (1+δ) times of the maximum average grayscale value, it indicates that it is bright and is given a gain of g. k+1 <1 decay; where δ is a deviation value and is relaxed as the turbidity factor increases linearly.

8. The method for restoring the color of turbid water according to claim 4, characterized in that: In step 5, the color imbalance index of the current underwater image needs to be recalculated after each iteration. If the color imbalance index of the current underwater image is not higher than the color imbalance threshold, the iteration is completed and a corrected new underwater image is obtained.

9. The method for restoring the color of turbid water according to claim 8, characterized in that: After step 5, the new underwater image obtained after color correction is converted from the RGB space to the HSV space, the spatial components are adjusted in the HSV space by threshold and linear compression gain, and the saturation or brightness is locally fine-tuned before being converted back to the RGB space.

10. A turbid water color restoration system, characterized in that: include: Turbidity analysis and color loss calculation module, used to calculate the turbidity factor and color imbalance index based on the original turbid underwater image; The dominant channel dynamic stretching module is used to treat the channel with the maximum average grayscale value for calculating the color imbalance index as the dominant color channel and perform stretching adjustments on it; A slave channel gain compensation module is used to treat the medium average gray value channel and the minimum average gray value channel for calculating the color imbalance index as slave color channels and dynamically adjust their gains; The iterative optimization and convergence module is used to iteratively update and correct each color channel, recalculate the corrected color imbalance index, and end the iteration when the corrected color imbalance index is no higher than the color imbalance threshold.