An underwater image enhancement method based on anisotropic color channel attenuation differences
By taking into account the attenuation differences of anisotropic color channel, the adaptive gamma transformation function is used for personalized correction, which solves the problem of poor enhancement effect in the prior art and achieves better brightness and contrast improvement.
Patent Information
- Application Number
- CN202210358969.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-07
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2042-04-07
AI Technical Summary
The existing underwater image enhancement algorithm fails to effectively consider the attenuation differences of each color channel, resulting in poor enhancement effect.
The underwater image enhancement method based on the attenuation difference of anisotropic color channel is adopted. Through normalization processing and adaptive gamma transformation function, different color channels are personalized to form the final enhanced image.
It effectively improves the brightness and contrast of underwater images, has good robustness, and significantly improves the image enhancement effect.
Smart Images

Figure CN114742730B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to an underwater image enhancement method based on anisotropic color channel attenuation differences. Background Art
[0002] Affected by the complex underwater environment, underwater images often have problems such as low contrast, blurred details and color distortion. Therefore, the enhancement of underwater images is of great research significance. When light propagates underwater, it will be attenuated due to absorption and scattering. The attenuation degree of each channel of underwater images captured in turbid or deep waters varies greatly. Although algorithms such as HE and gamma transform can effectively improve the details of grayscale images, they do not consider the attenuation differences of color channels during correction, and the enhancement effect is not very good. Summary of the invention
[0003] Purpose of the invention: In view of the above shortcomings, the present invention provides an underwater image enhancement method based on anisotropic color channel attenuation differences, which takes into account the differences in light attenuation underwater and can effectively improve the brightness and contrast of enhanced underwater images, and has good robustness.
[0004] Technical solution: To solve the above problems, the present invention adopts an underwater image enhancement method based on anisotropic color channel attenuation differences, which specifically includes the following steps:
[0005] (1) Perform normalization processing on the pixels of the original image; extract the three color channels of R, G, and B of the original image, and calculate the total pixel value, mean, and variance of each color channel respectively;
[0006] (2) Determine whether there is a color channel that meets the conditions based on the mean and variance of each color channel; the conditions are as follows:
[0007] F=diff((μ λ -2σ λ ),(μ λ +2σ λ ))
[0008] F ≥ 3 / 4
[0009] μ λ >1 / 2
[0010] In the formula, μ λ Expressed as the mean value corresponding to each color channel; σ λ Expressed as the variance corresponding to each color channel; λ∈{R,G,B};
[0011] If there is a channel that meets the conditions among the three color channels, the channel that meets the conditions is used as the reference image, and each pixel value in the remaining two color channels is corrected using an adaptive gamma transformation function, and enhanced images of the remaining two color channels are obtained after correction;
[0012] If there are two or more channels that meet the conditions among the three color channels, randomly select a channel that meets the conditions as the reference image, and use the adaptive gamma transformation function to correct each pixel value in the remaining two color channels, and obtain the enhanced images of the remaining two color channels after correction;
[0013] If there is no channel that meets the conditions in the three color channels, the channel with the largest total pixel value is selected as the reference image, and the changed gamma correction formula is set. The changed gamma correction formula is used to correct each pixel value in the remaining two color channels, and the enhanced images of the remaining two color channels are obtained after correction.
[0014] (3) The baseline image and the enhanced images of the remaining two color channels are combined to form the final enhanced image.
[0015] Furthermore, the adaptive gamma transform function in step (2) is:
[0016] If the mean value of the color channel is less than or equal to 1 / 2, the following formula is used for correction:
[0017] I enh (x,y)=αI γ (x,y)+βI(x,y)
[0018] In the formula, I enh represents the enhanced image, I represents the original image, x and y represent the specific positions of the channel pixels; α and β represent weighting coefficients, γ represents the index of gamma transformation, and the specific value is the mean difference between the reference image and the color channel to be corrected;
[0019] If the mean value of the color channel is greater than 1 / 2, the following formula is used for correction:
[0020]
[0021] In the formula, Represents the total pixel value of the reference image; s λ′ Indicates the total pixel value of the color channel that needs to be corrected.
[0022] Furthermore, the gamma correction formula after the change in step (2) is:
[0023] I enh (x,y)=Iγ (x,y)
[0024] In the formula, I enh represents the enhanced image, I represents the original image, x and y represent the specific positions of the image pixels; γ′ represents the exponent of the gamma transform, and the specific value is:
[0025]
[0026] Furthermore, the normalization process in step (1) specifically refers to normalizing the image pixel values of each color channel from the interval [0, 255] to the range [0, 1].
[0027] Furthermore, the calculation formulas for calculating the total pixel value, mean value, and variance of each color channel in step (1) are:
[0028]
[0029]
[0030]
[0031] In the formula, s λ represents the total pixel value of the λ channel; μ λ represents the mean of the λ channel, σ λ represents the variance of the λ channel; m represents the number of rows of the original image I, n represents the number of columns of the original image I, i represents the i-th row of the original image I, and j represents the j-th column of the original image I; I nor λ (i,j) represents the normalized pixel value of the i-th row and j-th column of the λ channel.
[0032] Furthermore, before the reference image and the enhanced images of the remaining two color channels are combined to form the final enhanced image in step (3), the reference image and the enhanced images of the remaining two color channels need to be inversely normalized.
[0033] In addition, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program. A computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the above method when executed by the processor.
[0034] Beneficial effect: Compared with the prior art, the underwater image enhancement method based on anisotropic color channel attenuation differences of the present invention has the following significant advantages: compared with the existing underwater image enhancement algorithm, the algorithm can adaptively adjust the underwater image, and by considering the differences in attenuation of each channel, accurately enhance the image, and improve the brightness and contrast of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 Shown is a flow chart of the method of the present invention;
[0036] Figure 2 Shown is a comparison diagram of the original image and the enhanced image of the present invention; Figure 2 (a) shows the original underwater image; Figure 2 (b) shows the enhanced image according to the embodiment of the present invention. DETAILED DESCRIPTION
[0037] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.
[0038] like Figure 1 As shown, the present invention discloses an underwater image enhancement method based on anisotropic color channel attenuation difference, which specifically includes the following steps:
[0039] Step 1: normalize the image pixels of the original image, extract the three color channels of R, G, and B from the original image, and calculate the total pixel value, mean, and variance of each color channel respectively;
[0040] (1) Assume that the number of rows and columns of the original image I are m and n respectively, that is:
[0041] I={(i,j)|1≤i≤m,1≤j≤n}
[0042] (2) Normalize the original image I, that is, normalize the pixel values of the image to the range of [0, 1]:
[0043]
[0044] Where a represents the smallest pixel value in the original image, and b represents the largest pixel value in the original image.
[0045] (3) Calculate the total pixel values of the R channel, G channel, and B channel in the original image respectively. The formula is:
[0046]
[0047] Where i represents the i-th row of the original image I, and j represents the j-th column of the original image I; nor λ(i,j) represents the normalized pixel value of the i-th row and j-th column of the λ channel.
[0048] Select from λ The color channel λ where the maximum value is located mid ,λ mid ∈{R,G,B}, that is:
[0049]
[0050] (4) Calculate the mean and variance of the R channel, G channel, and B channel in the original image respectively. The formula is:
[0051]
[0052]
[0053] Step 2: Determine the contrast and brightness of the channel image according to the mean and variance of each color channel, and then set the corresponding discrimination conditions; then select the reference image according to the discrimination result and enhance the non-reference image.
[0054] (1) Combining Chebyshev inequality and the histogram features of high-contrast images, the following discrimination conditions are set. The specific formula is:
[0055]
[0056] F=diff((μ λ -2σ λ ),(μ λ +2σ λ )) (2)
[0057] Among them, l, h and o represent channel images that meet the corresponding conditions respectively;
[0058] According to formula (2), the smaller the F value, the more concentrated the pixel distribution of the channel image is, and the lower the contrast of the channel image is; the smaller the value of σ is, the less significant the contrast of the channel image is. λ A small value of indicates that the pixels of the channel image are mostly concentrated in the range of [0,0.5], that is, the brightness of the channel image is low. Assuming that 1 / 3 of the pixels are within 2 standard deviations of the mean, the channel image has a low contrast; assuming μ λ When the value of is between [0,0.5], the brightness of the channel image is low. Therefore, the contrast of channel image l is small and the brightness is low, while the contrast of channel image h is high and the brightness is high.
[0059] (2) According to the above discrimination conditions, the color channel λ corresponding to the channel image h with high contrast and high brightness is selected as the reference image. This color channel is denoted as λ h,λ h ∈{R, G, B}.
[0060] (2.1) If the condition is met: F ≥ 3 / 4∪μ λ There is only one color channel with a value greater than 0.5, namely λ h There is only one color channel; the remaining two color channels are denoted as λ′1 and λ′2, λ′1∈{{R,G,B}-{λ h}}, λ′2∈{{R, G, B}-{λ h}}. Select color channel λ h As the reference image; for the remaining two color channels λ′1 and λ′2, further determine whether the mean of each color channel is less than or equal to 1 / 2.
[0061] If the mean value of the color channel is less than or equal to 1 / 2, it means that the brightness of the channel image is dark, but the contrast is not low, or the brightness of the channel image is dark and the contrast is low. The following formula (3) is used to correct the remaining two color channels λ′1 and λ′2 respectively:
[0062] I enh (x, y) = αI γ (x,y)+βI(x,y) (3)
[0063] In the formula, λ′ corresponds to λ′1 and λ′2; α and β both represent weighting coefficients, α=β=0.5; I enh represents the enhanced image, I represents the original image, and x and y represent the specific positions of channel pixels;
[0064] If the mean value of the color channel is greater than 1 / 2, it means that the channel image is not dark, but the contrast is low. Then the following formula (4) is used for correction:
[0065]
[0066] In the formula, Represents the total pixel value of the reference image; s λ′ Represents the total pixel value of color channel λ′, where λ′ corresponds to λ′1 and λ′2.
[0067] (2.2) If the condition is met: F ≥ 3 / 4∪μ λ There are two or more color channels > 0.5, that is, λ h If there are two or more color channels, one color channel is arbitrarily selected as the reference image, and the remaining two color channels are recorded as λ′1 and λ′2 respectively;
[0068] It is further determined whether the mean of each color channel is less than or equal to 1 / 2. If the mean of the color channel is less than or equal to 1 / 2, the above formula (3) is used to correct the remaining two color channels λ′1 and λ′2 respectively. If the mean of the color channel is greater than 1 / 2, the above formula (4) is used for correction.
[0069] (3) According to the above judgment conditions, if the channel image h with high contrast and high brightness cannot be selected, that is, the three color channels do not meet the conditions: F ≥ 3 / 4 ∪ μ λ >0.5, then according to the s obtained in step 1 λ The color channel λ where the maximum value is located mid As the reference image, the remaining two color channels are denoted as λ′1 and λ′2, where λ′1∈{{R,G,B}-{λ mid}}, λ′2∈{{R, G, B}-{λ mid}}; Use the following formulas (5) and (6) to correct the remaining two color channels λ′1 and λ′2 respectively:
[0070] I enh (x, y) = I γ′ (x,y) (5)
[0071]
[0072] In the formula, λ′ corresponds to λ′1 and λ′2.
[0073] Step 3: Perform inverse normalization on the reference image and the enhanced images of the remaining two color channels, that is, multiply the pixel value by 255 and round it down, and then combine the reference image and the enhanced images of the remaining two color channels to form the final enhanced image.
[0074] like Figure 2 As shown, 2(a) is the original image, Figure 2 (b) is an enhanced image obtained by processing the original image using the image enhancement method of the present invention; based on the comparison of the two images, it can be clearly seen that the brightness and contrast of the image enhanced by the present method are significantly improved compared with the original image.
[0075] In addition, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program. A computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the above method when executed by the processor.
Claims
1. An underwater image enhancement method based on anisotropic color channel attenuation differences, characterized in that: The following steps are involved: (1) Perform normalization processing on the pixels of the original image; extract the three color channels of R, G, and B of the original image, and calculate the total pixel value, mean, and variance of each color channel respectively; (2) Determine whether there is a color channel that meets the conditions based on the mean and variance of each color channel; the conditions are as follows: F=diff((μ λ -2s λ ),(m λ +2s λ )) F≥3 / 4 m λ >1 / 2 In the formula, μ λ Expressed as the mean value corresponding to each color channel; σ λ Expressed as the variance corresponding to each color channel; λ∈{R,G,B}; If there is a channel that meets the conditions among the three color channels, the channel that meets the conditions is used as the reference image, and each pixel value in the remaining two color channels is corrected using an adaptive gamma transformation function, and enhanced images of the remaining two color channels are obtained after correction; The adaptive gamma transform function is: If the mean value of the color channel is less than or equal to 1 / 2, the following formula is used for correction: I enh (x,y)=αI γ (x,y)+βI(x,y) In the formula, I enh represents the enhanced image, I represents the original image, x and y represent the specific positions of the channel pixels; α and β represent weighting coefficients, γ represents the index of gamma transformation, and the specific value is the mean difference between the reference image and the color channel to be corrected; If the mean value of the color channel is greater than 1 / 2, the following formula is used for correction: In the formula, Represents the total pixel value of the reference image; s λ′ Indicates the total pixel value of the color channel to be corrected; If there are two or more channels that meet the conditions among the three color channels, randomly select a channel that meets the conditions as the reference image, and use the adaptive gamma transformation function to correct each pixel value in the remaining two color channels, and obtain the enhanced images of the remaining two color channels after correction; If none of the three color channels meets the conditions, the color channel with the largest total pixel value is selected as the reference image, and the changed gamma correction formula is set. Each pixel value in the remaining two color channels is corrected using the changed gamma correction formula, and the enhanced images of the remaining two color channels are obtained after correction. The changed gamma correction formula is: I enh (x,y)=I γ′ (x,y) In the formula, γ ′ Expressed as the exponent of the gamma transform, the specific value is: (3) The baseline image and the enhanced images of the remaining two color channels are combined to form the final enhanced image.
2. The underwater image enhancement method based on anisotropic color channel attenuation difference according to claim 1, characterized in that: The normalization process in step (1) specifically refers to normalizing the image pixel values of each color channel from the interval [0, 255] to the range [0, 1].
3. The underwater image enhancement method based on anisotropic color channel attenuation difference according to claim 1, characterized in that: The calculation formulas for calculating the total pixel value, mean value, and variance of each color channel in step (1) are: In the formula, s λ represents the total pixel value of the λ channel; μ λ represents the mean of the λ channel, σ λ represents the variance of the λ channel; m represents the number of rows of the original image I, n represents the number of columns of the original image I, i represents the i-th row of the original image I, and j represents the j-th column of the original image I; I nor λ (i,j) represents the normalized pixel value of the i-th row and j-th column of the λ channel.
4. The underwater image enhancement method based on anisotropic color channel attenuation difference according to claim 1, characterized in that: In step (3), before combining the reference image and the enhanced images of the remaining two color channels to form the final enhanced image, the reference image and the enhanced images of the remaining two color channels need to be inverse normalized.
5. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
System and method for processing images using predetermined tone reproduction curves
CN101523888A
Video image quality enhancement method and device and video quality enhancement method
CN108596855A