Underwater image enhancement method and device, nonvolatile storage medium and electronic equipment

By determining the reference point and gain coefficient in the underwater image for bidirectional white balance correction, and combining the grayscale value distribution adjustment, the problem of poor underwater image quality in the prior art is solved, and a higher quality image processing effect is achieved .

CN119090976APending Publication Date: 2024-12-06CHINA TELECOM CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411117987.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The white balance correction method in the prior art is not suitable for underwater images, resulting in the inability to obtain high-quality underwater images.

Method used

By determining the first reference point and the second reference point in the underwater image and determining the corresponding gain coefficients based on these reference points, the underwater image is subjected to bidirectional white balance correction and adjusting it with the grayscale value distribution, the enhanced Target image.

Benefits of technology

The quality of underwater images is improved, the problem of inapplicability of white balance correction methods is solved, and a more natural and clear image effect is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090976A_ABST
    Figure CN119090976A_ABST
Patent Text Reader

Abstract

The invention discloses an underwater image enhancement method and device, a nonvolatile storage medium and electronic equipment. The method comprises the following steps: determining a first reference point and a second reference point in an underwater image; a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point are determined, and the first gain coefficient and the second gain coefficient are used for performing white balance correction on the underwater image; correcting components of pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; and adjusting the gray value of each pixel point in the intermediate image according to the gray value distribution condition of each pixel point in the intermediate image to obtain an enhanced target underwater image. The technical problem that a high-quality underwater image cannot be obtained due to the fact that a white balance correction method in the prior art is not suitable for the underwater image is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to an underwater image enhancement method, device, non-volatile storage medium and electronic device. Background Art

[0002] In the related art, when eliminating color deviation caused by different light source color temperatures in an image, the method usually adopted is to perform white balance processing on the image based on the portion of the image that is close to white. However, for underwater images, since underwater image acquisition is limited by many different factors, such as light attenuation, scattering, and color distortion, the processing effect of using the white balance correction method in the prior art to process underwater images is not good.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide an underwater image enhancement method, device, non-volatile storage medium and electronic device to at least solve the technical problem that high-quality underwater images cannot be obtained because the white balance correction method in the related art is not suitable for underwater images.

[0005] According to one aspect of an embodiment of the present application, there is provided an underwater image enhancement method, comprising: determining a first reference point and a second reference point in an underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel, and a blue channel; determining a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; adjusting the grayscale value of each pixel point in the intermediate image according to the grayscale value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image.

[0006] Optionally, the first reference point is determined in the following manner: determining the components of each pixel in the underwater image on the red channel, the green channel and the blue channel; determining the deviation index value of each pixel according to the components of each pixel on the red channel, the green channel and the blue channel, wherein the deviation index value is used to reflect the relative difference between the components of each pixel on the red channel, the green channel and the blue channel, and the greater the relative difference of the pixel, the greater the deviation index value corresponding to the pixel; determining the deviation index value threshold based on the distribution of the deviation index values ​​corresponding to each pixel; and determining the pixel whose deviation index value is less than the deviation index value threshold as the first reference point.

[0007] Optionally, the second reference point is determined in the following manner: determine the components of each pixel in the underwater image on the red channel and the blue channel; determine a first threshold based on the distribution of the components of each pixel on the red channel, and determine a second threshold based on the distribution of the components of each pixel on the blue channel; and use the pixel points whose components on the red channel are greater than the first threshold and whose components on the blue channel are less than the second threshold as the second reference points.

[0008] Optionally, the first gain coefficient includes a first red gain coefficient, a first green gain coefficient and a first blue gain coefficient, and the second gain coefficient includes a second red gain coefficient, a second green gain coefficient and a second blue gain coefficient; based on the first gain coefficient and the second gain coefficient, correcting the components of the pixel points in the underwater image on each color channel includes: determining the components of each pixel point in the underwater image on the red channel, the green channel and the blue channel; determining that the result obtained by multiplying the component of the pixel point on the red channel by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient is the corrected red channel component; determining that the result obtained by multiplying the component of the pixel point on the green channel by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient is the corrected green channel component; determining that the result obtained by multiplying the component of the pixel point on the blue channel by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient is the corrected blue channel component.

[0009] Optionally, correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient includes: determining the color attenuation coefficient according to the shooting depth of the underwater image; determining that the component of the pixel point on the red channel is multiplied by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient, and the result obtained after the color attenuation coefficient is the corrected red channel component; determining that the component of the pixel point on the green channel is multiplied by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient, and the result obtained after the color attenuation coefficient is the corrected green channel component; determining that the component of the pixel point on the blue channel is multiplied by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient, and the result obtained after the color attenuation coefficient is the corrected blue channel component.

[0010] Optionally, adjusting the grayscale value of each pixel in the intermediate image according to the grayscale value distribution of each pixel in the intermediate image includes: determining a grayscale histogram of the intermediate image according to the grayscale value distribution of each pixel in the intermediate image, wherein the grayscale histogram includes the number of pixels corresponding to each grayscale value; determining a minimum non-zero grayscale value and a maximum non-zero grayscale value in the intermediate image according to the grayscale histogram; performing linear mapping processing on the grayscale value of each pixel according to the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, wherein the grayscale value of each pixel obtained after the linear mapping processing has a value range within a preset value interval, and the grayscale value interval of the intermediate image is a proper subset of the preset value interval.

[0011] Optionally, linear mapping processing is performed on the grayscale value of each pixel based on the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, including: determining a preset control parameter, wherein the preset control parameter is used to adjust the contrast enhancement degree of the target underwater image relative to the underwater image, and the larger the value of the control parameter, the smaller the contrast enhancement degree; linear mapping processing is performed on the grayscale value of each pixel based on the preset control parameter, the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel.

[0012] According to another aspect of an embodiment of the present application, an underwater image enhancement device is also provided, including: a first processing module, used to determine a first reference point and a second reference point in an underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel and a blue channel; a second processing module, used to determine a first gain coefficient corresponding to the first reference point, and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; a third processing module, used to correct the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; and a fourth processing module, used to adjust the grayscale value of each pixel point in the intermediate image according to the grayscale value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image.

[0013] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, in which a program is stored, wherein when the program is running, a device where the non-volatile storage medium is located is controlled to execute an underwater image enhancement method.

[0014] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including: a memory and a processor, the processor being configured to run a program stored in the memory, wherein the program executes an underwater image enhancement method when running.

[0015] According to another aspect of an embodiment of the present application, a computer program product is also provided, including a computer program, which implements the steps of the underwater image enhancement method when executed by a processor.

[0016] In an embodiment of the present application, a first reference point and a second reference point are determined in an underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel, and a blue channel; a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point are determined, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; based on the first gain coefficient and the second gain coefficient, the components of the pixel points in the underwater image on each color channel are corrected to obtain an intermediate image; based on the gray value distribution of each pixel point in the intermediate image, the gray value of each pixel point in the intermediate image is adjusted to obtain an enhanced target underwater image. By determining the first reference point and the second reference point and respectively determining the first gain coefficient corresponding to the first reference point and the second gain coefficient corresponding to the second reference point, and then performing white balance correction on the image according to the first gain coefficient and the second gain coefficient, the purpose of improving the white balance correction effect is achieved, thereby achieving the technical effect of improving the quality of the underwater image, and further solving the technical problem that the white balance correction method in the related art is not applicable to underwater images, resulting in the inability to obtain high-quality underwater images. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 It is a structural schematic diagram of a computer terminal (mobile terminal) provided according to an embodiment of the present application;

[0019] Figure 2 is a flow chart of an underwater image enhancement method provided according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of a process flow of an underwater image enhancement process provided according to an embodiment of the present application;

[0021] Figure 4 is a schematic diagram of enhanced underwater image comparison provided according to an embodiment of the present application;

[0022] Figure 5 It is a schematic diagram of the structure of an underwater image enhancement device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] At present, underwater image acquisition technology has become an important tool for ocean exploration and research. It plays a key role in biological research, underwater archaeology, resource development, and marine environment monitoring. However, due to the influence of water scattering and absorption, as well as the attenuation of light when propagating underwater, the underwater images obtained often have problems such as blur, low contrast, and color distortion, which seriously affects the extraction and analysis of image information. For this reason, underwater image enhancement technology has been widely studied and applied to improve image quality in order to better conduct scientific analysis and visual expression.

[0026] In the field of image enhancement, the relevant technology has provided a variety of different image enhancement technologies. For example: the Single Scale Retinex (SSR) model is mainly used to reduce the dynamic range or restore color and brightness, but its application range is limited; the Multi-Scale Retinex (MSR) algorithm estimates the lighting component by fusing the enhancement effects at different scales while taking into account local and global information; the Multi-Scale Retinex with Color Restoration (MSRCR) achieves better dynamic range compression, color consistency and brightness restoration; the Retinex algorithm improves the processing speed by adding a recursive bilateral filter to the Retinex algorithm; the reflectivity and illumination are estimated from the input image through a weighted variational model; the LIME (Low-Light Image Enhancement) algorithm accelerates the low-light image enhancement process by estimating pixel illumination and applying the Augmented Lagrangian Method (ALM) for optimization; the Low-Rank Regularized Retinex model (LR3M) The proposed robust Retinex model uses low-rank priors to reduce the noise of reflectance maps and improve the quality of low-light images. It also improves the brightness balance under non-uniform illumination by re-weighting the reflectance map.

[0027] Although the image enhancement algorithms in related technologies have made progress in many aspects, there are still some limitations. First, some algorithms are inefficient in image processing speed; second, some algorithms do not work well for different types of images; third, they are sensitive to noise and may produce noise or artifacts in enhanced images; fourth, some algorithms are not robust enough when processing images with complex lighting or irregular lighting distribution; fifth, users are required to adjust multiple parameters, which requires a certain amount of trial and optimization process; sixth, traditional enhancement technology may not be able to effectively meet the needs of color restoration, especially for underwater images with specific color distortion problems. Therefore, the image enhancement algorithms in related technologies are not suitable for enhancing underwater images.

[0028] In order to solve the above problems, relevant solutions are provided in the embodiments of the present application, which are described in detail below.

[0029] According to an embodiment of the present application, a method embodiment of an underwater image enhancement method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0030] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing an underwater image enhancement method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0031] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0032] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the underwater image enhancement in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, to achieve the above-mentioned underwater image enhancement. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0033] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0034] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0035] Under the above operating environment, the embodiment of the present application provides an underwater image enhancement method, such as Figure 2 As shown, the method comprises the following steps:

[0036] Step S202, determining a first reference point and a second reference point in the underwater image, wherein the first reference point and the second reference point have different components in each color channel, and the color channels include a red channel, a green channel, and a blue channel;

[0037] In the technical solution provided in step S202, the first reference point is determined in the following manner: determining the components of each pixel in the underwater image on the red channel, the green channel and the blue channel; determining the deviation index value of each pixel according to the components of each pixel on the red channel, the green channel and the blue channel, wherein the deviation index value is used to reflect the relative difference between the components of each pixel on the red channel, the green channel and the blue channel, and the greater the relative difference of the pixel, the greater the deviation index value corresponding to the pixel; determining the deviation index value threshold value based on the distribution of the deviation index values ​​corresponding to each pixel; and determining the pixel whose deviation index value is less than the deviation index value threshold value as the first reference point.

[0038] In some embodiments of the present application, the above-mentioned deviation index value can be determined according to the following method: first, the average value of the components of the pixel point on each channel is calculated, and then the absolute value of the difference between the component of the pixel point on each channel and the average value is determined, and the absolute values ​​on each channel are summed to obtain the above-mentioned deviation index, where a larger deviation index indicates a larger relative difference.

[0039] When determining the deviation index threshold, the deviation values ​​corresponding to each pixel point can be first arranged in order from small to large, and then the first preset proportion of deviation index values ​​are determined in the arranged deviation index value sequence, and the maximum value of the first preset proportion of deviation index values ​​is determined as the deviation index value threshold.

[0040] In some embodiments of the present application, when determining the first reference point by means of a deviation index value threshold, multiple candidate first reference points may be determined. At this time, a first reference point is randomly selected from multiple candidate first reference points, or the first reference point is designated by the staff from multiple candidate first reference points. In addition, the first reference point may be determined without using a deviation index threshold, but the pixel point with the smallest deviation index value may be directly determined as the first reference point.

[0041] As an optional implementation, the second reference point is determined in the following manner: determine the components of each pixel in the underwater image on the red channel and the blue channel; determine a first threshold based on the distribution of the components of each pixel on the red channel, and determine a second threshold based on the distribution of the components of each pixel on the blue channel; and use the pixel points whose components on the red channel are greater than the first threshold and whose components on the blue channel are less than the second threshold as the second reference points.

[0042] In some embodiments of the present application, the above-mentioned first threshold value can be determined according to the distribution and a first preset ratio (such as 10%) after determining the distribution of the components of each pixel point on the red channel in the underwater image. Specifically, the red channel components of each pixel point can be arranged in order from large to small according to the distribution of the components of each pixel point on the red channel, and then the red channel component values ​​before the first preset ratio are determined. After that, the minimum value of the red channel component values ​​before the preset ratio can be directly determined as the first threshold value.

[0043] The method for determining the second threshold is similar to that of the first threshold, except that the distribution of the components of each pixel on the green channel is arranged in order from small to large, and then the maximum value of the green channel component values ​​within the second preset proportion is determined as the second threshold.

[0044] As an optional implementation, the first reference point may be a reference point of neutral tone in the underwater image, that is, a point in the image area relatively closest to white in the underwater image, such as a background point of neutral tone such as whitish coral, white seabed beach, etc. The second reference point is a reference point of warm tone, such as a point in the image area of ​​foreground objects such as sea water under the sun or tropical fish.

[0045] Step S204, determining a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image;

[0046] In the technical solution provided in step S204, the first gain coefficient includes a first red gain coefficient, a first green gain coefficient and a first blue gain coefficient, and the second gain coefficient includes a second red gain coefficient, a second green gain coefficient and a second blue gain coefficient; based on the first gain coefficient and the second gain coefficient.

[0047] It should be noted that white balance correction is a commonly used technology in image processing to eliminate the color cast problem of images caused by different light source color temperatures. It adjusts the color distribution in the image to make the colors look real and neutral, so as to improve the quality and accuracy of the image.

[0048] White balance is the process of correcting the color shift in an image, with the goal of making white look truly white rather than being affected by other color shifts. Under natural light sources, white is usually composed of equal values ​​of the three color channels of red, green, and blue. However, due to factors such as the color temperature differences of different light sources and the color of the reflective surface, the white in the image may be affected by color shift, that is, the values ​​of the three components of R, G, and B are not equal. Through white balance processing, the color component values ​​of the image can be adjusted according to the reference white area in the image or according to a specific algorithm to achieve balance, thereby restoring the true color in the image. By processing the entire image through this white balance mapping relationship, the entire image can be made to look more natural and balanced. Assuming that the original pixel value of a channel in the image (for example, the red channel) is R, and the pixel value after white balance correction is R', the following formula can be used to represent the white balance correction process.

[0049]

[0050] Among them, G R , G G , G B R′, G′, B′ represent the pixel values ​​of the red, green, and blue channels after white balance correction. The gain coefficient is usually calculated by selecting a neutral color reference point.

[0051] The gain factor usually refers to the gain value of each channel of the image, which is used to adjust the brightness and color balance of the image. In white balance correction, the gain factor is used to correct the intensity of each color channel in the image under different light sources, so that the selected neutral color reaches the ideal neutral tone, thereby achieving the effect of white balance. The gain factor plays a vital role in white balance correction, which can help adjust the color balance of the image and ensure that the white part of the image looks real and is not affected by the light source.

[0052] In this way, white balance correction can eliminate color deviations in the image caused by different color temperatures of the light source, ensuring that the white parts of the image present a neutral and true tone. This can improve the color accuracy of the image, making it look more natural and realistic.

[0053] However, underwater image acquisition is limited by many factors, such as light attenuation, scattering, and color distortion, which often cause the image to appear blurry, dim, and unrealistic in color. The conventional white balance correction algorithm is not effective for underwater image enhancement. In order to solve this problem, the embodiment of the present application provides a method for performing bidirectional white balance correction on underwater images based on multiple reference points.

[0054] Step S206, correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image;

[0055] In the technical solution provided in step S206, the step of correcting the components of the pixel points in the underwater image on each color channel includes: determining the components of each pixel point in the underwater image on the red channel, the green channel and the blue channel; determining that the result obtained by multiplying the component of the pixel point on the red channel by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient is the corrected red channel component; determining that the result obtained by multiplying the component of the pixel point on the green channel by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient is the corrected green channel component; determining that the result obtained by multiplying the component of the pixel point on the blue channel by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient is the corrected blue channel component.

[0056] Specifically, considering the influence of various light sources, the formula for correcting the red channel component, green channel component and blue channel component of each pixel is as follows:

[0057]

[0058] In the above formula, G R,warm and G R,cold Respectively represent the second red gain coefficient and the first red gain coefficient, G G,warm and G G,cold Respectively represent the second green gain coefficient and the first green gain coefficient, G B,warm and G B,cold They represent the second blue gain coefficient and the first blue gain coefficient respectively.

[0059] As an optional implementation, the step of correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient includes: determining the color attenuation coefficient according to the shooting depth of the underwater image; determining that the component of the pixel point on the red channel is multiplied by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient, and the result obtained after the color attenuation coefficient is the corrected red channel component; determining that the component of the pixel point on the green channel is multiplied by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient, and the result obtained after the color attenuation coefficient is the corrected green channel component; determining that the component of the pixel point on the blue channel is multiplied by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient, and the result obtained after the color attenuation coefficient is the corrected blue channel component.

[0060] Specifically, considering that there is color attenuation in underwater images, for blurry and poorly illuminated images taken underwater, an attenuation coefficient can be introduced to eliminate this effect. The specific formula is as follows:

[0061]

[0062] In the above formula, AF represents the color attenuation coefficient, which is used to correct the color attenuation caused by the depth of underwater image shooting, and its value range is any non-zero number between 0 and 10. And there is a positive correlation between the value of the color attenuation coefficient and the depth, that is, the deeper the shooting depth of the underwater image, the greater the corresponding color attenuation coefficient. By introducing multiple gain coefficients and color attenuation coefficients, it is possible to better adapt to the unique light environment and color distortion problems of underwater photography, thereby improving the color reproduction and quality of the image.

[0063] And through the above-mentioned method, the influence of multiple light sources is comprehensively considered in the process of underwater image correction. Traditional white balance correction usually corrects the color temperature of a single light source. The method provided in the embodiment of the present application takes into account two common light sources in underwater photography, one is blue natural light, and the other is warm light from scattering. Therefore, in the case of underwater shooting, the two-way white balance correction method provided in the embodiment of the present application can better cope with the situation of mixed light sources.

[0064] Regarding the problem of color attenuation, in an underwater environment, as the depth increases, light of different colors will attenuate at different speeds, resulting in color deviation in the image. The bidirectional white balance correction algorithm provided in the embodiment of the present application can take this color attenuation phenomenon into account, and more accurately perform color correction by comprehensively considering reference points of different tones. In addition, the method of bidirectional white balance correction provided in the embodiment of the present application can also be combined with other image enhancement technologies, such as defogging algorithms, color correction, etc., to better improve image quality, enhance details, and make the processed image clearer and more realistic.

[0065] In summary, the bidirectional white balance correction method provided in the embodiment of the present application has been improved in underwater image processing compared to the traditional white balance correction algorithm, and can better adapt to the lighting environment and color distortion problems unique to underwater photography, thereby improving the color reproduction and quality of the image.

[0066] Step S208, adjusting the grayscale value of each pixel in the intermediate image according to the grayscale value distribution of each pixel in the intermediate image to obtain an enhanced target underwater image.

[0067] In the technical solution provided in step S208, adjusting the grayscale value of each pixel in the intermediate image according to the grayscale value distribution of each pixel in the intermediate image includes: determining the grayscale histogram of the intermediate image according to the grayscale value distribution of each pixel in the intermediate image, wherein the grayscale histogram includes the number of pixels corresponding to each grayscale value; determining the minimum non-zero grayscale value and the maximum non-zero grayscale value in the intermediate image according to the grayscale histogram; performing linear mapping processing on the grayscale value of each pixel according to the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, wherein the grayscale value of each pixel obtained after the linear mapping processing has a value range within a preset value interval, and the grayscale value interval of the intermediate image is a proper subset of the preset value interval.

[0068] In some embodiments of the present application, grayscale information can be extracted from the intermediate image, and the grayscale histogram of the image can be calculated, that is, the number of pixels of each grayscale value in the image is counted. Then, the minimum and maximum non-zero grayscale values ​​in the histogram are determined. Next, the grayscale values ​​between the minimum and maximum non-zero grayscale values ​​are linearly mapped using a stretching function, thereby remapping the entire grayscale value range to between 0 and 255.

[0069] In some embodiments of the present application, the step of linearly mapping the grayscale value of each pixel point based on the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel point includes: determining a preset control parameter, wherein the preset control parameter is used to adjust the contrast enhancement degree of the target underwater image relative to the underwater image, and the larger the value of the control parameter, the smaller the contrast enhancement degree; linearly mapping the grayscale value of each pixel point based on the preset control parameter, the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel point.

[0070] Specifically, in the embodiment of the present application, the process of performing linear mapping processing on the grayscale value of each pixel point includes the following steps:

[0071] Step 1: Calculate the grayscale histogram of the intermediate image to obtain the number of pixels of each grayscale value in the original image;

[0072] Step 2: Find the minimum and maximum non-zero grayscale values ​​in the histogram, and find the first non-zero grayscale value and the last non-zero grayscale value by scanning the histogram array;

[0073] Step 3: Use a linear stretching function to remap the grayscale values ​​between the minimum and maximum non-zero grayscale values ​​to between 0 and 255. For the input grayscale value g, the calculation formula for the stretched value g' is as follows:

[0074]

[0075] Among them, min is the minimum non-zero grayscale value, and max is the maximum non-zero grayscale value.

[0076] Specifically, the calculation formula after introducing the control parameters is as follows:

[0077]

[0078] In the above formula, C is a control parameter used to limit the stretching amplitude and the degree of contrast enhancement. When C is large, the stretching amplitude will decrease, thereby limiting the contrast enhancement and retaining more detail information. Conversely, when C is small, the stretching amplitude will increase and the contrast enhancement effect will be stronger. By adjusting the value of parameter C (usually between 0.1 and 10), the relationship between contrast enhancement and detail retention can be balanced according to specific needs. A larger C value can be used to control detail retention during contrast enhancement, which is more suitable for images with rich light and dark details; a smaller C value can be used to obtain a stronger contrast enhancement effect, which is more suitable for images that need to enhance the overall contrast.

[0079] Step 4: Replace the gray value of each pixel value of the image, and replace the gray value of each pixel according to g′ obtained by the above calculation.

[0080] The histogram stretching algorithm can enhance the contrast of the image, make the details of the image more prominent, and expand the grayscale range of the image. In addition, the histogram stretching does not change the content or details of the image, but only increases the contrast by redistributing the grayscale values.

[0081] After the image is stretched with histogram, the following effects can be achieved:

[0082] Strong contrast: Histogram stretching expands the grayscale value range of the image by linearly mapping the grayscale values ​​between the minimum and maximum non-zero grayscale values. This can make the grayscale values ​​that are originally similar in the image have a larger difference after stretching, thereby enhancing the contrast of the image. The details in the image will be more obvious and the boundaries between objects will be clearer.

[0083] Expanding the grayscale range: Histogram stretching remaps the grayscale value range of the entire image to between 0 and 255, thereby expanding the grayscale range of the image. This means that the originally dark areas will become brighter, and the originally brighter areas will become darker, so that the image has richer information at different grayscale values.

[0084] Emphasize details: Since histogram stretching enhances the contrast of the image, the details in the image will stand out more. The details in the dark and bright areas will become clearer, and subtle changes in the image will be easier to observe.

[0085] Improve visual effects: Histogram stretching can make images brighter and more vivid, with richer color and light and dark changes, thereby improving the visual effects of images.

[0086] In summary, the underwater image enhancement flow chart provided in the embodiment of the present application is Figure 3 As shown, the following steps are included:

[0087] Step S302, performing bidirectional white balance correction on the original underwater image;

[0088] Step S304: performing histogram stretching processing on the corrected image.

[0089] In some embodiments of the present application, in order to verify the technical effect of the underwater image enhancement method provided by the present application relative to other methods in the prior art, a comparative test is provided in which various methods are run in the same elastic cloud host to process underwater images and compare the processing effects. The hardware specifications are 8-core CPU, 16GB memory, 500GB object storage cloud hard disk mounted, the operating system is CentOS 7.9, and the bandwidth size is 20Mbps. The algorithm part of this method is written in Python, and the compilation environment is OpenCV+Pytorch. The software solution of this method is implemented through a Java-based Spring Boot 2 application, and the operating environment settings include JDK 1.8, Apache Maven 3.8.5, and Apache Tomcat 10.0.18.

[0090] In addition, in order to analyze the experimental results, a web application can also be developed using the JetBrains-IntelliJ-IDEA2021.3 platform, and the underwater image enhancement method provided in the embodiment of the present application is included in the application. The web application runs in the cloud environment of Tianyi Cloud Network Service, encapsulates the algorithm into a web module, and opens the interface. Call the HTTP network request on the local computer, transfer the local data set to the cloud server through the interface program, and verify the method results.

[0091] In order to verify the effectiveness of the algorithm in an actual underwater environment, the experiment used a classic underwater image processing data set. These types of pictures contain comprehensive colors and types and are suitable as original images for underwater image processing algorithms.

[0092] In the comparative experiment, the related technical methods used include the MSR algorithm, MSRCP algorithm, LIME algorithm and other currently mainstream machine learning image enhancement algorithms.

[0093] In the comparative test, the underwater images used and the processing results of each method are shown in the figure below. Figure 4 As shown. Figure 4 It can be seen from the figure that this group of images includes 6 types of images, namely people, fish, and corals, for visual effect analysis. Figure 4 It can be seen from the visual effect analysis results that various underwater image enhancement methods can improve the image quality for underwater images with poor shooting effects and blurred image quality. Among them, the MSR algorithm greatly retains the color of the original image, but the image is still relatively blurred, and the enhancement effect is not good for images with foreground objects. The MSRCR algorithm can highlight the front object and improve the enhancement effect, but it affects the color of the original image, resulting in color difference, and does not achieve the enhancement effect for static objects such as corals. When enhancing the image, the LIME algorithm highlights the dynamic objects while retaining the original color of the image, and improves the contrast of the image to a certain extent, but the effect is not obvious and there is a slight halo phenomenon, and the contrast of the dark area of ​​the static image is not obvious and the brightness is low. The method provided in the embodiment of the present application distinguishes the foreground object and the background on the basis of retaining the original color of the image, performs specific enhancement on the foreground and dynamic objects, corrects the color distortion in the image, improves the image quality, and at the same time increases the contrast and brightness to avoid overexposure, thereby achieving effective enhancement of underwater images.

[0094] That is to say, compared with the methods in the related art, the underwater image enhancement method provided in the embodiment of the present application can make the processed underwater image appear clearer and more natural to the human eye.

[0095] In order to further demonstrate the superiority of this application, the following objective indicators were selected in the comparative experiment to evaluate the processing results:

[0096] Peak Signal-to-Noise Ratio (PSNR): This metric reveals the level of distortion produced by the image enhancement operation compared to the original ideally illuminated image. An increase in PSNR value indicates less distortion, representing an improvement in image quality.

[0097] Structural Similarity Index (SSIM): It is used to evaluate the consistency of the structural characteristics of the enhanced image with the original image. The increase in the SSIM value indicates that the structures of the two images are closer.

[0098] Tone Mapping Quality Indicator (TMQI): Based on the principle of SSIM, this indicator evaluates whether the color of the enhanced image remains consistent with the original image. A high value of TMQI indicates good color consistency, so the image quality is improved.

[0099] No-Reference Image Quality Assessment (NIQE): This metric is based on a model of natural scene statistics and evaluates images using a set of quality-aware statistical properties. A lower NIQE value indicates that the image quality is closer to the visual preferences of the human eye.

[0100] Perceptual Contrast Quality Index (PCQI): This is an image quality evaluation method that focuses on local areas. By evaluating local contrast, a high PCQI value indicates that better contrast is obtained during image enhancement, improving image quality.

[0101] Luminance Order Error (LOE): This method determines the natural properties of an image based on the relative order of the luminance sequence, which is critical for characterizing the direction and changes of lighting. Lower LOE values ​​indicate smaller luminance errors and more natural images.

[0102] The comparison results of various evaluation indicators of the underwater image enhancement method provided in the embodiment of the present application and the method in the related art are shown in the following table:

[0103]

[0104] It can be seen from the above table that the method provided in the embodiment of the present application is superior to other algorithms in multiple performance indicators when enhancing underwater images.

[0105] In summary, by determining a first reference point and a second reference point in an underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel, and a blue channel; determining a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; adjusting the grayscale value of each pixel point in the intermediate image according to the grayscale value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image, by determining the first reference point and the second reference point and respectively determining the first gain coefficient corresponding to the first reference point and the second gain coefficient corresponding to the second reference point, and then performing white balance correction on the image according to the first gain coefficient and the second gain coefficient, the purpose of improving the white balance correction effect is achieved, thereby achieving the technical effect of improving the quality of the underwater image, and further solving the technical problem that the white balance correction method in the related art is not suitable for underwater images, resulting in the inability to obtain high-quality underwater images.

[0106] In addition, the underwater image enhancement method provided in the embodiment of the present application has the following advantages compared with the related art:

[0107] The method provided in the embodiment of the present application selects two reference color points to achieve bidirectional white balance correction. This method takes into account the common mixed light source problem in underwater shooting and the color deviation caused by different light attenuation speeds, ensuring more accurate and natural correction of color temperature and color attenuation. This bidirectional correction technology is innovative and practical in the field of underwater image enhancement, and can effectively solve the limitations of a single white balance correction method when dealing with complex underwater lighting conditions.

[0108] The method provided in the embodiment of the present application performs more reasonable mapping and adjustment on the grayscale value of the image, which not only improves the contrast of the image, but also enhances the details and clarity. Compared with the traditional histogram stretching method, the method more effectively enhances the image quality while maintaining the natural visual effect of the image.

[0109] The method provided in the embodiment of the present application combines bidirectional white balance correction with improved histogram stretching technology to achieve comprehensive enhancement of underwater images. From the experimental results, the proposed method can significantly improve the color reproduction, contrast and detail clarity of underwater images, showing better performance than the existing technology.

[0110] According to an embodiment of the present application, an underwater image enhancement device is also provided. Figure 5 is a schematic diagram of the structure of the device. Figure 5It can be seen that the device includes: a first processing module 50, used to determine a first reference point and a second reference point in the underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel and a blue channel; a second processing module 52, used to determine a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; a third processing module 54, used to correct the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; a fourth processing module 56, used to adjust the gray value of each pixel point in the intermediate image according to the gray value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image.

[0111] In some embodiments of the present application, the first reference point is determined by the first processing module 50 in the following manner: determining the components of each pixel in the underwater image on the red channel, the green channel, and the blue channel; determining the deviation index value of each pixel according to the components of each pixel on the red channel, the green channel, and the blue channel, wherein the deviation index value is used to reflect the relative difference between the components of each pixel on the red channel, the green channel, and the blue channel, and the greater the relative difference of the pixel, the greater the deviation index value corresponding to the pixel; determining the deviation index value threshold value based on the distribution of the deviation index values ​​corresponding to each pixel; and determining the pixel whose deviation index value is less than the deviation index value threshold value as the first reference point.

[0112] In some embodiments of the present application, the second reference point is determined by the first processing module 50 in the following manner: determining the components of each pixel in the underwater image on the red channel and the blue channel; determining a first threshold based on the distribution of the components of each pixel on the red channel, and determining a second threshold based on the distribution of the components of each pixel on the blue channel; and taking the pixel points whose components on the red channel are greater than the first threshold and whose components on the blue channel are less than the second threshold as the second reference points.

[0113] In some embodiments of the present application, the first gain coefficient includes a first red gain coefficient, a first green gain coefficient and a first blue gain coefficient, and the second gain coefficient includes a second red gain coefficient, a second green gain coefficient and a second blue gain coefficient; the step in which the third processing module 54 corrects the components of the pixels in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient includes: determining the components of each pixel in the underwater image on the red channel, the green channel and the blue channel; determining that the result obtained by multiplying the component of the pixel on the red channel by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient is the corrected red channel component; determining that the result obtained by multiplying the component of the pixel on the green channel by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient is the corrected green channel component; determining that the result obtained by multiplying the component of the pixel on the blue channel by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient is the corrected blue channel component.

[0114] In some embodiments of the present application, the step in which the third processing module 54 corrects the components of the pixel points in the underwater image on each color channel based on the first gain coefficient and the second gain coefficient includes: determining the color attenuation coefficient based on the shooting depth of the underwater image; determining that the component of the pixel point on the red channel is multiplied by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient, and the result obtained after the color attenuation coefficient is the corrected red channel component; determining that the component of the pixel point on the green channel is multiplied by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient, and the result obtained after the color attenuation coefficient is the corrected green channel component; determining that the component of the pixel point on the blue channel is multiplied by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient, and the result obtained after the color attenuation coefficient is the corrected blue channel component.

[0115] In some embodiments of the present application, the fourth processing module 56 adjusts the grayscale value of each pixel in the intermediate image according to the grayscale value distribution of each pixel in the intermediate image, and the steps include: determining the grayscale histogram of the intermediate image according to the grayscale value distribution of each pixel in the intermediate image, wherein the grayscale histogram includes the number of pixels corresponding to each grayscale value; determining the minimum non-zero grayscale value and the maximum non-zero grayscale value in the intermediate image according to the grayscale histogram; performing linear mapping processing on the grayscale value of each pixel according to the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, wherein the grayscale value of each pixel obtained after the linear mapping processing has a value range within a preset value interval, and the grayscale value range of the intermediate image is a proper subset of the preset value interval.

[0116] In some embodiments of the present application, the fourth processing module 56 performs linear mapping processing on the grayscale value of each pixel based on the minimum non-zero grayscale value and the maximum non-zero grayscale value, as well as the grayscale value of each pixel, the step comprising: determining a preset control parameter, wherein the preset control parameter is used to adjust the contrast enhancement degree of the target underwater image relative to the underwater image, and the larger the value of the control parameter, the smaller the contrast enhancement degree; performing linear mapping processing on the grayscale value of each pixel based on the preset control parameter, the minimum non-zero grayscale value and the maximum non-zero grayscale value, as well as the grayscale value of each pixel.

[0117] It should be noted that the various modules in the above-mentioned underwater image enhancement device can be program modules (for example, a set of program instructions for implementing a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.

[0118] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the following underwater image enhancement method: determining a first reference point and a second reference point in the underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel and a blue channel; determining a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; correcting the components of the pixel points in the underwater image on each color channel based on the first gain coefficient and the second gain coefficient to obtain an intermediate image; adjusting the grayscale value of each pixel point in the intermediate image based on the grayscale value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image.

[0119] According to another aspect of an embodiment of the present application, an electronic device is also provided, including: a memory and a processor, the processor being used to run a program stored in the memory, wherein the following underwater image enhancement method is executed when the program is run: determining a first reference point and a second reference point in an underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel, and a blue channel; determining a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; correcting the components of the pixel points in the underwater image on each color channel based on the first gain coefficient and the second gain coefficient to obtain an intermediate image; adjusting the grayscale value of each pixel point in the intermediate image based on the grayscale value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image.

[0120] According to another aspect of an embodiment of the present application, a computer program product is also provided, including a computer program, which implements the steps of the underwater image enhancement method when executed by a processor: determining a first reference point and a second reference point in an underwater image, wherein the components of the first reference point and the second reference point on each color channel are not completely the same, and the color channels include a red channel, a green channel, and a blue channel; determining a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; correcting the components of the pixel points in the underwater image on each color channel based on the first gain coefficient and the second gain coefficient to obtain an intermediate image; adjusting the grayscale value of each pixel point in the intermediate image based on the grayscale value distribution of each pixel point in the intermediate image to obtain an enhanced target underwater image.

[0121] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0122] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0124] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0126] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for underwater image enhancement, characterized in that: include: Determine a first reference point and a second reference point in the underwater image, wherein the first reference point and the second reference point have different components on various color channels, and the color channels include a red channel, a green channel, and a blue channel; Determine a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; Correcting the components of the pixels in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; According to the gray value distribution of each pixel in the intermediate image, the gray value of each pixel in the intermediate image is adjusted to obtain an enhanced target underwater image.

2. The underwater image enhancement method according to claim 1, characterized in that: The first reference point is determined by: Determine the components of each pixel in the underwater image on the red channel, the green channel and the blue channel; Determine a deviation index value of each pixel point according to the components of each pixel point on the red channel, the green channel, and the blue channel, wherein the deviation index value is used to reflect the relative difference between the components of each pixel point on the red channel, the green channel, and the blue channel, and the greater the relative difference of the pixel point, the greater the deviation index value corresponding to the pixel point; Determining a deviation index value threshold value according to the distribution of the deviation index values ​​corresponding to the respective pixel points; A pixel point among the pixel points whose deviation index value is less than the deviation index value threshold is determined as the first reference point.

3. The underwater image enhancement method according to claim 1, characterized in that: The second reference point is determined by: Determine the components of each pixel in the underwater image on the red channel and the blue channel; Determine a first threshold value according to the distribution of the components of each pixel point on the red channel, and determine a second threshold value according to the distribution of the components of each pixel point on the blue channel; A pixel point among the pixels whose component on the red channel is greater than the first threshold and whose component on the blue channel is less than the second threshold is used as the second reference point.

4. The underwater image enhancement method according to claim 1, characterized in that: The first gain coefficient includes a first red gain coefficient, a first green gain coefficient and a first blue gain coefficient, and the second gain coefficient includes a second red gain coefficient, a second green gain coefficient and a second blue gain coefficient; and correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient includes: Determine the components of each pixel in the underwater image on the red channel, the green channel and the blue channel; Determine that a result obtained by multiplying a component of the pixel point on the red channel by the inverse of the first red gain coefficient and the inverse of the second red gain coefficient is a corrected red channel component; Determine that a result obtained by multiplying a component of the pixel point on the green channel by the inverse of the first green gain coefficient and the inverse of the second green gain coefficient is a corrected green channel component; It is determined that a result obtained by multiplying a component of the pixel point on the blue channel by the inverse of the first blue gain coefficient and the inverse of the second blue gain coefficient is a corrected blue channel component.

5. The underwater image enhancement method according to claim 4, characterized in that: Correcting the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient includes: Determining a color attenuation coefficient according to a shooting depth of the underwater image; Determine that a result obtained by multiplying a component of the pixel point on the red channel by the inverse of the first red gain coefficient, the inverse of the second red gain coefficient, and the color attenuation coefficient is a corrected red channel component; Determine that a result obtained by multiplying a component of the pixel point on the green channel by the inverse of the first green gain coefficient, the inverse of the second green gain coefficient, and the color attenuation coefficient is a corrected green channel component; Determine that a result obtained by multiplying a component of the pixel point on the blue channel by the inverse of the first blue gain coefficient, the inverse of the second blue gain coefficient, and the color attenuation coefficient is a corrected blue channel component.

6. The underwater image enhancement method according to claim 1, characterized in that: Adjusting the grayscale value of each pixel in the intermediate image according to the grayscale value distribution of each pixel in the intermediate image includes: Determine a grayscale histogram of the intermediate image according to the grayscale value distribution of each pixel in the intermediate image, wherein the grayscale histogram includes the number of pixels corresponding to each grayscale value; Determining a minimum non-zero grayscale value and a maximum non-zero grayscale value in the intermediate image according to the grayscale histogram; Based on the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, linear mapping processing is performed on the grayscale value of each pixel, wherein the grayscale value of each pixel after linear mapping processing has a value range within a preset value interval, wherein the grayscale value interval of the intermediate image is a proper subset of the preset value interval.

7. The underwater image enhancement method according to claim 6, characterized in that: According to the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, performing linear mapping processing on the grayscale value of each pixel comprises: Determining a preset control parameter, wherein the preset control parameter is used to adjust the contrast enhancement degree of the target underwater image relative to the underwater image, and the greater the value of the control parameter, the smaller the contrast enhancement degree; According to the preset control parameter, the minimum non-zero grayscale value and the maximum non-zero grayscale value, and the grayscale value of each pixel, a linear mapping process is performed on the grayscale value of each pixel.

8. An underwater image enhancement device, characterized in that: include: A first processing module, configured to determine a first reference point and a second reference point in the underwater image, wherein the first reference point and the second reference point have different components on various color channels, and the color channels include a red channel, a green channel, and a blue channel; a second processing module, configured to determine a first gain coefficient corresponding to the first reference point and a second gain coefficient corresponding to the second reference point, wherein the first gain coefficient and the second gain coefficient are used to perform white balance correction on the underwater image; A third processing module, configured to correct the components of the pixel points in the underwater image on each color channel according to the first gain coefficient and the second gain coefficient to obtain an intermediate image; The fourth processing module is used to adjust the gray value of each pixel in the intermediate image according to the gray value distribution of each pixel in the intermediate image to obtain an enhanced target underwater image.

9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute the underwater image enhancement method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the program executes the underwater image enhancement method described in any one of claims 1 to 7 when running.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the underwater image enhancement method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Image white balance method, electronic equipment and readable storage medium

    CN117221506A

  • Underwater image enhancement method

    CN118134816A

  • Color signal processing circuit, processing method therefor and camera system

    JP1999331854A