Image white balance correction method and device and electronic equipment

By performing image segmentation and estimation of light source color value on underwater images, the problem of underwater image color shift is solved, and more accurate color restoration of underwater image is achieved.

CN119485041APending Publication Date: 2025-02-18VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411548557.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-18

Smart Images

  • Figure CN119485041A_ABST
    Figure CN119485041A_ABST
Patent Text Reader

Abstract

The invention discloses an image white balance correction method and device and electronic equipment, and belongs to the field of image processing. The method comprises the following steps: carrying out image segmentation on an underwater image to obtain a main body image and a water body image; estimating a light source color value corresponding to the water body image based on a water body color gamut corresponding to the water body image; estimating a light source color value corresponding to the main body image based on the pixel value of the main body image; and performing white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main body image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and specifically relates to an image white balance correction method, device and electronic equipment. Background Art

[0002] With the development of hobbies such as swimming and diving, and the increasing demand for exploring underwater things, the demand for underwater photography is increasing. However, due to the dark light underwater and the low light transmittance of water, underwater images obtained by underwater photography often have overall color cast, causing the captured scenes to lose their original true colors, thus failing to accurately reflect the actual appearance of the underwater world.

[0003] In the related art, the solution used to perform white balance correction on shore images is mainly used to correct underwater images to restore the colors of underwater scenes. However, since the optical properties of water are significantly different from those of air, the underwater images after white balance correction on shore images still have a large color cast. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide an image white balance correction method, device and electronic device, which obtains a main image and a water body image by performing image segmentation on an underwater image; estimates the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image; estimates the light source color value corresponding to the main image based on the pixel value of the main image; and performs white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image. According to the embodiments of the present application, the light source color value of the water body image and the light source color value of the main image are estimated respectively, which improves the accuracy of the light source color value. In this way, white balance correction is performed on the underwater image based on the estimated light source color value, which can reduce the overall color deviation of the underwater image, thereby improving the accuracy of color restoration of the underwater image.

[0005] In a first aspect, an embodiment of the present application provides an image white balance correction method, comprising:

[0006] Perform image segmentation on the underwater image to obtain the main image and the water body image;

[0007] Based on the water body color gamut corresponding to the water body image, the light source color value corresponding to the water body image is estimated;

[0008] Based on the pixel value of the subject image, estimate the light source color value corresponding to the subject image;

[0009] Based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image, the underwater image is corrected for white balance.

[0010] In a second aspect, an embodiment of the present application provides an image white balance correction device, comprising:

[0011] An image segmentation module is used to segment the underwater image to obtain a main body image and a water body image;

[0012] An estimation module, used for estimating a light source color value corresponding to the water body image based on a water body color gamut corresponding to the water body image;

[0013] The estimation module is further used to estimate the light source color value corresponding to the subject image based on the pixel value of the subject image;

[0014] The correction module is used to perform white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0016] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0017] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0018] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.

[0019] In an embodiment of the present application, an underwater image is segmented to obtain a main image and a water body image; based on the water color gamut corresponding to the water body image, the light source color value corresponding to the water body image is estimated; based on the pixel value of the main image, the light source color value corresponding to the main image is estimated; based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image, the underwater image is white-balanced. According to an embodiment of the present application, the light source color value of the water body image and the light source color value of the main image are estimated respectively, which improves the accuracy of the light source color value. In this way, white-balance correction is performed on the underwater image based on the estimated light source color value, which can reduce the overall color deviation of the underwater image, thereby improving the accuracy of color restoration of the underwater image. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0021] Figure 2 is a schematic diagram of an underwater image provided by some embodiments of the present application;

[0022] Figure 3 is a schematic diagram of an underwater image provided by some embodiments of the present application;

[0023] Figure 4 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0024] Figure 5 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0025] Figure 6 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0026] Figure 7 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0027] Figure 8 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0028] Fig. 9 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0029] Fig.10 is a flowchart of an image white balance correction method provided by some embodiments of the present application;

[0030] Fig.11 is a schematic diagram of the structure of an image white balance correction device provided in some embodiments of the present application;

[0031] Fig.12 is a block diagram of an electronic device provided by some embodiments of the present application;

[0032] Fig.13 It is a schematic diagram of the structure of an electronic device provided in some embodiments of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0034] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0035] To facilitate understanding, the professional terms in the embodiments of the present application are first explained.

[0036] ISP: image signal processing, image signal processing process, the processing process from the camera sensor response value to the image that can be displayed.

[0037] AWB: auto white balance, automatic white balance, is a key step in the ISP process. White balance correction is an important concept in photography and image processing. Its purpose is to make white objects appear truly white in the image under different lighting conditions.

[0038] Color gamut: gamut is a complete subset of colors, representing a color range. In the embodiment of the present application, the color gamut of a water body refers to a set of possible water body colors that may appear in the shooting environment.

[0039] HSV color space: consists of three components: Hue, Saturation and Value. Hue: indicates the type of color, such as red, yellow, blue, etc., and the value range is usually 0° to 360°. Saturation: indicates the purity of the color, that is, the brightness of the color. The higher the saturation, the brighter the color; the lower the saturation, the darker the color. The value range is usually 0% to 100%. Value: indicates the brightness of the color. The higher the value, the brighter the color; the lower the value, the darker the color. The value range is usually 0% to 100%.

[0040] Compared with air, water has lower transmittance and absorbs longer-wave light more than shorter-wave light, causing the water to be bluish-green, hazy, and have lower clarity. When performing white balance correction on underwater images, if only the color cast of the subject is completely corrected, the water will be grayish, weakening the underwater atmosphere; if only the color cast of the water is completely corrected, the subject will be colored. In view of this, an image white balance correction method provided in an embodiment of the present application estimates the light source color values ​​corresponding to the water body and subject in an underwater image, respectively, and performs complete color correction on both the subject and the water body of the underwater image based on the estimated light source color values, thereby reducing the overall color cast of the underwater image and improving the accuracy of color restoration of the underwater image.

[0041] It should be noted that the image white balance correction method provided in the embodiment of the present application can be executed by an electronic device, including but not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a car computer, etc. In the embodiment of the present application, the image white balance correction method provided in the embodiment of the present application is described by taking the execution of the image white balance correction method by an electronic device as an example.

[0042] The image white balance correction method provided in the embodiment of the present application can be applied to underwater image correction scenarios. Underwater images refer to images captured by an imaging device underwater. Underwater images include but are not limited to images captured underwater by users or machine devices in the fields of scientific research, military technology, sports, entertainment, teaching, etc. Underwater includes but is not limited to parts of water bodies such as oceans, lakes, rivers, and swimming pools. Among them, one specific application scenario is to correct the user's diving images captured by the user while diving, and another specific application scenario is to correct the images of shipwreck relics captured during underwater archaeology.

[0043] See also Figure 1 , is a flow chart of an image white balance correction method provided in some embodiments of the present application, such as Figure 1 As shown, the image white balance correction method includes steps 110 to 140, which are described in detail below.

[0044] Step 110: Segment the underwater image to obtain a main body image and a water body image.

[0045] Here, the underwater image can be any underwater image that needs white balance correction in the image storage application of the electronic device, wherein the image storage application can be, for example, an album App (Application), a gallery App, a camera App, an image processing software, etc. Each underwater image includes a water body and a subject, and the water body refers to pure water and various substances dissolved in the water, suspended tiny particles, etc. For example, the water body of an underwater image taken in seawater includes pure seawater, salt contained in the seawater, various plankton, tiny silt particles, etc.; the water body of an underwater image taken in freshwater includes pure freshwater and some algae and microorganisms in the freshwater, and soil particles suspended due to water flow agitation, etc. The subject refers to the main object to be highlighted in the underwater image, which can be a person or various underwater creatures, such as fish, corals, seaweed, etc.; it can also be a man-made object, such as a shipwreck, underwater ruins, diving equipment, etc.

[0046] For example, Figure 2 As shown, an underwater image is taken as a user diving image 200 taken when the user is diving as an example, wherein the subjects are the user 210 and the fish 220 , and the water body is the remaining part of the user diving image 200 except the user 210 and the fish 220 .

[0047] For example, Figure 3 As shown, taking the underwater image of a shipwreck relic image 300 obtained by underwater archaeology as an example, the main body is a shipwreck 310, and the water body is the remaining part of the shipwreck relic image 300 except the shipwreck 310.

[0048] In some embodiments of the present application, when the electronic device performs white balance correction on the underwater image, it performs image segmentation on the underwater image, and divides the underwater image into a water body image and a subject image, wherein the subject image refers to the image of the area where the subject is located in the underwater image, and the water body image refers to the image of the area where the water body is located in the underwater image.

[0049] For example, Figure 2 As shown, taking the user diving image 200 taken when the user is diving as an example, the main image in the user diving image 200 is the image of the area where the user 210 and the fish 220 are located, and the water body image is the image of the area where the remaining parts except the user 210 and the fish 220 are located.

[0050] For example, Figure 3 As shown, taking the underwater image of a shipwreck ruins image 300 taken during underwater archaeology as an example, the main image in the shipwreck ruins image 300 is the image of the area where the shipwreck 310 is located, and the water body image is the image of the area where the remaining part except the shipwreck 310 is located.

[0051] In some embodiments of the present application, the electronic device can perform image segmentation on the underwater image by using a preset image segmentation algorithm or image segmentation model, thereby segmenting the underwater image into a water body image and a main body image. Exemplarily, the image segmentation algorithm includes but is not limited to a threshold-based segmentation algorithm, an edge detection-based segmentation algorithm, a region-based segmentation algorithm, etc. The image segmentation model includes but is not limited to a fully convolutional neural network, U-Net, DeepLab series, Mask R-CNN, etc.

[0052] In some embodiments of the present application, before executing the above step 110, the underwater image may be preprocessed, and then the preprocessed underwater image may be segmented in the above step 110. The preprocessing includes but is not limited to bad pixel subtraction, black level subtraction, lens shading correction, anti-mosaic, etc. By preprocessing the underwater image, the integrity, resolution and detail richness of the underwater image may be improved, and the color accuracy of the underwater image may be enhanced.

[0053] Step 120: Estimate the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image.

[0054] Because different light sources have different color temperatures, for example, the color temperature of daylight is about 5500K-6500K, while the color temperature of tungsten lamps may be around 2700K-0K. Different color temperatures result in different light source color values. In white balance correction, the color balance of the image needs to be adjusted according to the light source color value. Therefore, when performing white balance correction on underwater images, it is necessary to estimate the light source color value. Due to the different physical properties of the water body and the subject in the underwater image, their use and reflection of light will also be different, resulting in different final lighting effects. Therefore, there are usually differences in the lighting conditions of the subject image and the water body image. If a unified light source color value estimation is performed on the entire underwater image, it may not be possible to obtain an accurate light source color value, thereby failing to accurately restore the true color of each part. Therefore, in this embodiment, the light source color value estimation is performed on the water body image and the subject image respectively, so that it can better adapt to this complex lighting environment and improve the accuracy of color.

[0055] The water color gamut refers to a set of possible water color compositions that may appear in a shooting environment. Because the spectral power distribution of the light source affects the water's ability to perceive and reproduce color, the light source color value will affect the water color gamut. For example, because daylight and fluorescent lamps have different spectral power distributions, the water color under daylight is different from the water color under fluorescent lamps, and has different water color gamuts. It can be seen that the water color gamut and the light source color value are closely related. Based on this, in this embodiment, the light source color value corresponding to the water image is derived based on the water color gamut corresponding to the water image, so that the light source color value corresponding to the water image can be quickly and accurately determined. Among them, the water color gamut corresponding to the water image refers to the water color gamut corresponding to the shooting position of the water image.

[0056] Step 130: Based on the pixel values ​​of the subject image, estimate the light source color value corresponding to the subject image.

[0057] Here, the pixel value of the main image refers to the pixel value of each pixel in the main image. The pixel value of the image is represented based on a specific color space, such as the RGB (red, green, blue) color space. In the RGB color space, each pixel is composed of the intensity values ​​of the three channels of red, green, and blue, and the range of these values ​​is usually 0-255. The combination of these channel intensity values ​​determines the color presented by the pixel points in the image. It can be seen that the pixel value of the main image can characterize the color of the subject, and the color of the subject is the result of the combined effect of the color value of the light source illuminating the subject and the reflection characteristics of the subject itself. Based on this, in this embodiment, the color value of the light source corresponding to the main image is estimated based on the pixel value of the main image. In this way, the color value of the light source corresponding to the main image can be quickly and easily estimated without the need for additional complex equipment or sensors.

[0058] In some embodiments of the present application, the electronic device can use a color constancy algorithm to estimate the color value of the light source corresponding to the main image based on the pixel value of the main image. The color constancy algorithm can more accurately understand and analyze the color information in the image when processing images under different lighting conditions. The color constancy algorithm aims to maintain the constancy of the color of the object, and people's perception of the color of the object remains unchanged even when the lighting conditions change. This type of algorithm estimates the color value of the light source by analyzing the color distribution and pixel values ​​in the image. This method has no restrictions on the material and surface texture of the object and can effectively estimate the color value of the light source. When estimating the color value of the light source corresponding to the main image by the color constancy algorithm, the average color value, color distribution and other features of the main image can be calculated based on the pixel value of the main image. Then select a suitable color constancy algorithm, such as a gray world algorithm, a white spot algorithm or an algorithm based on deep learning. Input the extracted color features into the algorithm to let the algorithm estimate the color value of the light source.

[0059] Step 140: Based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image, perform white balance correction on the underwater image.

[0060] In some embodiments of the present application, the electronic device uses a white balance correction algorithm to perform white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image. The white balance correction algorithm includes multiplying each color channel in the image by a corresponding gain value to eliminate the influence of the light source color value on the neutral color, thereby achieving white balance correction of the image. Among them, the gain value refers to the channel gain value. The color channels in the image include a red channel, a blue channel, and a green channel.

[0061] In some embodiments of the present application, after obtaining the light source color value corresponding to the water body image and the light source color value corresponding to the main image, a local image correction method can be used to perform white balance correction on the water body image and the main image respectively based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image. Wherein, performing white balance correction on the water body image includes: determining the gain value of each color channel corresponding to the water body image based on the light source color value corresponding to the water body image, and then multiplying each color channel in the water body image by the corresponding gain value, thereby achieving white balance correction on the water body image. Performing white balance correction on the main image includes: determining the gain value of each color channel corresponding to the main image based on the light source color value corresponding to the main image, and then multiplying each color channel in the main image by the corresponding gain value, thereby achieving white balance correction on the main image.

[0062] In some embodiments of the present application, after obtaining the light source color value corresponding to the water body image and the light source color value corresponding to the main image, an overall white balance correction method can be used to uniformly perform white balance correction on the entire underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image. Wherein, uniformly performing white balance correction on the entire underwater image includes: determining the light source color value corresponding to the entire underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image, determining the gain value corresponding to each color channel in the underwater image based on the light source color value corresponding to the underwater image, and multiplying each color channel in the underwater image by the corresponding gain value, thereby achieving white balance correction of the underwater image.

[0063] By performing white balance correction on underwater images, the light source color temperature deviation of the water image and the main image can be corrected respectively, the true color of the object can be restored, and the quality of the underwater image can be improved.

[0064] The image white balance correction method provided in the embodiment of the present application performs image segmentation on the underwater image to obtain the main image and the water body image; estimates the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image; estimates the light source color value corresponding to the main image based on the pixel value of the main image; and performs white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image. According to the embodiment of the present application, the light source color value of the water body image and the light source color value of the main image are estimated respectively, which improves the accuracy of the light source color value. In this way, the white balance correction of the underwater image based on the estimated light source color value can reduce the overall color deviation of the underwater image, thereby improving the accuracy of color restoration of the underwater image.

[0065] In some embodiments, in the above step 110, the electronic device may perform image segmentation on the underwater image based on at least one parameter of a water depth value and a chromaticity value of a pixel point in the underwater image.

[0066] In some embodiments, see Figure 4 In the above step 110, the following steps 410 to 440 may be used to segment the underwater image based on the water depth values ​​of the pixel points.

[0067] Step 410: Determine the water depth value corresponding to each pixel in the underwater image.

[0068] In some embodiments of the present application, the electronic device estimates the water depth value corresponding to each pixel in the underwater image based on a preset water depth estimation algorithm to obtain the water depth value corresponding to each pixel.

[0069] In some embodiments of the present application, water bodies of different water depths will have certain changing rules in color. Generally speaking, the color of shallow water areas is lighter, and as the water depth increases, the color gradually becomes darker. This is because water has different absorption and scattering characteristics for light of different wavelengths. Based on this, the preset water depth estimation algorithm includes a color feature method. Estimating the water depth value corresponding to each pixel in the underwater image based on the color feature method includes: pre-collecting multiple water body image samples containing different water depth areas, establishing a corresponding relationship database between water body color and water depth based on multiple water body image samples, and when it is necessary to segment the underwater image, the electronic device analyzes the color feature value of each pixel in the underwater image, such as RGB value, HSV value, etc., and then, according to the corresponding relationship in the corresponding relationship database between water body color and water depth, by comparing the similarity between the color feature value of the pixel point and the known water body color, the water depth value corresponding to the water body color with the highest similarity is determined as the water depth value corresponding to the pixel point. Through the color feature method, the water depth value of underwater images in various scenes can be estimated.

[0070] In some other embodiments of the present application, the water depth estimation algorithm includes a deep learning method. The water depth value corresponding to each pixel in the underwater image based on the deep learning method includes: pre-collecting a large number of image data sets containing water depth annotations, designing a suitable deep neural network structure, such as a convolutional neural network CNN, using a large number of images annotated with water depth information to train the network, optimizing network parameters, and obtaining a trained network. Then, when it is necessary to segment the underwater image, the electronic device inputs the underwater image into the trained network to obtain the water depth value corresponding to each pixel output by the network. Through the deep learning method, the water depth value corresponding to each pixel can be quickly determined.

[0071] Step 420: Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1].

[0072] Here, the water depth value is normalized by mapping the water depth value corresponding to each pixel in the underwater image to the [0,1] interval.

[0073] In some embodiments of the present application, when mapping the water depth value corresponding to each pixel in the underwater image to the interval [0,1], all water depth values ​​less than 0 can be set to 0 first, and then the water depth value corresponding to each pixel is divided by the maximum value of the water depth values ​​corresponding to the pixel in the underwater image, thereby achieving normalization of the water depth value.

[0074] Normalization can map the water depth value into a preset range, making it easier to analyze and process.

[0075] Step 430: Determine the image composed of pixels satisfying the second condition in the underwater image as a water body image.

[0076] Here, the second condition includes: the mapped water depth value is greater than a water depth threshold, and the value range of the water depth threshold is [0, 1].

[0077] In some embodiments of the present application, the specific value of the water body threshold can be determined according to the depth of the subject underwater, and the depth of the subject underwater can be determined when shooting an underwater image. For example, taking the water depth threshold as 0.65 as an example, the image composed of all pixels in the underwater image whose corresponding normalized water depth value is greater than 0.65 is determined as a water body image.

[0078] Step 440: Determine the image other than the water body image in the underwater image as the main image.

[0079] For example, Figure 2As shown, taking the user diving image 200 in which the underwater image is taken when the user is diving as an example, based on the water depth value corresponding to the pixel point in the user diving image 200, it is determined that the water body image is the image of the area where the remaining parts except the user 210 and the fish 220 are located, then in the above step 440, the image of the area where the user 210 and the fish 220 are located in the user diving image 200 is determined as the main image.

[0080] For example, Figure 3 As shown, taking the image of a shipwreck 300 taken during underwater archaeology as an example, based on the water depth value corresponding to the pixel point in the user diving image 200, it is determined that the water body image is the image of the area where the remaining part except the shipwreck 310 is located, then in the above step 440, the image of the area where the shipwreck 310 is located in the image of the shipwreck 300 is determined as the main image.

[0081] Image segmentation of underwater images based on water depth values ​​can adapt to different water quality conditions. The water quality conditions of underwater environments vary. For example, factors such as turbidity and salinity can affect the quality and recognizability of images. The segmentation method based on water depth values ​​can reduce the impact of water quality conditions on segmentation results to a certain extent. Because even in the case of poor water quality, the relationship between water depth and image features still exists. By analyzing and utilizing this relationship, the challenges brought by water quality problems can be overcome to a certain extent, and more accurate image segmentation can be achieved.

[0082] In some embodiments of the present application, see Figure 5 In the above step 110, the underwater image can be segmented based on the chromaticity values ​​of the pixels through the following steps 510 to 530.

[0083] Step 510: Map the underwater image to the HSV color space to obtain the hue value corresponding to each pixel in the underwater image.

[0084] In some embodiments of the present application, a preset color space conversion function may be used to convert pixels in an underwater image from an original RGB color space to an HSV color space, wherein the color space conversion function includes but is not limited to the cv2.cvtColor() function.

[0085] Step 520: Determine the image composed of pixels satisfying the third condition in the underwater image as a water body image.

[0086] The third condition includes: the hue value is greater than the first hue threshold and less than the second hue threshold. The first hue threshold and the second hue threshold are pre-set according to actual conditions. The first hue threshold is less than the second hue threshold. For example, the first hue threshold may be about 200, and the second hue threshold may be about 260.

[0087] Exemplarily, taking the first hue threshold as 200 and the second hue threshold as 260 as an example, an image composed of pixels whose corresponding hue values ​​are between [200, 260] in the underwater image is determined as a water body image.

[0088] Step 530: Determine the image other than the water body image in the underwater image as the main image.

[0089] For example, Figure 2 As shown, taking the user diving image 200 in which the underwater image is taken when the user is diving as an example, based on the hue values ​​corresponding to the pixels in the user diving image 200, it is determined that the water body image is the image of the area where the remaining parts except the user 210 and the fish 220 are located, then in the above step 440, the image of the area where the user 210 and the fish 220 are located in the user diving image 200 is determined as the main image.

[0090] For example, Figure 3 As shown, taking the image of a shipwreck 300 taken during underwater archaeology as an example, based on the hue values ​​corresponding to the pixels in the user diving image 200, it is determined that the water body image is an image of the area where the remaining part except the shipwreck 310 is located, then in the above step 440, the image of the area where the shipwreck 310 is located in the image of the shipwreck 300 is determined as the main image.

[0091] Compared with some image segmentation methods based on complex texture, shape or depth information, segmentation methods based on hue usually have lower computational complexity. Calculating hue can be achieved through simple color space conversion, such as converting RGB to HSV color space and threshold setting. This calculation process is relatively simple and can quickly segment the image, improving the efficiency of segmentation.

[0092] In some other embodiments of the present application, in order to eliminate the errors existing in image segmentation based on water depth values ​​and based on hue and improve the accuracy of image segmentation, the underwater image can be segmented based on the water depth values ​​and hue values ​​corresponding to the pixel points. Specifically, the underwater image is first segmented based on the water depth values ​​and hue values ​​of the pixel points respectively, the water body image determined based on the water depth value is used as the first candidate water body image, the water body image determined based on the hue value is used as the second candidate water body image, and then the images of the areas with the same image content in the first candidate water body image and the second candidate water body image are used to determine the final segmented water body image, and the images in the underwater image other than the final segmented water body image are determined as the final segmented underwater image

[0093] The underwater image is segmented based on the water depth value and hue value of the pixel point, which can improve the accuracy of the segmented water body image and main body image.

[0094] In some embodiments, see Figure 6 Before the above step 120, the water body color gamut corresponding to the water body image can be determined through the following steps 610-620.

[0095] Step 610: Determine the pre-calibrated water color gamut corresponding to the shooting position of the underwater image as the initial water color gamut.

[0096] In some embodiments of the present application, the water color gamuts of different regions are pre-calibrated. Based on this, in the above step 610, the shooting location of the underwater image is determined according to the location information corresponding to the underwater image, and then the pre-calibrated water color gamut corresponding to the region where the shooting location is located is determined as the initial water color gamut. Among them, the location information corresponding to the underwater image is information indicating the shooting location of the underwater image, and the location information includes but is not limited to longitude and latitude or other geographical coordinates, detailed description of a specific location, etc. The location information corresponding to the underwater image can be automatically generated and recorded by the imaging device when the underwater image is shot. For example: a user takes an underwater image in Phuket, Thailand through an imaging device, and the location information corresponding to the underwater image is "Phuket, Thailand" or the longitude and latitude coordinates corresponding to Phuket, Thailand. Based on the location information, it is determined that the region corresponding to the shooting location corresponding to the underwater image is Phuket, Thailand, so that the pre-calibrated water color gamut corresponding to Phuket, Thailand is determined as the initial water color gamut.

[0097] Step 620: Based on the ambient light sensor information collected when the underwater image is captured, the chromaticity point range of the initial water color gamut is adjusted to obtain the water color gamut corresponding to the water image.

[0098] Here, the underwater image is obtained by shooting with an imaging device, and the shooting moment of the underwater image refers to the moment when the shutter button of the imaging device is pressed to trigger the shooting action when shooting the underwater image. The ambient light sensor information collected at the shooting moment refers to the information related to the ambient light corresponding to the underwater image measured by the ambient light sensor carried by the imaging device at the shooting moment of the underwater image. Exemplarily, the ambient light sensor information includes but is not limited to light intensity information, light color information, light direction information, etc. Light is one of the important factors affecting the color gamut. The color gamut of the same water area will be different under different light irradiation. For example, when the light intensity is very strong, the color of the water body will appear lighter, and when the light intensity is weak, the color of the water body will appear deeper and darker. When the light irradiates the water body vertically, since the propagation path of the light in the water body is relatively short, the scattering and reflection are mainly concentrated on the surface and shallow layer of the water body, so the color of the water body is lighter, and when the light irradiates the water body at a certain angle, more refraction and reflection phenomena will occur. Due to the refraction of light, the color of the water body may be deeper than when viewed from directly above, and there will be different color stratification phenomena. Based on this, in order to further improve the accuracy of the water color gamut corresponding to the finally determined water image, in this embodiment, after obtaining the initial water color gamut, the initial water color gamut is adjusted based on the ambient light sensor information corresponding to the underwater image measured by the ambient light sensor carried by the imaging device, so as to obtain a water color gamut that is more in line with the actual shooting scene.

[0099] Through the above technical solution, the accuracy of the water body color gamut corresponding to the final water body image can be improved.

[0100] In some embodiments, the same method may be used to calibrate the corresponding water color gamut for each region. The following takes the calibration of the water color gamut corresponding to the shooting position of the underwater image as an example to illustrate the calibration method.

[0101] like Figure 7 As shown, before the above step 610, the water color gamut corresponding to the shooting position of the underwater image can be calibrated through the following steps 710-740.

[0102] Step 710: Obtain at least three water color values ​​at the shooting location.

[0103] Weather type and water depth are two main factors that affect the color gamut of water. Water bodies in the same area usually show different colors in different weather and at different depths. For example, on sunny days, there is plenty of sunlight and the intensity of the sunlight shining on the water is greater. This makes the water look clearer and brighter, and the color appears light blue or turquoise. This is because the blue and green light in the sunlight is more easily scattered and reflected by the water, while other colors of light are absorbed more. On cloudy days, the clouds are thicker, the sunlight is blocked, and the intensity of the sunlight shining on the water is weakened. At this time, the color of the water body will appear darker, and may appear gray-blue or dark green. And due to the lack of strong sunlight, plankton and suspended particles in the water body will also appear more obvious, thus affecting the color of the water body. For example, in some rivers or ponds, you may see the water body appearing turbid yellow or brown on cloudy days. On rainy days, a large amount of rainwater will flow into the water body, bringing various impurities and pollutants. This may make the water color more turbid, appearing yellow-brown or earthy gray. In shallow water areas, the water color is usually lighter, appearing light blue, light green or transparent. This is because the water depth in shallow water areas is shallow, and sunlight can penetrate to the bottom of the water, making the colors and objects at the bottom of the water easier to see. In deep water areas, as the water depth increases, the color of the water body will gradually become darker. In deep water areas, it is difficult for sunlight to penetrate to the bottom of the water, so the water body looks deeper and presents a dark blue or dark green color. In addition, the water body in deep water areas usually contains more plankton and suspended particles, which absorb and scatter light, making the water body color darker. For example, in the depths of the ocean, you can see dark blue seawater, because sunlight cannot penetrate to such a deep place, and the plankton and suspended particles in the water body will make the light darker. Based on this, in this embodiment, in order to make the calibrated water color range more comprehensive, at least one of the water body depths and weather types corresponding to any two water body color values ​​in at least three water body color values ​​is different. Among them, weather types include but are not limited to sunny, cloudy, rainy, cloudy, etc. The water body depth can be divided according to the actual water depth of the shooting location and the step length. The step length can be set according to actual conditions. For example, if the step length is set to 10 meters and the total depth of the water at the shooting location is 40 meters, the water colors at 10 meters, 20 meters, 30 meters and 40 meters underwater can be obtained in each weather condition.

[0104] In some embodiments of the present application, at least three water color values ​​at the shooting location can be obtained by image processing. Specifically, multiple water body images at multiple water body depths at the shooting location can be taken by an imaging device under multiple weather types, and then the color values ​​of the multiple water body images, that is, RGB values, are determined as multiple water body color values ​​at multiple water body depths at the shooting location under multiple weather types. In this way, the color space corresponding to the water body color obtained is the color space of the imaging device, which is convenient for subsequent processing.

[0105] In some other embodiments of the present application, at least three water color values ​​at the shooting location can be obtained by a colorimeter. Specifically, a plurality of color values ​​at a plurality of water depths can be measured by a colorimeter under a plurality of weather types. To facilitate subsequent processing, each color value measured by the colorimeter is converted to a value in a color space corresponding to the imaging device, that is, an RGB value. The converted plurality of color values ​​are determined as a plurality of water color values ​​at a plurality of water depths at the shooting location under a plurality of weather types. In this way, the measurement of water color can be completed at a relatively low cost.

[0106] Step 720: Determine the chromaticity point corresponding to each water body color value.

[0107] Here, the chromaticity point refers to a position point in a specific color space used to represent a specific color. Different color spaces have different coordinate systems to determine the position of the chromaticity point. In this embodiment, the chromaticity point is determined by the horizontal coordinate representing the ratio of red to green and the vertical coordinate representing the ratio of blue to green.

[0108] In some embodiments of the present application, it can be seen from the foregoing that the water color value is an RGB value, and the RGB value represents the intensity value of the three color channels of red, green, and blue, respectively, and the range is usually from 0 to 255. Based on this, for each water color value, the chromaticity point corresponding to the water color value can be determined by normalizing it based on the green channel value. Normalization is a process of converting data into a specific range, usually the [0,1] interval, to facilitate comparison and processing between different data. Normalization based on the green channel value is to normalize based on the G channel value in the RGB value. Assuming that the given water color value is (R, G, B), when normalizing based on green, first determine the green channel value G, then normalize the red channel value R according to R'=R / G to obtain the normalized red channel value R', normalize the green channel value according to G'=G / G=1 to obtain the normalized green channel value 1, and normalize the blue channel value according to B'=B / G to obtain the normalized blue channel value B'. It can be seen that the normalized red channel value R' is the ratio of red to green, and the normalized blue channel value B' is the ratio of blue to green. Therefore, the point corresponding to the coordinates (R', B') is taken as the chromaticity point corresponding to the water color value.

[0109] For example, there is a water body color value of (120, 200, 80). First, the green channel value is determined to be 200, and then normalization calculation is performed: the normalized red channel value R'=120 / 200=0.6, the normalized green channel value G'=200 / 200=1, the normalized blue channel value B'=80 / 200=0.4, then the coordinates of the chromaticity point corresponding to the water body color value are (0.6, 0.4).

[0110] Through this green-based normalization method, RGB values ​​can be converted into proportional values ​​relative to the green channel, which is convenient for comparison and calculation in specific color processing and analysis. In addition, by normalizing based on the green channel value, the color intensity of the three RGB channels can be better balanced. Because green is more common in nature and is in the middle of the visible light spectrum, using it as a reference can ensure to a certain extent that the red and blue channels do not deviate too much from the true color. Moreover, a high green channel value will increase the brightness of the image, making the picture look brighter. At the same time, due to the enhanced contrast between green and red and blue, the details and layering of the image will be more obvious.

[0111] Step 730: Fit at least three chromaticity points corresponding to at least three water body color values ​​to obtain a first convex polygon.

[0112] In some embodiments of the present application, the chromaticity point corresponding to each of the at least three water body color values ​​is determined in the above step 720 to obtain at least three chromaticity points, wherein one water body color value corresponds to one chromaticity point. After obtaining at least three chromaticity points, the at least three chromaticity points are combined into a point set in the chromaticity space, and a first convex polygon can be obtained by fitting the point set, and the point set composed of all the chromaticity points contained in the first convex polygon is determined as the water body color gamut corresponding to the shooting position. For example, the multiple chromaticity points corresponding to the shooting position are (0,0), (0.8,0), (0,0.8), (0.4,0.3), (0.2,0.4) and (0.6,0.1), and the first convex polygon obtained by fitting these 6 points is a triangle with (0,0), (0.8,0) and (0,0.8) as vertices, and the point set composed of all the chromaticity points contained in the triangle is determined as the water body color gamut corresponding to the shooting position. One chromaticity point corresponds to one color, and a point set consisting of multiple chromaticity points corresponds to a color range, that is, a water body color gamut corresponds to a color range.

[0113] In some embodiments of the present application, the first convex polygon is a closed figure fitted by multiple chromaticity points. A closed figure can be characterized by the points on its edge to represent the range of its corresponding point set. Based on this, the set of chromaticity points located on the edge of the first convex polygon can be used to represent the water color gamut corresponding to the shooting position.

[0114] Step 740: Determine a first point set consisting of chromaticity points within the first convex polygon as the water body color gamut corresponding to the shooting position.

[0115] The range covered by the first convex polygon obtained by fitting at least three chromaticity points can be represented by a set of vertices of the convex polygon. For example, a triangle composed of (0,0), (0.8,0), (0,0.8), (0.4,0.3), (0.2,0.4) and (0.6,0.1) can be represented by (0,0), (0.8,0) and (0,0.8). Based on this, in some embodiments of the present application, a point set composed of chromaticity points located on the vertices of the first convex polygon among at least three chromaticity points is used to represent the water color gamut corresponding to the shooting position.

[0116] Through the above technical solution, the water color gamut corresponding to the shooting position can be accurately determined.

[0117] In some embodiments, Figure 8 As shown, in the above step 620, the chromaticity point range of the initial water body color gamut is adjusted based on the ambient light sensor information collected when the underwater image is shot to obtain the water body color gamut corresponding to the water body image, including the following steps 810-840.

[0118] Step 810: Reconstruct the scene spectrum based on the ambient light sensor information.

[0119] Here, the scene spectrum refers to the spectrum corresponding to the scene in which the underwater image is captured.

[0120] In some embodiments of the present application, the scene spectrum can be reconstructed based on the ambient light sensor information and the preset wavelength and spectrum interval. For example, for an ambient light sensor with 8 channels, the corresponding ambient light sensor information is a 1×8 vector. If you want to construct a spectrum with a wavelength between 380 and 700 nm and an interval of 1 nm, you can multiply the ambient light sensor information, that is, a 1×8 vector, with a pre-calibrated 8×331 matrix to obtain it.

[0121] Step 820: Multiply the scene spectrum with the spectra of at least two light sources to obtain spectra of at least two candidate color gamuts.

[0122] In some embodiments of the present application, the preset light source may be pre-set to correspond to the water body image according to actual needs. Exemplarily, the preset light source includes but is not limited to D65, U30, TL84, CWF, A, Horizon under a standard light box and 15 light sources with a range of 3000K to 10000K and an interval of 500K on the black body trajectory. The color gamut corresponding to each preset light source is used as an alternative color gamut, and the constructed scene spectrum is multiplied by the spectrum corresponding to each preset light source, so as to obtain the spectrum of the alternative color gamut corresponding to each preset light source.

[0123] Step 830 : Based on the spectra of at least two candidate color gamuts, determine the chromaticity point of each candidate color gamut.

[0124] In some embodiments of the present application, for each candidate color gamut, the spectrum of the candidate color gamut can be integrated with the standard observer matching function to obtain the tristimulus values ​​corresponding to the candidate color gamut, and then the corresponding RGB values ​​are obtained by mapping the tristimulus values ​​to the RGB color space of the imaging device, and the corresponding chromaticity point is obtained by normalizing the RGB values ​​based on green. The standard observer function can use the standard observer function specified by the International Commission on Illumination (CIE), such as the CIE 1931 standard observer function, which respectively gives the tristimulus value response of the human eye to light of different wavelengths, namely X(λ), Y(λ), and Z(λ), where λ represents the wavelength. For example, the spectrum corresponding to the potential color spectrum is S(λ), and the tristimulus values ​​X, Y, and Z are calculated by integrating the spectrum value of each wavelength with the standard observer function. After the tristimulus values ​​X, Y, and Z are obtained, the RGB values ​​of the tristimulus values ​​X, Y, and Z in the color space corresponding to the imaging device are obtained by color space mapping, for example, multiplying the tristimulus values ​​X, Y, and Z by a 3×3 mapping matrix. After the RGB values ​​are obtained, the chromaticity point can be calculated in the same manner as in the above step 520, which will not be described in detail here.

[0125] Step 840: According to the positional relationship between at least two chromaticity points of at least two candidate color gamuts and the initial water body color gamut, the chromaticity point range of the initial water body color gamut is adjusted to obtain the water body color gamut corresponding to the water body image.

[0126] In some embodiments of the present application, the positional relationship between the chromaticity point of the candidate color gamut and the initial water body color gamut is used to represent whether the chromaticity point of the candidate color gamut is within the range of the chromaticity point represented by the initial water body color gamut.

[0127] When adjusting the initial water body color gamut according to the positional relationship between at least two chromaticity points of at least two alternative color gamuts and the initial water body color gamut, it can be determined whether there is a chromaticity point located outside the chromaticity point range represented by the initial water body color gamut among the at least two chromaticity points corresponding to the at least two alternative color gamuts; if there is a chromaticity point located outside the chromaticity point range represented by the initial water body color gamut among the at least two chromaticity points corresponding to the at least two alternative color gamuts, the initial water body color gamut is adjusted based on the chromaticity point located outside the chromaticity point range represented by the initial water body color gamut among the at least two chromaticity points corresponding to the at least two alternative color gamuts; if both of the at least two chromaticity points corresponding to the at least two alternative color gamuts are located within the chromaticity point range represented by the initial water body color gamut, there is no need to adjust the initial water body color gamut value, and the initial water body color gamut is directly used as the water body color gamut corresponding to the water body image.

[0128] In some embodiments of the present application, when at least two chromaticity points of at least two alternative color gamuts include a chromaticity point located outside the initial water body color gamut, when adjusting the initial water body color gamut, the chromaticity points of the at least two chromaticity points located outside the initial water body color gamut and the initial water body color gamut can be combined into a second point set; the second point set is fitted to obtain a second convex polygon; and the third point set composed of the chromaticity points within the second convex polygon is determined as the water body color gamut corresponding to the shooting position.

[0129] Through the above technical solution, the accuracy of the water body color gamut corresponding to the water body image can be improved.

[0130] In some embodiments, Fig. 9 As shown, in the above step 120, based on the color gamut corresponding to the water body image, the light source color value corresponding to the water body image is estimated, including the following steps 121 to 123.

[0131] Step 121. Based on at least two reference light source color values, perform white balance correction on the water body image to obtain a corrected water body image corresponding to each reference light source color value.

[0132] In some embodiments of the present application, at least two reference light source color values ​​are set in advance according to actual conditions. For example, the reference light source color value is set to [k1, 1, k2], where k1 and k2∈[0.1, 5.5]. For points within this value range, they are used as reference light source color values, based on which at least two reference light source color values ​​can be obtained.

[0133] In some embodiments of the present application, AWB correction is performed on the water body image in the underwater image based on each reference light source color value, so as to obtain the corrected underwater part corresponding to each reference light source color value. Wherein, for each reference light source color value, when correcting the underwater part based on it, the gain value corresponding to each color channel in the underwater part can be determined based on the reference light source color value, and then each color channel of the underwater part is multiplied by the corresponding gain value, so as to obtain the corrected underwater part.

[0134] Step 122: Determine a light source color value that meets a first condition among at least two reference light source color values ​​as a candidate light source color value.

[0135] Here, the first condition includes: the color values ​​of the corrected water body image are all within the water body color range corresponding to the water body image.

[0136] In some embodiments of the present application, for each reference light source color value, the MATLAB function inpolygon can be used to determine whether the color value of each pixel point of the corresponding corrected underwater part is within the water body color gamut corresponding to the water body image; if the color values ​​of all pixel points after correction are within the water body color gamut, the reference light source color value is included in the alternative light source color value.

[0137] Step 123: Determine the light source color value with the largest color gamut of the corrected water body image among the candidate light source color values ​​as the light source color value corresponding to the water body image.

[0138] In some embodiments of the present application, one or more alternative light source color values ​​can be screened out from at least two reference light source color values. If only one alternative light source color value is screened out, the alternative light source color value can be directly determined as the light source color value corresponding to the water body image. If multiple alternative light source color values ​​are screened out, the alternative light source color value that maximizes the color gamut after AWB correction is used as the light source color value of the water body image.

[0139] Through the above technical solution, the accuracy of the determined light source color value of the water body image can be improved.

[0140] In some embodiments, see Fig.10 In the above step 130, based on the pixel value of the main image, estimating the light source color value corresponding to the main image may include steps 131 to 137.

[0141] Step 131: Determine the water depth value corresponding to each pixel in the underwater image.

[0142] The method of determining the water depth value corresponding to the pixel point can refer to the relevant description in the above embodiment, and will not be repeated here to avoid repetition.

[0143] Step 132: Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1].

[0144] The method of mapping the water depth value to the interval [0, 1] can refer to the relevant description in the above embodiment, and will not be described again here to avoid repetition.

[0145] Step 133. Perform an exponential operation on the mapped water depth value of each pixel in the underwater image through an exponential function to obtain the water body weight of each pixel.

[0146] In some implementations of the present application, the water depth value x corresponding to each pixel point can be subjected to exponential operation based on the following formula (1) to obtain the water body weight of each pixel point:

[0147] x ′ =e -x (1)

[0148] In the formula, x represents the water depth value corresponding to the pixel point, x ′ Indicates the water weight of the pixel. For example, x=0.3, x ′ is approximately equal to 0.74. For another example, x = 0.3, x ′ Approximately equal to 0.61.

[0149] Step 134. Multiply the pixel value of each pixel in the main image by the corresponding water body weight to obtain the weighted pixel value corresponding to each pixel.

[0150] Step 135. Based on the weighted pixel values ​​corresponding to all pixel points in the main image, the weighted pixel values ​​corresponding to each color channel in the main image are summed to obtain a color vector, which includes the weighted pixel values ​​and values ​​corresponding to the red channel, the weighted pixel values ​​and values ​​corresponding to the green channel, and the weighted pixel values ​​and values ​​corresponding to the blue channel.

[0151] In some embodiments of the present application, the main image of the main part includes three color channels, namely, a red channel, a blue channel, and a green channel. The color channel values ​​corresponding to the red channel are added among the weighted pixel values ​​corresponding to all pixels to obtain the weighted pixel value and value corresponding to the red channel. The color channel values ​​corresponding to the blue channel are added among the weighted pixel values ​​corresponding to all pixels to obtain the weighted pixel value and value corresponding to the blue channel. The color channel values ​​corresponding to the green channel are added among the weighted pixel values ​​corresponding to all pixels to obtain the weighted pixel value and value corresponding to the green channel. The vector composed of the three weighted pixel values ​​and values ​​is used as a color vector.

[0152] Step 136. Normalize the color vector by the weighted pixel value and value corresponding to the green channel.

[0153] The normalization method here can refer to the relevant description in the aforementioned step 720. To avoid repetition, it will not be described in detail here.

[0154] Step 137: Determine the light source color value corresponding to the normalized color vector as the light source color value corresponding to the main image.

[0155] Through the above technical solution, the light source color value corresponding to the main image can be accurately estimated.

[0156] In some embodiments, in the above step 140, when the white balance correction is performed on the underwater image by using the overall white balance correction method, the light source color value corresponding to the underwater image can be determined based on the light source color value corresponding to the water body image, the light source color value corresponding to the main image, and the proportion of the water body image and the main image in the underwater image. Specifically, the proportion of the water body image and the main image in the underwater image is calculated respectively to obtain the water body proportion and the main body proportion; the first product and the second product are calculated, the first product is the product of the water body proportion and the light source color value corresponding to the water body image, and the second product is the product of the main body proportion and the light source color value corresponding to the main image; the light source color value corresponding to the sum of the first product and the second product is used as the light source color value corresponding to the underwater image.

[0157] Exemplarily, the light source color value corresponding to the underwater image is determined according to the following formula (2):

[0158] L=a*L 1 +(1-a)*L 2 (2)

[0159] In the formula, L represents the light source color value corresponding to the underwater image, a represents the water body ratio, (1-a) represents the main body ratio, and L 1 Indicates the light source color value corresponding to the water image, L 2 Indicates the color value of the light source corresponding to the subject. For example, if a is 0.4, L 1 6000k, L 2 For example, if a is 0.5, L 1 6000k, L 2 is 3000k, then L is 4500k.

[0160] In this way, the proportion of the water body image in the underwater image and the proportion of the main image in the underwater image are respectively used as the weight of the water body image and the weight of the main image. Based on the light source color value of the water body image and the light source color value of the main image, the light source color value corresponding to the underwater image is determined by weighted summation. In this way, the light source color value of the underwater image can be comprehensively measured. Compared with simply taking the average light source color value of the image or only focusing on the light source color value of a specific area, this weighted summation method can filter out some interference factors, such as the influence of the color of the object itself on the judgment of the light source color value, so as to accurately determine the light source color value corresponding to the underwater image, thereby improving the accuracy of white balance correction. Moreover, this method can adapt to different image scenes. Whether it is a complex indoor lighting environment or an outdoor natural lighting scene, as long as the image segmentation is performed reasonably, the light source color value corresponding to the entire underwater image can be effectively determined.

[0161] Through the above technical solution, by determining the light source color value corresponding to the entire underwater image, a unified white balance correction can be performed on the entire underwater image.

[0162] Based on the image white balance correction method provided in the above embodiment, the present application also provides a specific implementation of an image white balance correction device. Please refer to the following embodiment.

[0163] See also Fig.11 The image white balance correction device 1100 provided in the embodiment of the present application includes the following modules:

[0164] An image segmentation module 1110 is used to segment the underwater image to obtain a main body image and a water body image;

[0165] An estimation module 1120, configured to estimate a light source color value corresponding to the water body image based on a water body color gamut corresponding to the water body image;

[0166] The estimation module 1120 is further used to estimate the light source color value corresponding to the subject image based on the pixel value of the subject image;

[0167] The correction module 1130 is used to perform white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image.

[0168] In some embodiments, the apparatus 1100 further includes: a color gamut determination module, configured to:

[0169] Based on the water body color gamut corresponding to the water body image, before estimating the light source color value corresponding to the water body image, a pre-calibrated water body color gamut corresponding to the shooting position of the underwater image is determined as an initial water body color gamut;

[0170] The chromaticity point range of the initial water body color gamut is adjusted based on the ambient light sensor information collected at the time of shooting the underwater image, so as to obtain the water body color gamut corresponding to the water body image.

[0171] In some embodiments, the apparatus 1100 further includes: a calibration module, configured to:

[0172] Before estimating the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image, obtaining at least three water body color values ​​at the shooting position;

[0173] Determine the chromaticity point corresponding to each water body color value respectively;

[0174] Fitting at least three chromaticity points corresponding to at least three water body color values ​​to obtain a first convex polygon;

[0175] A first point set consisting of chromaticity points within the first convex polygon is determined as the water body color gamut corresponding to the shooting position.

[0176] In some embodiments, the calibration module is specifically used to:

[0177] capturing images of a body of water at least at two water depths in at least two types of weather at a capturing location, to obtain at least three images of the body of water;

[0178] The color values ​​of the at least three water body images are determined as the at least three water body color values ​​at the shooting location.

[0179] In some embodiments, the color gamut determination module is specifically configured to:

[0180] Reconstruct the scene spectrum based on the ambient light sensor information;

[0181] Multiplying the scene spectrum with the spectra of at least two light sources to obtain spectra of at least two alternative color gamuts;

[0182] Determining a chromaticity point of each candidate color gamut based on the spectra of at least two candidate color gamuts;

[0183] According to the positional relationship between at least two chromaticity points of at least two candidate color gamuts and the initial water body color gamut, the chromaticity point range of the initial water body color gamut is adjusted to obtain the water body color gamut corresponding to the water body image.

[0184] In some embodiments, the color gamut determination module is specifically configured to:

[0185] In the case that at least two chromaticity points of the at least two candidate color gamuts include a chromaticity point outside the initial water body color gamut, the chromaticity point outside the initial water body color gamut among the at least two chromaticity points and the initial water body color gamut form a second point set;

[0186] Fitting the second point set to obtain a second convex polygon;

[0187] A third point set consisting of chromaticity points within the second convex polygon is determined as the water body color gamut corresponding to the shooting position.

[0188] In some embodiments, the estimation module is specifically configured to:

[0189] Performing white balance correction on the water body image based on at least two reference light source color values ​​to obtain a corrected water body image corresponding to each reference light source color value;

[0190] Determine a light source color value that satisfies a first condition among at least two light source color values ​​as a candidate light source color value;

[0191] The light source color value with the largest color gamut of the corrected water body image among the candidate light source color values ​​is determined as the light source color value corresponding to the water body image;

[0192] The first condition includes: the color values ​​of the corrected water body image are all within the water body color range corresponding to the water body image.

[0193] In some embodiments, the image segmentation module 1110 is specifically configured to:

[0194] Determine the water depth value corresponding to each pixel in the underwater image;

[0195] Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1];

[0196] Determine an image composed of pixels satisfying the second condition in the underwater image as a water body image;

[0197] Determine the image other than the water body image in the underwater image as the main image;

[0198] The second condition includes: the mapped water depth value is greater than a water depth threshold, and the water depth threshold is in the range of [0,1].

[0199] In some embodiments, the image segmentation module 1110 is specifically configured to:

[0200] Map the underwater image to the HSV color space to obtain the hue value corresponding to each pixel in the underwater image;

[0201] Determine an image composed of pixels satisfying the third condition in the underwater image as a water body image;

[0202] Determine the image other than the water body image in the underwater image as the main image;

[0203] The third condition includes: the hue value is greater than the first hue threshold and less than the second hue threshold, and the first hue threshold is less than the second hue threshold.

[0204] In some embodiments, the image segmentation module 1110 is specifically configured to:

[0205] Determine the water depth value corresponding to each pixel in the underwater image;

[0206] Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1];

[0207] Determine an image composed of pixels satisfying a second condition in the underwater image as a first candidate water body image;

[0208] Map the underwater image to the HSV color space to obtain the hue value corresponding to each pixel in the underwater image;

[0209] Determine an image composed of pixels satisfying a third condition in the underwater image as a second candidate water body image;

[0210] Determine an image of a region with the same image content in the first candidate water body image and the second candidate water body image as a water body image;

[0211] Determine the image other than the water body image in the underwater image as the main image;

[0212] The second condition includes: the mapped water depth value is greater than the water depth threshold, and the value range of the water depth threshold is [0,1];

[0213] The third condition includes: the hue value is greater than the first hue threshold and less than the second hue threshold, and the first hue threshold is less than the second hue threshold.

[0214] In some embodiments, the estimation module 1120 is specifically configured to:

[0215] Determine the water depth value corresponding to each pixel in the underwater image;

[0216] Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1];

[0217] Through the exponential function, the mapped water depth value of each pixel in the underwater image is subjected to exponential operation to obtain the water weight of each pixel;

[0218] Multiply the pixel value of each pixel in the main image by the corresponding water body weight to obtain the weighted pixel value corresponding to each pixel;

[0219] Based on the weighted pixel values ​​corresponding to all pixels in the main image, the weighted pixel values ​​corresponding to each color channel in the main image are summed to obtain a color vector, wherein the color vector includes the weighted pixel value and value corresponding to the red channel, the weighted pixel value and value corresponding to the green channel, and the weighted pixel value and value corresponding to the blue channel;

[0220] Normalize the color vector using the weighted pixel values ​​and values ​​corresponding to the green channel;

[0221] The light source color value corresponding to the normalized color vector is used as the light source color value corresponding to the main image.

[0222] In some embodiments, the correction module 1130 is specifically configured to:

[0223] Determine the light source color value corresponding to the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image;

[0224] Determine the channel gain of each color channel in the underwater image based on the light source color value corresponding to the underwater image;

[0225] Based on the channel gain of each color channel, white balance correction is performed on each color channel of the underwater image.

[0226] In some embodiments, the correction module 1130 is specifically configured to:

[0227] Calculate the proportion of water body image and main body image in the underwater image respectively to obtain water body proportion and main body proportion;

[0228] Calculate a first product and a second product, the first product being the product of the water body ratio and the light source color value corresponding to the water body image, and the second product being the product of the subject ratio and the light source color value corresponding to the subject image;

[0229] The light source color value corresponding to the sum of the first product and the second product is determined as the light source color value corresponding to the underwater image.

[0230] The image white balance correction in the embodiment of the present application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc. It can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0231] The image white balance correction device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0232] The image white balance correction device provided in the embodiment of the present application can achieve Figures 1 to 10 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0233] Alternatively, if Fig.12 As shown, an embodiment of the present application further provides an electronic device 1200, including a processor 1201 and a memory 1202, wherein the memory 1202 stores programs or instructions that can be executed on the processor 1201, and when the program or instructions are executed by the processor 1201, the various steps of the above-mentioned image white balance correction method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0234] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0235] Fig.13 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0236] The electronic device 1300 includes but is not limited to: a radio frequency unit 1301, a network module 1302, an audio output unit 1303, an input unit 1304, a sensor 1305, a display unit 1306, a user input unit 1307, an interface unit 1308, a memory 1309, and other components.

[0237] Those skilled in the art will appreciate that the electronic device 1300 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1310 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.13 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0238] The processor 1310 is used to perform image segmentation on the underwater image to obtain a main body image and a water body image;

[0239] The processor 1310 is further configured to estimate a light source color value corresponding to the water body image based on a water body color gamut corresponding to the water body image;

[0240] The processor 1310 is further configured to estimate a light source color value corresponding to the subject image based on a pixel value of the subject image;

[0241] The processor 1310 is further configured to perform white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image.

[0242] In some embodiments, the processor 1310 is further configured to:

[0243] Based on the water body color gamut corresponding to the water body image, before estimating the light source color value corresponding to the water body image, a pre-calibrated water body color gamut corresponding to the shooting position of the underwater image is determined as an initial water body color gamut;

[0244] The chromaticity point range of the initial water body color gamut is adjusted based on the ambient light sensor information collected at the time of shooting the underwater image, so as to obtain the water body color gamut corresponding to the water body image.

[0245] In some embodiments, the processor 1310 is further configured to:

[0246] Before estimating the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image, obtaining at least three water body color values ​​at the shooting position;

[0247] Determine the chromaticity point corresponding to each water body color value respectively;

[0248] Fitting at least three chromaticity points corresponding to at least three water body color values ​​to obtain a first convex polygon;

[0249] A first point set consisting of chromaticity points within the first convex polygon is determined as the water body color gamut corresponding to the shooting position.

[0250] In some embodiments, the processor 1310 is further configured to:

[0251] capturing images of a body of water at least at two water depths in at least two types of weather at a capturing location, to obtain at least three images of the body of water;

[0252] The color values ​​of the at least three water body images are determined as the at least three water body color values ​​at the shooting location.

[0253] In some embodiments, the processor 1310 is further configured to:

[0254] Reconstruct the scene spectrum based on the ambient light sensor information;

[0255] Multiplying the scene spectrum with the spectra of at least two light sources to obtain spectra of at least two alternative color gamuts;

[0256] Determining a chromaticity point of each candidate color gamut based on the spectra of at least two candidate color gamuts;

[0257] According to the positional relationship between at least two chromaticity points of at least two candidate color gamuts and the initial water body color gamut, the chromaticity point range of the initial water body color gamut is adjusted to obtain the water body color gamut corresponding to the water body image.

[0258] In some embodiments, the processor 1310 is further configured to:

[0259] In the case that at least two chromaticity points of the at least two candidate color gamuts include a chromaticity point outside the initial water body color gamut, the chromaticity point outside the initial water body color gamut among the at least two chromaticity points and the initial water body color gamut form a second point set;

[0260] Fitting the second point set to obtain a second convex polygon;

[0261] A third point set consisting of chromaticity points within the second convex polygon is determined as the water body color gamut corresponding to the shooting position.

[0262] In some embodiments, the processor 1310 is further configured to:

[0263] Based on at least two reference light source color values, white balance correction is performed on the water body image to obtain a corrected water body image corresponding to each reference light source color value;

[0264] Determine a light source color value that satisfies a first condition among at least two reference light source color values ​​as a candidate light source color value;

[0265] The light source color value with the largest color gamut of the corrected water body image among the candidate light source color values ​​is determined as the light source color value corresponding to the water body image;

[0266] The first condition includes: the color values ​​of the corrected water body image are all within the water body color range corresponding to the water body image.

[0267] In some embodiments, the processor 1310 is further configured to:

[0268] Determine the water depth value corresponding to each pixel in the underwater image;

[0269] Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1];

[0270] Determine an image composed of pixels satisfying the second condition in the underwater image as a water body image;

[0271] Determine the image other than the water body image in the underwater image as the main image;

[0272] The second condition includes: the mapped water depth value is greater than a water depth threshold, and the water depth threshold is in the range of [0,1].

[0273] In some embodiments, the processor 1310 is further configured to:

[0274] Map the underwater image to the HSV color space to obtain the hue value corresponding to each pixel in the underwater image;

[0275] Determine an image composed of pixels satisfying the third condition in the underwater image as a water body image;

[0276] Determine the image other than the water body image in the underwater image as the main image;

[0277] The third condition includes: the hue value is greater than the first hue threshold and less than the second hue threshold, and the first hue threshold is less than the second hue threshold.

[0278] In some embodiments, the processor 1310 is further configured to:

[0279] Determine the water depth value corresponding to each pixel in the underwater image;

[0280] Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1];

[0281] Determine an image composed of pixels satisfying a second condition in the underwater image as a first candidate water body image;

[0282] Map the underwater image to the HSV color space to obtain the hue value corresponding to each pixel in the underwater image;

[0283] Determine an image composed of pixels satisfying a third condition in the underwater image as a second candidate water body image;

[0284] Determine an image of a region with the same image content in the first candidate water body image and the second candidate water body image as a water body image;

[0285] Determine the image other than the water body image in the underwater image as the main image;

[0286] The second condition includes: the mapped water depth value is greater than the water depth threshold, and the value range of the water depth threshold is [0,1];

[0287] The third condition includes: the hue value is greater than the first hue threshold and less than the second hue threshold, and the first hue threshold is less than the second hue threshold.

[0288] In some embodiments, the processor 1310 is further configured to:

[0289] Determine the water depth value corresponding to each pixel in the underwater image;

[0290] Map the water depth value corresponding to each pixel in the underwater image to the interval [0,1];

[0291] Through the exponential function, the mapped water depth value of each pixel in the underwater image is subjected to exponential operation to obtain the water weight of each pixel;

[0292] Multiply the pixel value of each pixel in the main image by the corresponding water body weight to obtain the weighted pixel value corresponding to each pixel;

[0293] Based on the weighted pixel values ​​corresponding to all pixels in the main image, the weighted pixel values ​​corresponding to each color channel in the main image are summed to obtain a color vector, wherein the color vector includes the weighted pixel value and value corresponding to the red channel, the weighted pixel value and value corresponding to the green channel, and the weighted pixel value and value corresponding to the blue channel;

[0294] Normalize the color vector by the weighted pixel value and value corresponding to the green channel;

[0295] The light source color value corresponding to the normalized color vector is determined as the light source color value corresponding to the main image.

[0296] In some embodiments, the processor 1310 is further configured to:

[0297] Determine the light source color value corresponding to the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image;

[0298] Determine the channel gain of each color channel in the underwater image based on the light source color value corresponding to the underwater image;

[0299] Based on the channel gain of each color channel, white balance correction is performed on each color channel of the underwater image.

[0300] In some embodiments, the processor 1310 is further configured to:

[0301] Calculate the area ratios of the water body image and the main body image in the underwater image respectively to obtain the water body ratio and the main body ratio;

[0302] Calculate a first product and a second product, the first product being the product of the water body ratio and the light source color value corresponding to the water body image, and the second product being the product of the subject ratio and the light source color value corresponding to the subject image;

[0303] The light source color value corresponding to the sum of the first product and the second product is determined as the light source color value corresponding to the underwater image.

[0304] It should be understood that in the embodiment of the present application, the input unit 1304 may include a graphics processor (Graphics Processing Unit, GPU) 13041 and a microphone 13042, and the graphics processor 13041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1306 may include a display panel 13061, and the display panel 13061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1307 includes a touch panel 13071 and at least one of other input devices 13072. The touch panel 13071 is also called a touch screen. The touch panel 13071 may include two parts: a touch detection device and a touch controller. Other input devices 13072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0305] The memory 1309 can be used to store software programs and various data. The memory 1309 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1309 may include a volatile memory or a non-volatile memory, or the memory x09 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1309 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0306] The processor 1310 may include one or more processing units; optionally, the processor 1310 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1310.

[0307] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned image white balance correction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0308] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0309] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image white balance correction method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0310] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0311] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned image white balance correction method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0312] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0313] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0314] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for correcting image white balance, characterized in that: include: Perform image segmentation on the underwater image to obtain the main image and the water body image; estimating a light source color value corresponding to the water body image based on a water body color gamut corresponding to the water body image; Based on the pixel values ​​of the subject image, estimating the light source color value corresponding to the subject image; White balance correction is performed on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image.

2. The method according to claim 1, characterized in that Before estimating the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image, the method further includes: Determining a pre-calibrated water body color gamut corresponding to a shooting position of the underwater image as an initial water body color gamut; Based on the ambient light sensor information collected when the underwater image is captured, the chromaticity point range of the initial water body color gamut is adjusted to obtain the water body color gamut corresponding to the water body image.

3. The method according to claim 2, characterized in that Before estimating the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image, the method further includes: Obtain at least three water color values ​​at the shooting location; Determine the chromaticity point corresponding to each water body color value respectively; Fitting at least three chromaticity points corresponding to the at least three water body color values ​​to obtain a first convex polygon; A first point set consisting of chromaticity points within the first convex polygon is determined as the water body color gamut corresponding to the shooting position.

4. The method according to claim 3, characterized in that The obtaining of at least three water color values ​​at the shooting location includes: photographing water body images of at least two water depths in at least two types of weather at the photographing location to obtain at least three water body images; The color values ​​of the at least three water body images are determined as the at least three water body color values ​​at the shooting location.

5. The method according to claim 3, characterized in that: The adjusting the chromaticity point range of the initial water body color gamut based on the ambient light sensor information collected when the underwater image is shot to obtain the water body color gamut corresponding to the water body image includes: reconstructing a scene spectrum based on the ambient light sensor information; Multiplying the scene spectrum with the spectra of at least two light sources to obtain spectra of at least two alternative color gamuts; Determining a chromaticity point of each candidate color gamut based on the spectra of the at least two candidate color gamuts; According to the positional relationship between at least two chromaticity points of the at least two candidate color gamuts and the initial water body color gamut, the chromaticity point range of the initial water body color gamut is adjusted to obtain the water body color gamut corresponding to the water body image.

6. The method according to claim 5, characterized in that The adjusting the initial water color gamut according to the positional relationship between the at least two chromaticity points of the at least two candidate color gamuts and the initial water color gamut to obtain the water color gamut corresponding to the water image includes: In the case that at least two chromaticity points of the at least two candidate color gamuts include a chromaticity point outside the initial water body color gamut, the chromaticity point outside the initial water body color gamut among the at least two chromaticity points and the initial water body color gamut form a second point set; Fitting the second point set to obtain a second convex polygon; A third point set consisting of chromaticity points within the second convex polygon is determined as the water body color gamut corresponding to the shooting position.

7. The method according to claim 1, characterized in that The estimating the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image includes: Based on at least two reference light source color values, performing white balance correction on the water body image to obtain a corrected water body image corresponding to each reference light source color value; Determine a light source color value that satisfies a first condition among the at least two reference light source color values ​​as a candidate light source color value; Determine the light source color value with the largest color gamut of the corrected water body image among the candidate light source color values ​​as the light source color value corresponding to the water body image; The first condition includes: the color values ​​of the corrected water body image are all within the water body color range corresponding to the water body image.

8. The method according to claim 1, characterized in that: The step of performing image segmentation on the underwater image to obtain a main body image and a water body image includes: Determine a water depth value corresponding to each pixel in the underwater image; Mapping the water depth value corresponding to each pixel in the underwater image to the interval [0,1]; Determine an image composed of pixels satisfying a second condition in the underwater image as a water body image; Determining an image other than the water body image in the underwater image as a main image; The second condition includes: the mapped water depth value is greater than a water depth threshold, and the value range of the water depth threshold is [0, 1].

9. The method according to claim 1, characterized in that: The step of performing image segmentation on the underwater image to obtain a main body image and a water body image includes: Mapping the underwater image to the HSV color space to obtain a hue value corresponding to each pixel in the underwater image; Determine an image composed of pixels satisfying a third condition in the underwater image as a water body image; Determining an image other than the water body image in the underwater image as a main image; The third condition includes: the hue value is greater than a first hue threshold and less than a second hue threshold, and the first hue threshold is less than the second hue threshold.

10. The method according to claim 1, characterized in that The step of performing image segmentation on the underwater image to obtain a main body image and a water body image includes: Determine a water depth value corresponding to each pixel in the underwater image; Mapping the water depth value corresponding to each pixel in the underwater image to the interval [0,1]; Determine an image composed of pixels satisfying a second condition in the underwater image as a first candidate water body image; Mapping the underwater image to the HSV color space to obtain a hue value corresponding to each pixel in the underwater image; Determine an image composed of pixels satisfying a third condition in the underwater image as a second candidate water body image; Determine an image of an area with the same image content in the first candidate water body image and the second candidate water body image as a water body image; Determining an image other than the water body image in the underwater image as a main image; The second condition includes: the mapped water depth value is greater than a water depth threshold, and the value range of the water depth threshold is [0,1]; The third condition includes: the hue value is greater than a first hue threshold and less than a second hue threshold, and the first hue threshold is less than the second hue threshold.

11. The method according to claim 1, characterized in that The estimating the light source color value corresponding to the subject image based on the pixel value of the subject image includes: Determine a water depth value corresponding to each pixel in the underwater image; Mapping the water depth value corresponding to each pixel in the underwater image to the interval [0,1]; By using an exponential function, an exponential operation is performed on the mapped water depth value of each pixel in the underwater image to obtain a water body weight of each pixel; Multiplying the pixel value of each pixel in the main image by the corresponding water body weight to obtain a weighted pixel value corresponding to each pixel; Based on the weighted pixel values ​​corresponding to all the pixels in the main image, the weighted pixel values ​​corresponding to each color channel in the main image are summed to obtain a color vector, wherein the color vector includes a weighted pixel value and value corresponding to the red channel, a weighted pixel value and value corresponding to the green channel, and a weighted pixel value and value corresponding to the blue channel; Normalizing the color vector by the weighted pixel value and value corresponding to the green channel; The light source color value corresponding to the normalized color vector is determined as the light source color value corresponding to the main image.

12. The method according to claim 1, characterized in that The performing white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image includes: Determining the light source color value corresponding to the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image; Determining a channel gain of each color channel in the underwater image based on a light source color value corresponding to the underwater image; Based on the channel gain of each color channel, white balance correction is performed on each color channel of the underwater image.

13. The method according to claim 12, characterized in that The determining the light source color value corresponding to the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image includes: Respectively calculating the area ratios of the water body image and the main body image in the underwater image to obtain a water body ratio and a main body ratio; Calculating a first product and a second product, wherein the first product is the product of the water body ratio and the light source color value corresponding to the water body image, and the second product is the product of the subject ratio and the light source color value corresponding to the subject image; A light source color value corresponding to a sum of the first product and the second product is determined as the light source color value corresponding to the underwater image.

14. An image white balance correction device, characterized in that: include: An image segmentation module is used to segment the underwater image to obtain a main body image and a water body image; An estimation module, configured to estimate a light source color value corresponding to the water body image based on a water body color gamut corresponding to the water body image; The estimation module is further used to estimate the light source color value corresponding to the subject image based on the pixel value of the subject image; The correction module is used to perform white balance correction on the underwater image based on the light source color value corresponding to the water body image and the light source color value corresponding to the main image.

15. The device according to claim 14, characterized in that The device further includes: a color gamut determination module, configured to: Based on the water body color gamut corresponding to the water body image, before estimating the light source color value corresponding to the water body image, a pre-calibrated water body color gamut corresponding to the shooting position of the underwater image is determined as an initial water body color gamut; The chromaticity point range of the initial water body color gamut is adjusted based on the ambient light sensor information collected at the time of shooting the underwater image to obtain the water body color gamut corresponding to the water body image.

16. The device according to claim 15, characterized in that The device also includes a calibration module, which is used to: Before estimating the light source color value corresponding to the water body image based on the water body color gamut corresponding to the water body image, obtaining at least three water body color values ​​at the shooting position; Determine the chromaticity point corresponding to each water body color value respectively; Fitting at least three chromaticity points corresponding to the at least three water body color values ​​to obtain a first convex polygon; A first point set consisting of chromaticity points within the first convex polygon is determined as the water body color gamut corresponding to the shooting position.

17. The device according to claim 16, characterized in that The calibration module is specifically used for: photographing water body images of at least two water depths in at least two types of weather at the photographing location to obtain at least three water body images; The color values ​​of the at least three water body images are determined as the at least three water body color values ​​at the shooting location.

18. The device according to claim 16, characterized in that The color gamut determination module is specifically used to: reconstructing a scene spectrum based on the ambient light sensor information; Multiplying the scene spectrum with the spectra of at least two light sources to obtain spectra of at least two alternative color gamuts; Determining a chromaticity point of each candidate color gamut based on the spectra of the at least two candidate color gamuts; According to the positional relationship between at least two chromaticity points of the at least two candidate color gamuts and the initial water body color gamut, the chromaticity point range of the initial water body color gamut is adjusted to obtain the water body color gamut corresponding to the water body image.

19. The device according to claim 18, characterized in that The color gamut determination module is specifically used to: In the case that at least two chromaticity points of the at least two candidate color gamuts include a chromaticity point outside the initial water body color gamut, the chromaticity point outside the initial water body color gamut among the at least two chromaticity points and the initial water body color gamut form a second point set; Fitting the second point set to obtain a second convex polygon; A third point set consisting of chromaticity points within the second convex polygon is determined as the water body color gamut corresponding to the shooting position.

20. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the image white balance correction method as described in any one of claims 1 to 13 are implemented.