White balance correction method, electronic device, storage medium, and computer program product

By obtaining the color coordinates of the initial and target white points and calculating the change in gain value using a preset color component model, the corrected gain value is directly determined, which solves the problems of long white balance correction time and low efficiency in the existing technology and achieves more efficient correction.

CN118714468BActive Publication Date: 2026-05-19GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGZHOU SHIYUAN ELECTRONICS CO LTD
Filing Date
2023-03-27
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, the white balance correction process requires continuous measurement and adjustment of the gain value, resulting in long correction time and low efficiency.

Method used

By obtaining the color coordinates of the initial white point and the target white point, and using a preset color component model, the change in the gain value of the color components is calculated, and the corrected gain value is directly determined, simplifying the correction process.

Benefits of technology

It shortens the white balance correction time and improves correction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714468B_ABST
    Figure CN118714468B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, and discloses a white balance correction method, an electronic device, a storage medium and a computer program product. The white balance correction method comprises the following steps: obtaining color coordinates of an initial white point and color coordinates of a target white point; determining the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point according to the relative position of the color coordinates of the target white point; determining the change amount of the gain value of at least one color component based on a preset model of color components, so as to correct the preset gain value of each color component corresponding to the initial white point; and determining the gain value of the corrected color component. The application can shorten the correction time of white balance correction and improve the correction efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a white balance correction method, electronic device, storage medium, and computer program product. Background Technology

[0002] The human eye has an automatic adjustment function under different light sources, adapting and correcting itself to ensure that white objects remain white. However, digital recording devices, such as digital cameras and camcorders, can only represent the proportion of light reflected from an object. A single color will appear different under different light sources. Therefore, under greenish fluorescent lights, a white object will appear greenish, while under yellowish streetlights, a white object will appear yellowish. Digital recording devices can produce serious color difference problems, and automatic white balance (AWB) was developed to solve this problem.

[0003] White balance correction refers to detecting the white that has the greatest change in the color of an object due to the light source in the environment corresponding to the input image data (i.e., the environment captured in the image), determining the color temperature from the red / green / blue (RGB) contrast ratio of the detected white, correcting the red (R) and blue (B) based on the color temperature with reference to the detected white, and changing the overall color perception to adjust the color balance.

[0004] In the display industry, due to fluctuations in the consistency between backlight and LCD screen, factories cannot guarantee the color temperature consistency of every display unit during production. For example, some units may have a warmer color tone for white areas, while others may have a cooler color tone. To ensure color temperature consistency, an automatic white balance calibration process is added during production.

[0005] Currently, white balance calibration typically involves directly measuring the white point coordinates of the display device, then performing logical judgments based on the relative position of the target coordinate point, and successively correcting the gain values ​​of the red, green, and blue components. The white point coordinates are then measured again, and this process is repeated until the white balance calibration specifications are met. Because this requires continuous individual gain correction and white point coordinate measurement, the white balance calibration process is time-consuming and inefficient. Summary of the Invention

[0006] This application provides a white balance correction method, electronic device, storage medium, and computer program product to simplify the white balance correction process, shorten the white balance correction time, and improve correction efficiency.

[0007] The embodiments of this application provide the following technical solutions:

[0008] In a first aspect, embodiments of this application provide a white balance correction method, which includes:

[0009] Obtain the color coordinates of the initial white point, where the initial white point corresponds to the preset gain value of each color component;

[0010] Obtain the color coordinates of the target white point;

[0011] Based on the color coordinates of the initial white point and the color coordinates of the target white point, determine the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point;

[0012] Based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on the model of the preset color components, determine the change in the gain value of at least one color component.

[0013] The gain value of the corrected color component is determined based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component.

[0014] In some embodiments, the method further includes:

[0015] Constructing a model for the preset color components specifically includes:

[0016] Obtain the first color component, the second color component, and the third color component, wherein the first color component, the second color component, and the third color component correspond one-to-one with one of the red component, the green component, and the blue component;

[0017] Set the gain value of the first color component to a fixed value, and obtain the value range of the gain value of the second color component and the value range of the gain value of the third color component.

[0018] Based on the range of gain values ​​for the second color component and the range of gain values ​​for the third color component, determine the step change of the horizontal axis and the step change of the vertical axis of the color coordinate corresponding to the gain value of the third color component.

[0019] Iterate through the red, green, and blue components to construct a model of the preset color components.

[0020] In some embodiments, determining the step change of the horizontal axis and the step change of the vertical axis of the color coordinate corresponding to the gain value of the third color component based on the value range of the gain value of the second color component and the value range of the gain value of the third color component includes:

[0021] Based on the range of gain values ​​for the second color components, determine the gain values ​​for multiple second color components;

[0022] Based on the gain value of each second color component, the gain values ​​of multiple third color components are determined.

[0023] Determine the step change amount of the x-axis and y-axis of the color coordinate corresponding to the gain value of each third color component, and obtain multiple step change amount curves of the x-axis and y-axis of the color coordinate corresponding to the third color components. Each step change amount curve corresponds to the gain value of a first color component and the gain value of a second color component.

[0024] In some embodiments, traversing the red component, green component, and blue component to construct a model of the color components includes:

[0025] Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of multiple red components.

[0026] Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of multiple green components.

[0027] Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of multiple blue components.

[0028] Each step change curve corresponds to a step change function, and the preset color component model includes the step change function corresponding to each step change curve.

[0029] In some embodiments, the method further includes:

[0030] Obtain multiple first-color coordinates corresponding to the red component, multiple second-color coordinates corresponding to the green component, and multiple third-color coordinates corresponding to the blue component;

[0031] Based on multiple first color coordinates and the color coordinates of the initial white point, the equation of the first straight line is obtained by fitting.

[0032] Based on multiple secondary color coordinates and the color coordinates of the initial white point, the equation of the second straight line is obtained by fitting.

[0033] Based on multiple third color coordinates and the color coordinates of the initial white point, the equation of the third straight line is obtained by fitting.

[0034] Based on the first, second, and third line equations, the color coordinate system is divided into three color zones, where each color zone corresponds to at least one color component to be adjusted.

[0035] In some embodiments, based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on a preset color component model, the change in the gain value of at least one color component is determined, including:

[0036] Based on the color coordinates of the target white point, determine the color zone where the color coordinates of the target white point are located;

[0037] Based on the color partition, identify at least one color component to be adjusted;

[0038] Based on the relative position and difference between the initial white point and the target white point, and based on the model of the preset color components, determine the change in the gain value of at least one color component to be adjusted.

[0039] In some embodiments, based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on a preset color component model, the change in the gain value of at least one color component to be adjusted is determined, including:

[0040] Based on the difference between the x-coordinate and y-coordinate of the initial white point and the target white point, determine the gain value of at least one color component of the target white point;

[0041] Based on the gain value of at least one color component of the target white point, and based on a preset color component model, determine multiple step changes in the horizontal axis and multiple step changes in the vertical axis of at least one color component.

[0042] The cumulative step change of the x-axis of each color component is obtained by summing up the multiple step changes of the x-axis of each color component.

[0043] The cumulative step change of the ordinate of each color component is obtained by summing up the multiple step changes of the ordinate of each color component.

[0044] Based on the cumulative step change of the horizontal axis of each color component and the cumulative step change of the vertical axis of each color component, the change in the gain value of at least one color component is obtained.

[0045] In some embodiments, determining the gain value of a corrected color component based on a preset gain value for each color component corresponding to the initial white point and the change in the gain value of at least one color component includes:

[0046] The corrected gain value of each color component = the preset gain value of each color component - the change in the gain value of each color component.

[0047] In some embodiments, the method further includes:

[0048] Obtain the color coordinates corresponding to the gain value of each color component after correction;

[0049] Determine whether the color coordinates corresponding to the gain value of each color component after correction are within the preset range of the color coordinates of the target white point;

[0050] If so, then the correction was successful;

[0051] If not, then reselect the target white point, obtain the color coordinates of the target white point, and recalibrate until the color coordinates corresponding to the gain value of each color component after calibration are within the preset range of the color coordinates of the target white point.

[0052] Secondly, embodiments of this application provide an electronic device, including:

[0053] At least one processor; and

[0054] A memory that is communicatively connected to at least one processor; wherein,

[0055] The memory stores instructions that can be executed by at least one processor, such that the at least one processor is able to perform a white balance correction method as described in the first aspect.

[0056] Thirdly, embodiments of this application provide a non-volatile computer-readable storage medium storing computer-executable instructions for causing an electronic device to perform a white balance correction method as described in the first aspect.

[0057] Fourthly, embodiments of this application provide a computer program product comprising program instructions that, when executed by one or more processors in an electronic device, cause the electronic device to perform the white balance correction method as described in the first aspect.

[0058] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a white balance correction method, which includes: obtaining the color coordinates of an initial white point; obtaining the color coordinates of a target white point; determining the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point; determining the change in the gain value of at least one color component based on a preset color component model, according to the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point; and determining the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component.

[0059] By obtaining the color coordinates of the initial white point and the target white point, and determining the change in the gain value of at least one color component based on the relative position of the color coordinates of the target white point, and determining the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component, this application can shorten the correction time of white balance correction and improve the correction efficiency. Attached Figure Description

[0060] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0061] Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;

[0062] Figure 2 This is a schematic flowchart of a white balance correction method provided in an embodiment of this application;

[0063] Figure 3 This is a schematic diagram of CIE chromaticity coordinates provided in an embodiment of this application;

[0064] Figure 4 This is a schematic diagram of a process for constructing a preset color component model provided in an embodiment of this application;

[0065] Figure 5 yes Figure 4 A detailed flowchart of step S403 in the process;

[0066] Figure 6 yes Figure 4 A detailed flowchart of step S404 in the process;

[0067] Figure 7 This is a schematic diagram of a process for dividing a color coordinate system into three color partitions, provided in an embodiment of this application.

[0068] Figure 8 This is a schematic diagram of a coordinate system with three color zones provided in an embodiment of this application;

[0069] Figure 9 yes Figure 2 A detailed flowchart of step S204 in the process;

[0070] Figure 10 yes Figure 12 A detailed flowchart of step S243 in the process;

[0071] Figure 11This is a schematic diagram illustrating the relative positions of an initial white point and a target white point, provided in an embodiment of this application.

[0072] Figure 12 yes Figure 2 A detailed flowchart of step S205 in the process;

[0073] Figure 13 This is a schematic diagram of a process for determining whether white balance correction is successful, provided in an embodiment of this application.

[0074] Figure 14 This is a schematic diagram of the structure of a white balance correction device provided in an embodiment of this application;

[0075] Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0076] Explanation of icon numbers:

[0077] Detailed Implementation

[0078] To facilitate understanding of this application, a more detailed description is provided below with reference to the accompanying drawings and specific embodiments. It should be noted that when an element is described as "fixed to" another element, it can be directly on the other element, or one or more intermediate elements may exist between them. When an element is described as "connected to" another element, it can be directly connected to the other element, or one or more intermediate elements may exist between them. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this specification are for illustrative purposes only.

[0079] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.

[0080] The technical solution of this application will be described in detail below with reference to the accompanying drawings:

[0081] Please see Figure 1 , Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;

[0082] like Figure 1As shown, the application environment 100 includes: a camera device 10, an electronic device 20, and a display device 30 to be calibrated. The camera device 10 and the electronic device 20 are connected via network communication, and the electronic device 20 and the display device 30 to be calibrated are also connected via network communication. This network includes wired networks and / or wireless networks. It is understood that the network includes wireless networks such as 2G, 3G, 4G, 5G, Wi-Fi, and Bluetooth, and may also include wired networks such as serial cables and network cables.

[0083] In this embodiment of the application, the camera device 10 is used to acquire image data of the display device 30 to be calibrated, wherein the image data includes the color coordinates of the initial white point, and transmits the acquired image data to the electronic device 20 via network communication. The electronic device 20 is used to perform white balance correction on the image data, and then sends the successfully calibrated image data to the display device 30 to be calibrated. The display device 30 to be calibrated is used to receive the successfully calibrated image data sent by the electronic device 20, and display the image after successful white balance correction.

[0084] It should be noted that the camera device 10 can be any camera-related product such as an industrial camera, digital camera, or webcam; the electronic device 20 can be any electronic product such as a computer or mobile phone; and the display can be any display-related product such as a CRT, LCD, or OLED. This application does not impose any restrictions on these.

[0085] In this embodiment, the electronic device 20 further includes a communication module and a communication connection server, used to receive data or instructions sent by the camera device 10, such as receiving image data sent by the camera device 10; or, to send instructions to the camera device 10, such as sending an instruction to the camera device 10 to capture an image. In this embodiment, the communication module can realize communication with the Internet, and the communication module includes, but is not limited to, communication units such as a WIFI module, a ZigBee module, an NB-IoT module, a 4G module, a 5G module, and a Bluetooth module.

[0086] In this embodiment, the electronic device 20 includes a controller, which serves as the control core of the electronic device 20. The controller is used to control the electronic device 20 to acquire the color coordinates of the initial white point of the image data, wherein the initial white point corresponds to a preset gain value for each color component; acquire the color coordinates of the target white point; determine the relative position and difference between the color coordinates of the initial white point and the target white point based on the color coordinates of the initial white point and the target white point; determine the change in the gain value of at least one color component based on the relative position and difference between the color coordinates of the initial white point and the target white point, and based on a preset color component model; and determine the corrected gain value of the color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component.

[0087] In the embodiments of this application, the controller can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a microcontroller, an ARM (Acorn RISC Machine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components. The controller can also be any conventional processor, controller, microcontroller, or state machine. The controller can also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration, or one or more combinations of a microcontroller unit (MCU), a field-programmable gate array (FPGA), and a system-on-chip (SoC).

[0088] It is understood that the electronic device 20 in this application embodiment also includes a storage module, which includes, but is not limited to, one or more of the following devices: FLASH flash memory, NAND flash memory, vertical NAND flash memory (VNAND), NOR flash memory, resistive random access memory (RRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), spin-transfer torque random access memory (STT-RAM).

[0089] Please see Figure 2 , Figure 2 This is a schematic flowchart of a white balance correction method provided in an embodiment of this application;

[0090] This white balance correction method is applied to electronic devices such as computers, mobile phones, monitors, and televisions. Specifically, the execution entity of this white balance correction method is one or at least two processors of the electronic device.

[0091] like Figure 2 As shown, the white balance correction method includes:

[0092] Step S201: Obtain the color coordinates of the initial white point;

[0093] Please refer to the following: Figure 3 , Figure 3 This is a schematic diagram of CIE chromaticity coordinates provided in an embodiment of this application;

[0094] like Figure 3As shown, the CIE chromaticity diagram is a horseshoe-shaped curve represented by the xy-plane, representing a two-dimensional projection of the chromaticity space. The x-axis represents the red component, and the y-axis represents the green component. Since all natural colors, including those generated by displays, can be quantitatively analyzed and represented by chromaticity values ​​x and y, that is, by chromaticity coordinates (x, y), different colors appear as... Figure 3 The white point of a monitor is a point in the color coordinate system shown, and all values ​​fall within a cone in the positive XY quadrant. The white point of a monitor is usually defined by a set of chromaticity values ​​representing the colors produced by the monitor when it generates all available colors at full power. In other words, it is the color coordinate corresponding to when the monitor displays RGB(128, 128, 128), at which point the monitor displays white, which is the white screen of the monitor.

[0095] In this embodiment, an electronic device acquires the spectrum P(λ) of the initial white point of the display device to be calibrated. Then, the spectrum P(λ) is multiplied by the tristimulus functions X(A), Y(A), and Z(A) according to their corresponding wavelengths and summed to obtain the tristimulus values ​​X, Y, and Z. Using the color coordinate calculation formulas x=X / (X+Y+Z) and y=Y / (X+Y+Z), and based on the CIE chromaticity coordinate diagram, the color coordinates of the initial white point are determined. The initial white point corresponds to a preset gain value for each color component. It should be noted that this initial white point is a point where the gain values ​​for the red, green, and blue components are all 128.

[0096] Step S202: Obtain the color coordinates of the target white point;

[0097] Specifically, the color coordinates of the target white point are related to the color temperature. The color coordinates of the target white point are set according to the specific color temperature requirements. For example, if a color temperature of 9300K is required, the color coordinates corresponding to a color temperature of 9300K are x=0.285 and y=0.293.

[0098] Step S203: Determine the relative position and difference between the color coordinates of the initial white point and the target white point based on the color coordinates of the initial white point and the target white point;

[0099] Specifically, assuming the initial white point's color coordinates are (x1, y1) and the target white point's color coordinates are (x2, y2), the relative positions and differences between the initial and target white point's color coordinates can be obtained using the formulas: Δx = x2 - x1, Δy = y2 - y1.

[0100] It is understandable that once the color coordinates of the initial white point and the target white point are obtained, the relative position of the two color coordinates is also determined accordingly, and the coordinate difference between the two color coordinates can be calculated.

[0101] Step S204: Based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, determine the change in the gain value of at least one color component based on the preset color component model.

[0102] Please refer to the following: Figure 4 , Figure 4 This is a schematic diagram of a process for constructing a preset color component model provided in an embodiment of this application;

[0103] like Figure 4 As shown, the process of constructing a preset color component model includes:

[0104] Step S401: Obtain the first color component, the second color component, and the third color component;

[0105] Specifically, the electronic device acquires the first color component, the second color component, and the third color component of the prototype display image, wherein the first color component, the second color component, and the third color component correspond one-to-one with one of the red component, the green component, and the blue component.

[0106] In this embodiment, R gain, G gain, and B gain values ​​within a preset range are acquired using an electronic device. The R gain value ranges from [60, 128], the G gain value ranges from [60, 128], and the B gain value ranges from [60, 128]. Therefore, a total of 68 image modes are acquired. 68 There are 68 groups, and each group of image modes corresponds to a color coordinate value (x, y).

[0107] Step S402: Set the gain value of the first color component to a fixed value, and obtain the value range of the gain value of the second color component and the value range of the gain value of the third color component.

[0108] Specifically, the gain value of one of the three color components (first, second, and third color components) is set to a fixed value, and the range of gain values ​​for the other two color components is obtained. For example, if the gain value of the first color component is set to a fixed value, then the range of gain values ​​for the second and third color components is obtained. For instance, if the first color component is red, the second color component is green, and the third color component is blue.

[0109] In this embodiment of the application, the gain values ​​of the first color component, the second color component, and the third color component are preset to [60, 128].

[0110] Step S403: Based on the range of the gain value of the second color component and the range of the gain value of the third color component, determine the step change of the horizontal axis and the step change of the vertical axis of the color coordinate corresponding to the gain value of the third color component.

[0111] Please refer to the following: Figure 5 , Figure 5 yes Figure 4 A detailed flowchart of step S403 in the process;

[0112] like Figure 5 As shown, step S403 includes:

[0113] Step S4031: Determine the gain values ​​of multiple second color components based on the range of the gain values ​​of the second color components;

[0114] Specifically, in this embodiment, the unit length of the gain value of the second color component is 1, meaning that the gain value of the second color component gradually changes from 60 to 128 with a unit length of 1. In the subsequent model building process, since multiple gain values ​​of the second color component are determined, multiple curves showing the change in the gain value of the third color component with respect to the gain value of the third color component can be obtained.

[0115] Step S4032: Determine the gain values ​​of multiple third color components based on the gain value of each second color component;

[0116] Specifically, since the gain value of the first color component remains constant, and the gain value of the second color component has a fixed range of values, multiple gain values ​​for the third color component can be determined. The gain value of the third color component corresponds to a range of values; for example, the range of the gain value of the third color component is [60, 128].

[0117] Step S4033: Determine the step change of the abscissa and ordinate of the color coordinate corresponding to the gain value of each third color component, and obtain the step change curves of the abscissa and ordinate of the color coordinate corresponding to multiple third color components.

[0118] Specifically, based on the gain value ranges of the second and third color components, the step change curve of the chromatic coordinates corresponding to the gain value of the third color component is determined. Vector decomposition of the step change curve of the chromatic coordinates corresponding to the gain value of the third color component yields the step change curves for both the horizontal and vertical axes. Similarly, based on the gain value ranges of the second and third color components, the step change curve of the chromatic coordinates corresponding to the gain value of the second color component is determined. Vector decomposition of the step change curve of the chromatic coordinates corresponding to the gain value of the second color component yields the step change curves for both the horizontal and vertical axes. Fitting these step change curves for both the horizontal and vertical axes yields a univariate sixth-degree function.

[0119] .

[0120] In this univariate sixth-degree function, the independent variable x is the gain value of a certain color component, and the dependent variable... This represents the step change of the x-axis or y-axis of the color coordinate system corresponding to the gain value of a certain color component.

[0121] Since the difference vector between the initial white point's color coordinates and the target white point's color coordinates needs to be decomposed into components on the horizontal and vertical axes, this application obtains a first color component, a second color component, and a third color component. The gain value of the first color component is set to a fixed value, and the ranges of the gain values ​​of the second and third color components are obtained. Based on these ranges, the step change of the horizontal and vertical coordinates corresponding to the gain value of the third color component is determined. This allows the application to calculate the corrected gain value of the color component in subsequent white balance correction operations by combining the curves of the step change of the horizontal and vertical coordinates of the components that need to be decomposed into the difference vector between the initial and target white point's color coordinates.

[0122] Step S404: Traverse the red component, green component, and blue component to construct a model of the preset color components;

[0123] Please refer to the following: Figure 6 , Figure 6 yes Figure 4 A detailed flowchart of step S404 in the process;

[0124] like Figure 6 As shown, step S404 includes:

[0125] Step S4041: Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of multiple red components.

[0126] Step S4042: Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of multiple green components.

[0127] Step S4043: Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of multiple blue components.

[0128] Specifically, based on the gain values ​​of multiple color components acquired by the electronic device, the color coordinates corresponding to the gain values ​​of multiple color components are obtained. The change in the gain value of the color components can be vector-decomposed into components on the x and y axes in the coordinate system, thereby determining the step change curves of the horizontal and vertical coordinates of the color coordinates corresponding to the gain values ​​of multiple color components. Each step change curve corresponds to a step change function, and the preset color component model includes the step change function corresponding to each step change curve.

[0129] It should be noted that steps S4041, S4042, and S4043 can be performed separately or simultaneously, and this application does not limit the order of the steps.

[0130] By acquiring the first color component, the second color component, and the third color component, setting the gain value of the first color component to a fixed value, and acquiring the value ranges of the gain values ​​of the second and third color components, the step change of the horizontal and vertical coordinates of the color coordinates corresponding to the gain value of the third color component is determined. By traversing the red, green, and blue components in this way, this application can process the step change of the horizontal and vertical coordinates of each color component to obtain a preset color component model, which is beneficial for correcting each color component.

[0131] Please refer to the following: Figure 7 , Figure 7 This is a schematic diagram of a process for dividing a color coordinate system into three color partitions, provided in an embodiment of this application.

[0132] like Figure 7 As shown, the process of dividing the color coordinate system into three color zones includes:

[0133] Step S701: Obtain multiple first-color coordinates corresponding to the red component, multiple second-color coordinates corresponding to the green component, and multiple third-color coordinates corresponding to the blue component;

[0134] Specifically, in the preset color component model, multiple first color coordinates corresponding to the red component, multiple second color coordinates corresponding to the green component, and multiple third color coordinates corresponding to the blue component are obtained.

[0135] Please refer to the following: Figure 8 , Figure 8 This is a schematic diagram of a coordinate system with three color zones provided in an embodiment of this application;

[0136] like Figure 8 As shown, the positions of the initial white point and the three points R, G, and B can determine three dashed lines. These three dashed lines form three regions in pairs, which are the three color zones.

[0137] Step S702: Based on multiple first color coordinates and the color coordinates of the initial white point, fit the equation of the first straight line;

[0138] Step S703: Based on multiple second color coordinates and the color coordinates of the initial white point, fit the equation of the second straight line;

[0139] Step S704: Based on multiple third color coordinates and the color coordinates of the initial white point, fit the equation of the third straight line;

[0140] Specifically, the color coordinates of the three primary colors (red, green, and blue) are determined by a preset color component model. Within this model, multiple primary color coordinates corresponding to the red component, combined with the color coordinates of the initial white point, yield multiple straight lines passing through the initial white point. These calculated straight lines are then fitted to obtain a single straight line equation. A straight line.

[0141] Similarly, by combining the multiple first color coordinates corresponding to the green component with the color coordinates of the initial white point, multiple straight lines passing through the initial white point can be obtained. Then, by fitting these multiple calculated straight lines, a single straight line equation can be obtained. A straight line.

[0142] Similarly, by combining the multiple first color coordinates corresponding to the blue component with the color coordinates of the initial white point, multiple straight lines passing through the initial white point can be obtained. Then, by fitting these multiple calculated straight lines, a single straight line equation can be obtained. A straight line.

[0143] Steps S702, S703, and S704 can be performed separately or simultaneously. This application does not limit the order of the steps.

[0144] It should be noted that methods for fitting straight lines include, but are not limited to, least squares method, gradient descent method, Gauss-Newton method, Lehman algorithm, etc.

[0145] Step S705: Divide the color coordinate system into three color zones according to the first line equation, the second line equation, and the third line equation;

[0146] Specifically, based on the equations of the first, second, and third straight lines, the three rays emanating from the initial white point can divide the CIE chromaticity coordinate diagram into three color regions. Each color region corresponds to at least one color component to be adjusted, for example:

[0147] When the color coordinates of the target white point fall on the line equation is The equations of the lines are: When the area is enclosed by a straight line, the gain value of the blue component of the target white point remains unchanged, while the gain values ​​of the red and green components are the color components to be adjusted.

[0148] When the color coordinates of the target white point fall on the line equation is The equations of the lines are: When the area is enclosed by the straight line, the green component gain value of the target white point is determined to remain unchanged, while the red component gain value and the blue component gain value are the color components to be adjusted.

[0149] When the color coordinates of the target white point fall on the line equation is The equations of the lines are: When the area is enclosed by a straight line, the red component gain value of the target white point remains unchanged, while the green and blue component gain values ​​are the color components to be adjusted.

[0150] When the color coordinates of the target white point fall on the line equation is When the target white point is on a straight line, the green and blue component gain values ​​are determined to remain unchanged, while the red component gain value is the color component to be adjusted.

[0151] When the color coordinates of the target white point fall on the line equation is When the target white point is on a straight line, the gain values ​​of the red and blue components remain unchanged, while the gain value of the green component is the color component to be adjusted.

[0152] When the color coordinates of the target white point fall on the line equation is When the target white point is on a straight line, the red and green component gain values ​​are determined to remain unchanged, while the blue component gain value is the color component to be adjusted.

[0153] By dividing the color coordinate system into three color zones using the first, second, and third straight lines, this application can determine which color component's gain value remains unchanged and at least one color component to be adjusted based on the region where the target white point is located. The corresponding preset color component model is then used, which is beneficial for correcting each color component in subsequent white balance correction operations.

[0154] Please refer to the following: Figure 9 , Figure 9 yes Figure 2 A detailed flowchart of step S204 in the process;

[0155] like Figure 9 As shown, step S204 includes:

[0156] Step S241: Determine the color zone where the color coordinates of the target white point are located based on the color coordinates of the target white point;

[0157] Please refer to the following: Figure 10 ,like Figure 10 As shown, based on the equations of the first, second, and third straight lines, the three rays emanating from the initial white point can divide the CIE chromaticity coordinate diagram into three color regions. According to this division, there are six possibilities for the region where the target white point is located: the chromaticity coordinates of the target white point fall on the line equation... The equations of the lines are: The color coordinates of the target white point fall within the region enclosed by the straight line, and the equation of the straight line is... The equations of the lines are: The color coordinates of the target white point fall within the region enclosed by the straight line, and the equation of the straight line is... The equations of the lines are: The color coordinates of the target white point fall within the region enclosed by the straight line, and the equation of the straight line is... The color coordinates of the target white point lie on the straight line with the equation: The color coordinates of the target white point lie on the straight line with the equation: On the straight line.

[0158] Step S242: Determine at least one color component to be adjusted based on the color partition;

[0159] Specifically, based on the equations of the first, second, and third straight lines, the three rays emanating from the initial white point can divide the CIE chromaticity coordinate diagram into three color regions. Each color region corresponds to at least one color component to be adjusted, for example:

[0160] When the color coordinates of the target white point fall on the line equation is The equations of the lines are: When the area is enclosed by a straight line, the gain value of the blue component of the target white point remains unchanged, while the gain values ​​of the red and green components are the color components to be adjusted.

[0161] When the color coordinates of the target white point fall on the line equation is The equations of the lines are: When the area is enclosed by the straight line, the green component gain value of the target white point is determined to remain unchanged, while the red component gain value and the blue component gain value are the color components to be adjusted.

[0162] When the color coordinates of the target white point fall on the line equation is The equations of the lines are: When the area is enclosed by a straight line, the red component gain value of the target white point remains unchanged, while the green and blue component gain values ​​are the color components to be adjusted.

[0163] When the color coordinates of the target white point fall on the line equation is When the target white point is on a straight line, the green and blue component gain values ​​are determined to remain unchanged, while the red component gain value is the color component to be adjusted.

[0164] When the color coordinates of the target white point fall on the line equation is When the target white point is on a straight line, the gain values ​​of the red and blue components remain unchanged, while the gain value of the green component is the color component to be adjusted.

[0165] When the color coordinates of the target white point fall on the line equation is When the target white point is on a straight line, the red and green component gain values ​​are determined to remain unchanged, while the blue component gain value is the color component to be adjusted.

[0166] Step S243: Based on the relative position and difference between the initial white point and the target white point, and based on the preset color component model, determine the change in the gain value of at least one color component to be adjusted.

[0167] Please see Figure 10 , Figure 10 yes Figure 9 A detailed flowchart of step S243 in the process;

[0168] like Figure 10 As shown, step S243 includes:

[0169] Step S2431: Determine the gain value of at least one color component of the target white point based on the difference between the x-coordinate and y-coordinate of the color coordinates of the initial white point and the target white point.

[0170] Please refer to the following for details. Figure 8 and Figure 11 , Figure 11 This is a schematic diagram illustrating the relative positions of an initial white point and a target white point, provided in an embodiment of this application.

[0171] It can be seen that, Figure 8 The initial white point's color coordinates are used as Figure 11 The origin of the coordinate system, such as Figure 11 As shown, the relative positions of the initial white point's color coordinates and the target white point's color coordinates can be analyzed more clearly. The color coordinates of the initial white point are used as... Figure 11 The origin of the Cartesian coordinate system (i.e., the simulated zero point 128, 128, 128) and the three straight lines fitted by the variation curves of the red, green and blue components can re-divide the four quadrants of the Cartesian coordinate system into three color zones. The color coordinates of the target white point are related to the boundary line of that zone, and are not related to the other, thus determining which color component remains unchanged.

[0172] Based on the relative positions of the initial and target white point color coordinates, the difference between their color coordinates can be calculated. Assuming the initial white point's color coordinates are (x1, y1) and the target white point's color coordinates are (x2, y2), the formula for calculating the difference is: Δx = x2 - x1, Δy = y2 - y1. Here, since the change in the gain value of the blue component can be vector-decomposed into components on the x and y axes in the coordinate system, the red component... The change in the gain value of the color component can be vector-decomposed into components on the x and y axes in the coordinate system. Therefore, Δx includes the gain values ​​of the blue and red components on the x-axis, and Δy includes the gain values ​​of the blue and red components on the y-axis. Let the gain values ​​of the blue component on the x-axis and y-axis be represented as ΔBx and ΔBy, respectively, and the gain values ​​of the red component on the x-axis and y-axis be represented as ΔRx and ΔRy, respectively. Then we have Δx = ΔBx + ΔRx and Δy = ΔBy + ΔRy.

[0173] Hereinafter, the gain value of the red component will be referred to as R gain, the gain value of the green component as G gain, the gain value of the blue component as B gain, the change in the gain value of the red component as ΔR gain, the change in the gain value of the green component as ΔG gain, and the change in the gain value of the blue component as ΔB gain.

[0174] Step S2432: Based on the gain value of at least one color component of the target white point, determine multiple step changes of the horizontal axis and multiple step changes of the vertical axis of at least one color component according to the preset color component model.

[0175] Step S2433: Accumulate the multiple step changes of the abscissa of each color component to obtain the accumulated step change of the abscissa of each color component.

[0176] Specifically, the curve equation fitted based on the color component model The cumulative step change of the x-coordinate for each color component is equivalent to taking the definite integral of the curve equation. Since the unit length of the step change of the x-coordinate is 1, taking the definite integral of the curve is equivalent to taking the area of ​​the curve from the gain value of at least one color component of the target white point to 128. For example, to take the cumulative step change of the x-coordinate of the blue component, the formula is:

[0177] △Bx= ;

[0178] Step S2434: Accumulate the multiple step changes of the ordinate of each color component to obtain the accumulated step change of the ordinate of each color component.

[0179] Specifically, based on the curve equation fitted by the model The cumulative step change of the ordinate of each color component is equivalent to taking the definite integral of the curve equation. Since the unit length of the step change of the ordinate is 1, taking the definite integral of the curve is equivalent to taking the area of ​​the curve from the gain value of at least one color component of the target white point to 128. For example, to take the cumulative step change of the ordinate of the blue component, the formula is:

[0180] △By= ;

[0181] Step S2435: Based on the cumulative step change of the horizontal axis of each color component and the cumulative step change of the vertical axis of each color component, obtain the change in the gain value of at least one color component.

[0182] Specifically, assuming the gain value of the green component remains constant, i.e., G gain is a fixed value, fitting the step change curves of the gain values ​​of the blue and red components on the x and y axes respectively yields four univariate sixth-degree function equations, as follows:

[0183] ;

[0184] ;

[0185] ;

[0186] ;

[0187] The cumulative step change of the horizontal axis of the blue component is as follows:

[0188] △Bx= ;

[0189] The cumulative step change of the horizontal axis of the red component is:

[0190] △Rx= ;

[0191] The cumulative step change of the ordinate of the blue component is:

[0192] △By= ;

[0193] The cumulative step change of the ordinate of the red component is:

[0194] △Ry= ;

[0195] and,

[0196] △x = △Bx + △Rx;

[0197] △y = △By + △Ry;

[0198] Specifically, assuming G gain is a fixed value, we solve the above ten equations to find R gain and B gain. Given Δx and Δy, ΔBx and ΔBy are two functional relationships where only B gain is a variable, and ΔRx and ΔRy are two functional relationships where only R gain is a variable. Therefore, the system of two equations, Δx = ΔBx + ΔRx and Δy = ΔBy + ΔRy, has only two variables, so R gain and B gain have a unique solution.

[0199] By determining the color zone where the target white point's color coordinates are located based on the color coordinates of the target white point, and then determining at least one color component to be adjusted based on the color zone, the cumulative step change of the horizontal coordinate of each color component is obtained by accumulating multiple step changes, and the cumulative step change of the vertical coordinate of each color component is obtained by accumulating multiple step changes, and finally, the change in the gain value of at least one color component is obtained based on the cumulative step changes of the horizontal and vertical coordinates of each color component. This application can transform multiple multivariate and multi-level expressions into a system of two equations with only two variables for solving, thus achieving white balance correction more efficiently.

[0200] Step S205: Determine the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component.

[0201] Please refer to the following: Figure 12 , Figure 12 yes Figure 2 A detailed flowchart of step S205 in the process;

[0202] like Figure 12 As shown, step S205 includes:

[0203] Step S2051: The gain value of each color component after correction = the preset gain value of each color component - the change in the gain value of each color component.

[0204] Specifically, after calculating the change in gain value of at least one color component, the corrected color coordinates are obtained by subtracting the change in gain value of at least one color component from the initial white point gain value. The formula is as follows: Initial white point gain value (128-128-128) - (△R gain, △G gain, △B gain) = Corrected gain value R'G'B' of the three color components. For example, assuming that the color coordinates of the target white point fall within the area between the line with equation y1=kRx1+b1 and the line with equation y2=kGx2+b2, the green component gain value of the target white point remains unchanged. Therefore, let △Ggain=0, then the corrected gain value R'G'B' = (128-△R gain, 128, 128-△B gain).

[0205] In this embodiment of the application, the method further includes determining whether the white balance correction was successful.

[0206] For details, please refer to Figure 13 , Figure 13 This is a schematic diagram of a process for determining whether white balance correction is successful, provided in an embodiment of this application.

[0207] like Figure 13 As shown, the procedure for determining whether white balance correction is successful includes:

[0208] Step S1301: Obtain the color coordinates of the initial white point;

[0209] Specifically, the electronic device collects the red, green, and blue component data of the initial white point. Using the color coordinate calculation formula and based on the CIE chromaticity coordinate diagram, the color coordinates of the initial white point are determined. The initial white point corresponds to a preset gain value for each color component. It should be noted that the initial white point is a point where the gain values ​​for the red, green, and blue components are all 128.

[0210] Step S1302: Determine the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point;

[0211] Specifically, assume that the color coordinates of the initial white point are (x1, y1), and the color coordinates of the target white point are (x2, y2). Using the formula: Δx = x2 - x1, Δy = y2 - y1, the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point are obtained.

[0212] Step S1303: Obtain the color coordinates corresponding to the gain value of each corrected color component;

[0213] Specifically, since the gain value and the color coordinates correspond one by one in the CIE chromaticity coordinate diagram, according to the CIE chromaticity coordinate diagram, the color coordinates corresponding to the gain value of each corrected color component can be obtained.

[0214] Step S1304: Determine whether the color coordinates corresponding to the gain value of each corrected color component are within the preset range of the color coordinates of the target white point;

[0215] Specifically, in order to determine whether the gain value of each corrected color component meets the requirements, an error range of the color coordinates of the target white point is preset in advance. By determining whether the error of the color coordinates of the target white point is within the error range, it is determined whether the color coordinates corresponding to the gain value of each corrected color component are within the preset range of the color coordinates of the target white point. For example: The judgment is made in the following way:

[0216] |x - target_x| < rang_x, and, |y - target_y| < rang_y,

[0217] where x is the abscissa of the color coordinates corresponding to the gain value of the corrected color component, y is the ordinate of the color coordinates corresponding to the gain value of the corrected color component, target_x is the abscissa of the color coordinates of the target white point, target_y is the ordinate of the color coordinates of the above target white point, rang_x is the error amount of the abscissa, and rang_y is the error amount of the ordinate. Among them, the error amount of the abscissa and the error amount of the ordinate are both preset and can be set according to specific needs.

[0218] If |x - target_x| < rang_x and |y - target_y| < rang_y are satisfied, it is determined that the color coordinates corresponding to the gain value of each corrected color component are within the preset range of the color coordinates of the target white point, and at this time, it is determined that the correction is successful.

[0219] If |x - target_x| < rang_x or |y - target_y| < rang_y is not satisfied, it is determined that the color coordinates corresponding to the gain value of each corrected color component are not within the preset range of the color coordinates of the target white point. At this time, it is determined that the correction fails, and the color coordinates of the target white point need to be re - determined for correction.

[0220] Step S1305: Re-select the target white point and obtain the color coordinates of the target white point;

[0221] Specifically, re-select a target white point, collect the red component, green component, and blue component data of the target white point through an electronic device, and obtain the color coordinates of the target white point according to the CIE chromaticity coordinate schematic diagram.

[0222] Step S1306: Re-calibrate;

[0223] Specifically, according to the color coordinates of the re-selected target white point, repeat the above steps S203 to S205 until the calibration is successful.

[0224] Step S1307: Determine that the calibration is successful.

[0225] Specifically, if the preset conditions |x - target_x| < rang_x and |y - target_y| < rang_y are satisfied, it is determined that the calibration is successful, and the gain value data of each color component after calibration is saved.

[0226] In the embodiment of the present application, by providing a white balance correction method, the method includes: obtaining the color coordinates of the initial white point and the color coordinates of the target white point, determining the change amount of the gain value of at least one color component based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point according to a preset color component model, and determining the gain value of the color component after calibration according to the preset gain value of each color component corresponding to the initial white point and the change amount of the gain value of at least one color component. The present application can shorten the calibration time of white balance correction and improve the calibration efficiency.

[0227] Please refer to Figure 14 , Figure 14 which is a schematic structural diagram of a white balance correction device provided by an embodiment of the present application;

[0228] Among them, the white balance correction device is applied to one or at least two processors of an electronic device, and the electronic device includes a computer, a mobile phone, a monitor, or a television. [[ID=​​​​​​​​The difference determination unit 142 is used to determine the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point based on the color coordinates of the initial white point and the color coordinates of the target white point.

[0232] The change determination unit 143 is used to determine the change in the gain value of at least one color component based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on a preset color component model.

[0233] The gain value correction unit 144 is used to determine the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the amount of change in the gain value of at least one color component.

[0234] In the embodiments of this application, the white balance correction device can also be constructed from hardware components. For example, the white balance correction device can be constructed from one or more chips, and the chips can work together to complete the white balance correction method described in the above embodiments. Furthermore, the white balance correction device can also be constructed from various logic devices, such as general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), microcontrollers, ARM (Acorn RISC Machine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components.

[0235] The white balance correction device in this application embodiment can be a device, or it can be a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.

[0236] In this application embodiment, the white balance correction device can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0237] The white balance correction device provided in this application embodiment can achieve... Figure 2 To avoid repetition, the various processes involved will not be described in detail here.

[0238] It should be noted that the white balance correction device described above can execute the white balance correction method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in the embodiments of the white balance correction device can be found in the white balance correction method provided in the above embodiments.

[0239] In this embodiment of the application, a white balance correction device is provided, comprising: a coordinate acquisition unit for acquiring the color coordinates of an initial white point and a target white point; a difference determination unit for determining the relative position and difference between the color coordinates of the initial white point and the target white point based on the color coordinates of the initial white point and the target white point; a change determination unit for determining the change in the gain value of at least one color component based on the relative position and difference between the color coordinates of the initial white point and the target white point, and a preset color component model; and a gain value correction unit for determining the corrected gain value of the color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component.

[0240] By obtaining the color coordinates of the initial white point and the target white point, and determining the change in the gain value of at least one color component based on the relative position of the color coordinates of the target white point, and determining the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component, this application can shorten the correction time of white balance correction and improve the correction efficiency.

[0241] Please refer to the following: Figure 15 , Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0242] like Figure 15 As shown, the electronic device 150 includes one or more processors 151 and a memory 152. Wherein, Figure 15 Take a processor 151 as an example.

[0243] Processor 151 and memory 152 can be connected via a bus or other means. Figure 15 Taking the example of a connection between China and Israel via a bus.

[0244] The processor 151 is configured to provide computing and control capabilities to control the electronic device 150 to perform corresponding tasks, such as controlling the electronic device 150 to perform the white balance correction method in any of the above method embodiments, including: obtaining the color coordinates of an initial white point and the color coordinates of a target white point; determining the change in the gain value of at least one color component based on a preset color component model, according to the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point; and determining the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component.

[0245] By obtaining the color coordinates of the initial white point and the target white point, and determining the change in the gain value of at least one color component based on the relative position of the color coordinates of the target white point, and determining the gain value of the corrected color component based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component, this application can shorten the correction time of white balance correction and improve the correction efficiency.

[0246] Processor 151 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0247] Memory 152, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the white balance correction method in the embodiments of this application. Processor 151 can implement the white balance correction method in any of the following method embodiments by running the non-transitory software programs, instructions, and modules stored in memory 152. Specifically, memory 152 may include volatile memory (VM), such as random access memory (RAM); memory 152 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), solid-state drive (SSD), or other non-transitory solid-state storage devices; memory 152 may also include combinations of the above types of memory.

[0248] Memory 152 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 152 may optionally include memory remotely located relative to processor 151, and such remote memory may be connected to processor 151 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0249] One or more modules are stored in memory 152. When executed by one or more processors 151, they perform the white balance correction method in any of the above method embodiments, for example, the method described above. Figure 2 The steps shown can also be implemented. Figure 14 The functions of each unit.

[0250] In this embodiment, the electronic device 150 may also have wired or wireless network interfaces, keyboards, and input / output interfaces for input and output. The electronic device 150 may also include other components for implementing device functions, which will not be described in detail here.

[0251] This application also provides a computer-readable storage medium, such as a memory including program code, which can be executed by a processor to perform the white balance correction method in the above embodiments. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0252] This application also provides a computer program product comprising one or more lines of program code stored in a computer-readable storage medium. A processor of an electronic device reads the program code from the computer-readable storage medium and executes the program code to complete the method steps of the white balance correction method provided in the above embodiments.

[0253] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0254] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0255] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A white balance correction method, characterized in that, The method includes: Obtain the color coordinates of the initial white point, wherein the initial white point corresponds to a preset gain value for each color component; Obtain the color coordinates of the target white point; Based on the color coordinates of the initial white point and the color coordinates of the target white point, determine the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point; Based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on a preset color component model, determine the change in the gain value of at least one color component. The gain value of the corrected color component is determined based on the preset gain value of each color component corresponding to the initial white point and the change in the gain value of at least one color component. The method further includes: Constructing the model for the preset color components specifically includes: Obtain the first color component, the second color component, and the third color component, wherein the first color component, the second color component, and the third color component correspond one-to-one with one of the red component, the green component, and the blue component; Set the gain value of the first color component to a fixed value, and obtain the value range of the gain value of the second color component and the value range of the gain value of the third color component. Based on the range of the gain value of the second color component and the range of the gain value of the third color component, determine the step change of the horizontal axis and the step change of the vertical axis of the color coordinate corresponding to the gain value of the third color component. Iterate through the red, green, and blue components to construct a model of the preset color components; The step of determining the step change of the horizontal axis and the step change of the vertical axis of the color coordinate corresponding to the gain value of the third color component based on the value range of the gain value of the second color component and the value range of the gain value of the third color component includes: Based on the range of the gain values ​​of the second color component, determine the gain values ​​of multiple second color components; Based on the gain value of each of the second color components, the gain values ​​of the plurality of the third color components are determined. The step change amount of the abscissa and the step change amount of the ordinate of the color coordinate corresponding to the gain value of each third color component are determined, and multiple step change amount curves of the abscissa and the ordinate of the color coordinate corresponding to the third color components are obtained. Each step change amount curve corresponds to the gain value of a first color component and the gain value of a second color component.

2. The method according to claim 1, characterized in that, The process of traversing the red, green, and blue components to construct a model of the color components includes: Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of the multiple red components. Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of the multiple green components. Determine the step change curves of the abscissa and ordinate of the color coordinates corresponding to the gain values ​​of the multiple blue components. Each step change curve corresponds to a step change function, and the preset color component model includes the step change function corresponding to each step change curve.

3. The method according to claim 2, characterized in that, The method further includes: Obtain multiple first-color coordinates corresponding to the red component, multiple second-color coordinates corresponding to the green component, and multiple third-color coordinates corresponding to the blue component; Based on multiple first color coordinates and the color coordinates of the initial white point, a first straight line equation is fitted to obtain the equation. Based on multiple second color coordinates and combined with the color coordinates of the initial white point, a second straight line equation is obtained by fitting. Based on the multiple third color coordinates and the color coordinates of the initial white point, the equation of the third straight line is obtained by fitting. Based on the first, second, and third line equations, the color coordinate system is divided into three color partitions, where each color partition corresponds to at least one color component to be adjusted.

4. The method according to claim 3, characterized in that, The step of determining the change in gain value of at least one color component based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on a preset color component model, includes: Based on the color coordinates of the target white point, determine the color zone in which the color coordinates of the target white point are located; Based on the color partitioning, at least one color component to be adjusted is determined; Based on the relative position and difference between the initial white point and the target white point, and based on a preset color component model, the change in the gain value of at least one color component to be adjusted is determined.

5. The method according to claim 4, characterized in that, The step of determining the change in gain value of at least one color component to be adjusted based on the relative position and difference between the color coordinates of the initial white point and the color coordinates of the target white point, and based on a preset color component model, includes: Based on the difference between the x-coordinate and y-coordinate of the color coordinates of the initial white point and the color coordinates of the target white point, determine the gain value of at least one color component of the target white point; Based on the gain value of at least one color component of the target white point, and based on a preset color component model, determine multiple step changes in the horizontal axis and multiple step changes in the vertical axis of at least one color component. The cumulative step change of the x-axis of each color component is obtained by summing up the multiple step changes of the x-axis of each color component. The cumulative step change of the ordinate of each color component is obtained by summing up the multiple step changes of the ordinate of each color component. Based on the cumulative step change of the horizontal coordinate of each color component and the cumulative step change of the vertical coordinate of each color component, the change in the gain value of at least one color component is obtained.

6. The method according to any one of claims 1-5, characterized in that, The step of determining the corrected gain value of a color component based on a preset gain value for each color component corresponding to the initial white point and the change in the gain value of at least one color component includes: The corrected gain value of each color component = the preset gain value of each color component - the change in the gain value of each color component.

7. The method according to any one of claims 1-5, characterized in that, The method further includes: Obtain the color coordinates corresponding to the gain value of each corrected color component; Determine whether the color coordinates corresponding to the gain value of each corrected color component are within a preset range of the color coordinates of the target white point; If so, then the correction was successful; If not, then reselect the target white point, obtain the color coordinates of the target white point, and recalibrate until the color coordinates corresponding to the gain value of each color component after calibration are within the preset range of the color coordinates of the target white point.

8. An electronic device, characterized in that, include: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the white balance correction method as described in any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions, which, when executed, implement the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, The computer program product includes instructions for implementing the method as described in any one of claims 1-7.