White balance adjustment methods and electronic devices

By dividing the image into regions and filtering based on multiple conditions, the problem of misjudgment and misadjustment of white balance adjustment methods in specific scenarios is solved, and accurate white balance adjustment is achieved under different color temperatures and scenarios, ensuring the accuracy of image colors.

CN115604450BActive Publication Date: 2025-11-14BYD SEMICON CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110722917.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-28
Publication Date
2025-11-14
Estimated Expiration
2041-06-28

AI Technical Summary

Technical Problem

Existing white balance adjustment methods are prone to misjudgment and misadjustment in special scenarios with specific color temperatures, resulting in color cast in the image.

Method used

By dividing the original image into regions, multiple categories of white balance adjustment areas are selected using different filtering conditions. White balance adjustments are then made based on these regions, including filtering conditions under the baseline color temperature, different color temperatures, and the target scene. Iterative adjustments are made to accurately count color cast.

Benefits of technology

It achieves accurate white balance adjustment under different color temperatures and scenes, avoiding misjudgment and misadjustment, and ensuring that the colors of objects in the image retain their original tones.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115604450B_ABST
    Figure CN115604450B_ABST
Patent Text Reader

Abstract

This application discloses a white balance adjustment method and electronic device. The method includes: acquiring an original image to be processed; dividing the original image into regions to obtain a first region, a second region, and a third region in the original image, wherein the first region, the second region, and the third region are regions composed of reference white points selected from the pixels of the original image under different filtering conditions; and adjusting the white balance of the original image according to the first region, the second region, and the third region to obtain a target image. This method effectively divides the original image through different filtering conditions, and then accurately performs automatic white balance on the image based on the divided first region, the second region, and the third region, avoiding misjudgment and misadjustment problems that may occur in specific scenes with specific color temperatures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and more specifically, to a white balance adjustment method and electronic device. Background Technology

[0002] Color temperature refers to the different colors produced by applying different temperatures to a black body. It can also be simply understood as the temperature of a color. Under different color temperatures, the color of an object often changes. For example, the higher the color temperature, the more bluish the object appears; the lower the color temperature, the more yellowish it appears. Therefore, when using an image sensor to acquire images, white balance adjustment is generally required to minimize the impact of color temperature on image color, ensuring that images acquired under different color temperature conditions retain the original colors of objects.

[0003] Currently, Automatic White Balance (AWB) is generally used to adjust the white balance of images. This method is generally divided into local white balance method and global white balance method. The local white balance method selects pixels that meet certain screening criteria from the image pixels as reference white points to statistically analyze the overall color cast of the image and then adjust the white balance.

[0004] However, in order to improve the adaptability of local white balance methods, the selection criteria for reference white points are usually set relatively loosely. This can easily lead to misjudgment or misadjustment in special scenarios with specific color temperatures. Therefore, it is necessary to provide a white balance adjustment method to solve the above problems. Summary of the Invention

[0005] One objective of this disclosure is to provide a new technical solution for adjusting the white balance of images, in order to solve the problems of misjudgment and misadjustment that may occur in existing methods.

[0006] A first aspect of this disclosure provides a white balance adjustment method, the method comprising:

[0007] Obtain the original image to be processed;

[0008] The original image is divided into regions to obtain a first region, a second region, and a third region in the original image. The first region, the second region, and the third region are regions composed of reference white points selected from the pixels of the original image under different filtering conditions.

[0009] Based on the first region, the second region, and the third region, the white balance of the original image is adjusted to obtain the target image.

[0010] Optionally, the step of dividing the original image into regions to obtain a first region, a second region, and a third region in the original image includes:

[0011] Obtain a reference gain value, wherein the reference gain value is the gain value when the image white balance is achieved at a reference color temperature, and the reference color temperature is the color temperature of interest to the user;

[0012] Based on the reference gain value, the original image is divided into regions to obtain the first region, the second region, and the third region.

[0013] Optionally, the step of dividing the original image into regions based on the reference gain value to obtain the first region, the second region, and the third region includes:

[0014] Calculate the red, blue, and green component values ​​of each pixel in the original image under the influence of the reference gain value;

[0015] From the original image, pixels whose red, green, and blue component values ​​meet the first screening condition are selected as first reference white points, pixels whose red, green, and blue component values ​​meet the second screening condition are selected as second reference white points, and pixels whose red, green, and blue component values ​​meet the third screening condition are selected as third reference white points.

[0016] The original image is divided into regions based on the first reference white point, the second reference white point, and the third reference white point, respectively, to obtain the first region, the second region, and the third region;

[0017] Wherein, the first filtering condition is used to filter reference white points from the original image under different scenes at the reference color temperature, the second filtering condition is used to filter reference white points from the original image under different scenes at different color temperatures, and the third filtering condition is used to filter reference white points from the original image under target scenes at different color temperatures, and the color temperature difference between the different color temperatures meets a preset condition.

[0018] Optionally, the step of adjusting the white balance of the original image based on the first region, the second region, and the third region to obtain the target image includes:

[0019] Obtain a first number of first reference white points and a second number of second reference white points, wherein the first reference white points are reference white points in the first region and the second reference white points are reference white points in the second region;

[0020] Based on the first quantity and the second quantity, a target area is determined from the first area, the second area, and the third area;

[0021] Based on the target region, the white balance of the original image is adjusted to obtain the target image.

[0022] Optionally, determining the target region from the first region, the second region, and the third region based on the first quantity and the second quantity includes:

[0023] If the first quantity is greater than a first preset threshold, then the first region is determined as the target region; and,

[0024] If the first quantity is not greater than the first preset threshold, and the second quantity is greater than the second preset threshold, then the second region is determined as the target region.

[0025] Optionally, adjusting the white balance of the original image based on the target region to obtain the target image includes:

[0026] Based on the target region, perform a white balance adjustment on the original image;

[0027] And after the white balance adjustment, obtain the third number of third reference white points in the third region;

[0028] Based on the third quantity, the target region is redefined, and based on the redefined target region, the white balance of the original image is adjusted again to obtain the target image.

[0029] Optionally, the step of redetermining the target region based on the third quantity, and then adjusting the white balance of the original image again based on the redetermined target region, includes:

[0030] If the third quantity is greater than a third preset threshold, then the third region is redefined as the target region, and the white balance of the original image is adjusted according to the redefined target region; and,

[0031] If the third quantity is not greater than the third preset threshold, then the step of determining the target region from the first region, the second region, and the third region based on the first quantity and the second quantity is executed again.

[0032] Optionally, adjusting the white balance of the original image based on the target region includes:

[0033] Obtain the first average value, the second average value, and the third average value of each color component of all pixels in the target area, wherein the first average value is the average value of the red component of all pixels, the second average value is the average value of the green component of all pixels, and the third average value is the average value of the blue component of all pixels.

[0034] Based on the first average value, the second average value, and the third average value, a first white balance gain value and a second white balance gain value are obtained;

[0035] Based on the first white balance gain value, the values ​​of the red components of all pixels in the original image are adjusted, and based on the second white balance gain value, the values ​​of the blue components of all pixels in the original image are adjusted.

[0036] Optionally, obtaining the first white balance gain value and the second white balance gain value based on the first average value, the second average value, and the third average value includes:

[0037] If the second average value is not zero, the ratio of the first average value to the second average value is taken as the first white balance gain value; and,

[0038] The ratio of the third average value to the second average value is obtained as the second white balance gain value.

[0039] A second aspect of this disclosure also provides an electronic device, comprising:

[0040] Memory is used to store executable instructions;

[0041] A processor, configured to operate the electronic device according to the instructions to perform the method described in accordance with the first aspect of this disclosure.

[0042] One beneficial effect of this disclosure is that, according to the embodiments of this disclosure, after obtaining the original image to be processed, when dividing the original image into regions, in order to select the real white points from the original image as reference white points, the embodiments of this disclosure use different filtering conditions to effectively divide the original image into regions, and adjust the white balance of the original image according to the obtained first region, second region and third region, thereby accurately realizing the automatic white balance of the image and avoiding the misjudgment and misadjustment problems that may occur in specific scenes with specific color temperatures.

[0043] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0044] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments of the present disclosure and, together with their description, serve to explain the principles of the present disclosure.

[0045] Figure 1 This is a schematic flowchart of a white balance adjustment method provided in an embodiment of this disclosure.

[0046] Figure 2 This is a schematic diagram of the process of dividing an image into regions according to an embodiment of the present disclosure.

[0047] Figure 3 This disclosure provides a schematic diagram of the process for obtaining the judgment threshold in the third filtering condition.

[0048] Figure 4 This is a schematic diagram of white balance adjustment processing provided in an embodiment of this disclosure.

[0049] Figure 5 This is a schematic diagram of white balance adjustment of the original image provided in an embodiment of this disclosure.

[0050] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0051] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.

[0052] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.

[0053] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0054] In all the examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0055] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0056] <Method Implementation>

[0057] In the field of image processing, common color models used to describe the colors of pixels in an image include HSB (Hue, Saturation, Brightness), RGB (Red, Green, Blue), CMYK (Cyan, Magenta, Yellow, Black), and CIE L*a*b* color models. In the HSB color model, H (Hue) represents hue, S (Saturation) represents saturation, and B (brightness) represents brightness. In the RGB color model, R (Red) represents red, G (Green) represents green, and B (Blue) represents blue. In this model, a color is represented by the superposition of the color components of the R, G, and B channels. Each component has a value ranging from 0 to 255. For example, the component values ​​of all three channels for pure white are 255, and the component values ​​of all three channels for pure black are 0. In this embodiment, unless otherwise specified, the RGB color model is used to describe the colors of pixels in the image.

[0058] Specifically, to avoid the problem of electronic devices misjudging reference white points in specific color temperature scenarios when acquiring images using existing regional white balance methods, leading to incorrect white balance adjustments, the inventors discovered that the filtering conditions used to select reference white points from the image can be tightened in specific color temperature scenarios. That is, the threshold in the selection conditions can be reduced to solve this problem and prevent color casts in the acquired image. However, this method reduces its adaptability, making it unable to switch properly in other scenarios. For example, when the color temperature changes significantly, the electronic device may be unable to identify the true white point in the acquired image, resulting in inaccurate white balance adjustments.

[0059] To maximize the accuracy of white balance adjustment while maintaining adaptability, embodiments of this disclosure provide a white balance adjustment method. Please refer to [link / reference]. Figure 1 This is a flowchart illustrating the white balance adjustment method provided in this embodiment. In specific implementations, this method can be implemented by an electronic device, which can be a terminal device with a built-in image sensor, such as a camera, mobile phone, or tablet computer; or it can be other devices used for image processing, such as a server for image processing; alternatively, the method can be implemented interactively by the terminal device and the server, without special limitations. Furthermore, in the embodiments of this disclosure, unless otherwise specified, a camera is used as an example to illustrate the method.

[0060] like Figure 1 As shown, the method of this embodiment may include the following steps S1100-S1300, which will be described in detail below.

[0061] Step S1100: Obtain the original image to be processed.

[0062] The original image can be an image that the electronic device is currently capturing or has already captured using its built-in image sensor, or it can be an image uploaded by the user that needs white balance adjustment. In this embodiment, no special limitation is made on the method of acquiring the original image.

[0063] Step S1200: Divide the original image into regions to obtain a first region, a second region, and a third region in the original image, wherein the first region, the second region, and the third region are regions composed of reference white points selected from the pixels of the original image under different filtering conditions.

[0064] The first region is a white balance adjustment region composed of a first reference white point that meets the first screening condition and is selected from the pixels of the original image; the second region is a white balance adjustment region composed of a second reference white point that meets the second screening condition and is selected from the pixels of the original image; the third region is a white balance adjustment region composed of a third reference white point that meets the third screening condition and is selected from the pixels of the original image.

[0065] The first filtering condition can be a reference white point corresponding to a specific color temperature, used to filter reference white points in different scenarios at that specific color temperature; the second filtering condition can be a reference white point corresponding to various color temperatures, used to filter reference white points in different scenarios at different color temperatures, where the difference between the different color temperatures meets a preset condition; the third filtering condition can be a reference white point corresponding to the target scenario, such as the current acquisition scenario, and can be used to filter reference white points in target scenarios at various color temperatures.

[0066] Specifically, under different color temperature conditions, the colors in the original image generally change and may deviate from the original colors of the objects. For example, under the low color temperature condition of 2600K light source indoors, pure white objects appear yellowish; while under the high color temperature condition of 10000K light source on a sunny day, pure white objects appear bluish. Therefore, it is necessary to adjust the white balance of images during or after acquisition to ensure that objects in the image retain their original colors.

[0067] Unlike existing local white balance methods that rely solely on a single selection criterion to identify reference white points in an image and then use the regions formed by these reference white points to statistically analyze color cast for white balance adjustment, this method avoids potential misjudgments and misadjustments at specific color temperatures—the color temperatures users are most concerned about. In this embodiment, multiple categories of white balance adjustment regions are effectively selected from the original image by using selection criteria corresponding to different color temperatures and scenes. Based on these multiple categories of white balance regions, the color cast of the original image is accurately statistically analyzed, enabling accurate white balance adjustment. The following provides a detailed explanation of how the original image is divided into regions to obtain these multiple categories of white balance adjustment regions.

[0068] In one embodiment, dividing the original image into regions to obtain a first region, a second region, and a third region in the original image includes: obtaining a reference gain value, wherein the reference gain value is the gain value when achieving image white balance at a reference color temperature, and the reference color temperature is the color temperature of interest to the user; and dividing the original image into regions according to the reference gain value to obtain the first region, the second region, and the third region.

[0069] The reference gain value is the gain value (color gain) of the RGB three channels when the white balance of the image is accurately achieved at the reference color temperature. In the embodiments of this disclosure, the reference color temperature is the color temperature corresponding to a specific color temperature, which can be the color temperature that the user focuses on. For example, since the misjudgment of the reference white point is prone to occur in certain special scenarios at room temperature, an indoor 5000K light source can be used as the reference color temperature.

[0070] The reference gain value can be obtained by performing white balance adjustment on the acquired image containing white objects, and using the gain value used to achieve the white balance of the image as the reference gain value.

[0071] Please refer to Figure 2 This is a schematic diagram of the process of dividing an image into regions provided in the embodiments of this disclosure. The following is in conjunction with... Figure 2 This section explains how to divide the original image into regions to obtain the first, second, and third regions.

[0072] The step of dividing the original image into regions based on the reference gain value to obtain the first region, the second region, and the third region includes the following steps S1210-S1250.

[0073] Step S1210: Calculate the red, blue, and green component values ​​of each pixel in the original image under the influence of the reference gain value.

[0074] Specifically, in the embodiments of this disclosure, the color of each pixel in the original image is first readjusted based on the reference gain value obtained at the reference color temperature, so as to filter out the influence of other environmental factors on the image color while restoring the original color of each pixel as much as possible.

[0075] The calculation of the red, blue, and green component values ​​of each pixel in the initial image under the action of the reference gain value can be achieved by adding the red, blue, and green component values ​​of each pixel to the gain value of its corresponding component.

[0076] Step S1220: Select pixels from the original image whose red, green, and blue component values ​​satisfy the first screening condition as the first reference white points.

[0077] The first filtering condition is used to filter reference white points from the original image under different scenes at the reference color temperature.

[0078] The first filtering condition can be represented by the following expression 1:

[0079] Expression 1: ;

[0080] Where R, G, and B represent the red, green, and blue component values ​​of each pixel in the original image on the color channel, respectively. , , This is the first judgment threshold obtained from testing under different scenarios with the reference color temperature.

[0081] Specifically, the first reference white point can be a pixel in the original image whose corresponding red, green, and blue component values ​​satisfy the above expression 1.

[0082] Step S1230: Select the pixels whose red, green and blue component values ​​meet the second screening condition as the second reference white points.

[0083] The second filtering condition is used to filter the reference white points of the original image under different scenes at different color temperatures, and the color temperature difference between the different color temperatures meets the preset conditions.

[0084] The second filtering condition can be expressed as the following expression 2:

[0085] Expression 2: ;

[0086] Where R, G, and B represent the red, green, and blue component values ​​of each pixel in the original image on the color channel, respectively. , , , , To obtain the second judgment threshold under different color temperatures and different scenarios, the difference between the different color temperatures must meet preset conditions. For example, the second judgment threshold can be obtained by testing under different scenarios with various light sources such as D65 (corresponding to a 6500K light source), U30 (corresponding to a 3000K light source), and F (corresponding to an 1800K light source). In specific implementation, the second judgment threshold can be obtained by testing in multiple scenarios such as indoor and outdoor environments using a color temperature chamber. The specific testing process will not be described here.

[0087] Step S1240: Select the pixels whose red, green and blue component values ​​meet the third filtering condition as the third reference white points.

[0088] The third filtering condition is used to filter the reference white points of the original image under target scenes with different color temperatures, and the color temperature difference between the different color temperatures meets the preset conditions.

[0089] In this embodiment, the target scene can be the scene corresponding to the electronic device when it acquires the image, that is, the current scene.

[0090] The third filtering condition can be expressed as the following expression 3:

[0091] Expression 3: ;

[0092] Where R, G, and B represent the red, green, and blue component values ​​of each pixel in the original image on the color channel, respectively. , , The third judgment threshold is obtained by testing in target scenes with different color temperatures. Please refer to the description above for relevant information on different color temperatures, which will not be repeated here.

[0093] Please refer to Figure 3 This is a schematic diagram illustrating the process of obtaining the judgment threshold in the third filtering condition provided in the embodiments of this disclosure. For example... Figure 3 As shown, in specific implementation, the steps can be set first in step S3100. , , The initial value is 0. By executing step S3200, i.e., setting or switching different color temperatures, the thresholds corresponding to each judgment condition in the filtering conditions are modified under the current scene with different color temperatures to accurately calibrate the reference white point in the image. It should be noted that in specific implementation, this... , , The smaller the values ​​of the three thresholds, the more accurate the filtering results of the reference white point will be, but it will also make color temperature switching more difficult. Therefore, the values ​​of the three thresholds need to be set as needed.

[0094] Additionally, it should be noted that in practice, other filtering conditions can also be used to filter the first, second, and third reference white points from the original image, which will not be elaborated here.

[0095] Step S1250: Divide the original image into regions based on the first reference white point, the second reference white point, and the third reference white point to obtain the first region, the second region, and the third region.

[0096] After obtaining the first reference white point, second reference white point, and third reference white point in the original image through steps S1210-S1250, the area formed by the first reference white point can be designated as the first region, the area formed by the second reference white point as the second region, and the area formed by the third reference white point as the third region, respectively, to effectively divide the original image into white balance regions. Of course, in specific implementations, without departing from the inventive concept of this application, other categories of white balance region division can be performed on the original image based on screening conditions corresponding to other color temperatures, so as to make the white balance adjustment method provided by this application adaptable to more scenarios.

[0097] After step S1200, step S1300 is executed, in which the white balance of the original image is adjusted according to the first region, the second region and the third region to obtain the target image.

[0098] Please refer to Figure 4 This is a schematic diagram of white balance adjustment processing provided in an embodiment of this disclosure. Figure 4 As shown, in this embodiment, the step of adjusting the white balance of the original image based on the first region, the second region, and the third region to obtain the target image includes steps S1310-S1330.

[0099] Step S1310: Obtain a first number of first reference white points and a second number of second reference white points, wherein the first reference white points are reference white points in the first region and the second reference white points are reference white points in the second region.

[0100] The first quantity is the total number of the first reference white points in the first region; the second quantity is the total number of the second reference white points in the second region; and the third quantity is the total number of the third reference white points in the third region.

[0101] Step S1320: Determine the target region from the first region, the second region, and the third region based on the first quantity and the second quantity.

[0102] In this embodiment, based on the first quantity and the second quantity, one category of the regions obtained by dividing the original image into regions is selected as the target region, and the white balance of the original image is adjusted once based on the target region. After the white balance adjustment, the target region can be redefined and the white balance adjustment can be performed again. In this way, the white balance adjustment of the original image is completed through multiple iterations.

[0103] Please continue reading. Figure 4 In one embodiment, determining a target region from the first region, the second region, and the third region based on the first quantity and the second quantity includes: step S1321, if the first quantity is greater than a first preset threshold, then the first region is determined as the target region; and step S1322, if the first quantity is not greater than the first preset threshold and the second quantity is greater than a second preset threshold, then the second region is determined as the target region.

[0104] In practice, the first preset threshold and the second preset threshold can be set as needed, and no special restrictions are imposed here.

[0105] Step S1330: Adjust the white balance of the original image according to the target region to obtain the target image.

[0106] Please continue reading. Figure 4 In one embodiment, the step of adjusting the white balance of the original image according to the target region to obtain the target image includes: step S1331, adjusting the white balance of the original image once according to the target region; and after the white balance adjustment, step S1332, obtaining a third number of third reference white points in the third region; and step S1333, redetermining the target region according to the third number, and adjusting the white balance of the original image again according to the redetermined target region to obtain the target image.

[0107] Specifically, in the embodiments of this application, after determining the target area and performing a white balance adjustment on the original image based on the determined target area, the target area can be re-determined based on the total number of third reference white points in the third area, i.e., the third quantity, so as to perform another white balance adjustment on the original image, thereby avoiding the misadjustment problem that may be caused to the original image under different scene conditions with different color temperatures.

[0108] In one embodiment, the step of redetermining the target region based on the third quantity and adjusting the white balance of the original image again based on the redetermined target region includes: if the third quantity is greater than a third preset threshold, then redetermining the third region as the target region and re-executing the step of adjusting the white balance of the original image based on the target region to obtain the target image; and if the third quantity is not greater than the third preset threshold, then executing the above step S1320 again, that is, determining the target region from the first region, the second region and the third region based on the first quantity and the second quantity.

[0109] As can be seen from the above description, the method provided in this application embodiment divides the original image into regions and, based on the obtained three categories of regions, iteratively adjusts the white balance of the original image through the above steps S1310-S1330 to accurately obtain a target image that maintains the original color of the object.

[0110] The above provides a detailed explanation of how to determine the target region from the first, second, and third regions. The following section details how to adjust the white balance of the original image based on the target region after obtaining it.

[0111] Please refer to Figure 5 This is a schematic diagram illustrating white balance adjustment of the original image provided in an embodiment of this disclosure. Figure 5 As shown, the white balance adjustment of the target area includes: step S5100, obtaining a first average value, a second average value, and a third average value of each color component of all pixels in the target area, wherein the first average value is the average value of the red component of all pixels, the second average value is the average value of the green component of all pixels, and the third average value is the average value of the blue component of all pixels; step S5200, obtaining a first white balance gain value and a second white balance gain value based on the first average value, the second average value, and the third average value; step S5300, adjusting the value of the red component of all pixels in the original image based on the first white balance gain value, and adjusting the value of the blue component of all pixels in the original image based on the second white balance gain value.

[0112] The step of obtaining a first white balance gain value and a second white balance gain value based on the first average value, the second average value, and the third average value includes: obtaining the ratio of the first average value and the second average value as the first white balance gain value when the second average value is not zero; and obtaining the ratio of the third average value and the second average value as the second white balance gain value.

[0113] Specifically, after determining the target area, the average value of the pixels in that target area across each color channel can be obtained first, i.e., the first average value. , , and with For reference, through comparison and , and The size relationship is used to statistically analyze the overall color cast of the original image, and by calculating separately... and The ratio, and The ratio is obtained, and the target gain value corresponding to the original image is calculated. This target gain value includes the first white balance gain value corresponding to the red component of the pixel. And the second white balance gain value corresponding to the blue component of the pixel. After obtaining the target gain value, the values ​​of each pixel in the original image can be updated to perform a white balance adjustment on the original image.

[0114] In summary, the white balance adjustment method provided in this embodiment, after acquiring the original image to be processed, divides the original image into regions. In order to select the true white points from the original image as reference white points, the embodiments of this disclosure use different filtering conditions to effectively divide the original image into regions. Based on the obtained first region, second region and third region, the white balance of the original image is adjusted, thereby accurately realizing the automatic white balance of the image and avoiding misjudgment and misadjustment problems that may occur in specific scenes with specific color temperatures.

[0115] <Equipment Example>

[0116] Corresponding to the above method embodiments, this embodiment also provides an electronic device, please refer to... Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.

[0117] like Figure 6 As shown, the electronic device 6000 may include a processor 6200 and a memory 6100, the memory 6100 being used to store executable instructions; the processor 6200 being used to operate the electronic device according to the instructions to perform a white balance adjustment method according to any embodiment of the present disclosure.

[0118] <Media Example>

[0119] Corresponding to the above embodiments, this embodiment also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the methods described in any of the above embodiments of this disclosure.

[0120] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.

[0121] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0122] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0123] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0124] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0125] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0126] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0127] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation in a combination of software and hardware are equivalent.

[0128] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of this disclosure is defined by the appended claims.

Claims

1. A white balance adjustment method, characterized in that, include: Obtain the original image to be processed; The original image is divided into regions to obtain a first region, a second region, and a third region in the original image. The first region, the second region, and the third region are regions composed of reference white points selected from the pixels of the original image under different filtering conditions. Obtain a first number of first reference white points and a second number of second reference white points, wherein the first reference white points are reference white points in the first region and the second reference white points are reference white points in the second region; If the first quantity is greater than the first preset threshold, then the first region is determined as the target region; and, If the first quantity is not greater than the first preset threshold, and the second quantity is greater than the second preset threshold, then the second region is determined as the target region; Based on the target region, perform a white balance adjustment on the original image; And after the white balance adjustment, obtain the third number of third reference white points in the third region; Based on the third quantity, the target region is redefined, and based on the redefined target region, the white balance of the original image is adjusted again to obtain the target image.

2. The method according to claim 1, characterized in that, The step of dividing the original image into regions to obtain a first region, a second region, and a third region in the original image includes: Obtain a reference gain value, wherein the reference gain value is the gain value when the image white balance is achieved at a reference color temperature, and the reference color temperature is the color temperature of interest to the user; Based on the reference gain value, the original image is divided into regions to obtain the first region, the second region, and the third region.

3. The method according to claim 2, characterized in that, The step of dividing the original image into regions based on the reference gain value to obtain the first region, the second region, and the third region includes: Calculate the red, blue, and green component values ​​of each pixel in the original image under the influence of the reference gain value; From the original image, pixels whose red, green, and blue component values ​​meet the first screening condition are selected as first reference white points, pixels whose red, green, and blue component values ​​meet the second screening condition are selected as second reference white points, and pixels whose red, green, and blue component values ​​meet the third screening condition are selected as third reference white points. The original image is divided into regions based on the first reference white point, the second reference white point, and the third reference white point, respectively, to obtain the first region, the second region, and the third region; Wherein, the first filtering condition is used to filter reference white points from the original image under different scenes at the reference color temperature, the second filtering condition is used to filter reference white points from the original image under different scenes at different color temperatures, and the third filtering condition is used to filter reference white points from the original image under target scenes at different color temperatures, and the color temperature difference between the different color temperatures meets a preset condition.

4. The method according to claim 1, characterized in that, The step of redetermining the target region based on the third quantity, and then adjusting the white balance of the original image again based on the redetermined target region, includes: If the third quantity is greater than a third preset threshold, then the third region is redefined as the target region, and the step of adjusting the white balance of the original image according to the target region to obtain the target image is re-executed; and, If the third quantity is not greater than the third preset threshold, then the step of determining the target region from the first region, the second region, and the third region based on the first quantity and the second quantity is executed again.

5. The method according to claim 1 or 4, characterized in that, The step of adjusting the white balance of the original image based on the target region includes: Obtain the first average value, the second average value, and the third average value of each color component of all pixels in the target area, wherein the first average value is the average value of the red component of all pixels, the second average value is the average value of the green component of all pixels, and the third average value is the average value of the blue component of all pixels. Based on the first average value, the second average value, and the third average value, a first white balance gain value and a second white balance gain value are obtained; Based on the first white balance gain value, the values ​​of the red components of all pixels in the original image are adjusted, and based on the second white balance gain value, the values ​​of the blue components of all pixels in the original image are adjusted.

6. The method according to claim 5, characterized in that, The step of obtaining the first white balance gain value and the second white balance gain value based on the first average value, the second average value, and the third average value includes: If the second average value is not zero, the ratio of the first average value to the second average value is taken as the first white balance gain value; and, The ratio of the third average value to the second average value is obtained as the second white balance gain value.

7. An electronic device, characterized in that, include: Memory is used to store executable instructions; A processor, configured to operate the electronic device according to the instructions to perform the method as described in any one of claims 1-6.

8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • White block hypothesis based automatic white balance method of digital camera device

    CN104618702A

  • White balance processing method and device based on RGB space

    CN106131526A

  • Method and system for adjusting white balance, and display

    CN108965846A

  • White balance correction device and white balance correction method

    CN1443009A

  • Apparatus and method for adjusting automatic white balance by detecting effective area

    US20110050948A1