White balance adjustment method, device, electronic device and storage medium
By acquiring the white point coordinates of the device in the current scene, determining the target color temperature, and adjusting the white balance value, the problem of white balance differences between different devices in the same scene is solved, achieving consistency of image white balance and improving the effect.
Patent Information
- Application Number
- CN202210398893.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-04-15
AI Technical Summary
The white balance displayed by different devices in the same scene can vary noticeably to the naked eye, affecting the user experience.
By obtaining the average white point coordinates of the device to be adjusted in the current scene, the target color temperature is determined, and the color temperature range box is translated using the vector value of the reference device. The target white balance value is then adjusted based on the proportion of white points.
Ensure that the white balance style of the image output from the device to be adjusted is consistent with that of the reference device to improve the white balance effect.
Smart Images

Figure CN114710653B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a white balance adjustment method, device, electronic equipment and storage medium. Background Art
[0002] At present, with the development of surveillance cameras, the lens of zoom cameras is developing towards high magnification and ultra-high magnification. In order to have better image quality, as the most important component of 3A (automatic white balance, automatic focus, automatic exposure), the impact of automatic white balance on image quality is becoming more and more important. Generally, the algorithm of automatic white balance is mostly studying how to effectively identify color temperature and other methods to improve the accuracy of white balance. However, no matter how it is handled, in actual use, the final white balance presentation will always be affected by comprehensive factors such as inconsistent photosensitivity of different sensors, inconsistent lens performance, and inconsistent debugging methods of debugging personnel. A common problem is that in the same scene, the white balance presented by different devices has visible differences to the naked eye, which is a very poor experience for users to observe and use on the same screen. The intuitive feeling is that the white balance has inconsistent color styles. Summary of the invention
[0003] The embodiments of the present invention provide a white balance adjustment method, device, electronic device and storage medium to solve the problem of poor white balance adjustment effect in the prior art.
[0004] An embodiment of the present invention provides a white balance adjustment method, the method comprising:
[0005] Acquire first average white point coordinate information of the device to be adjusted in the current scene, and determine the target color temperature corresponding to the current scene according to the first average white point coordinate information;
[0006] Determine a target vector value corresponding to the target color temperature according to a predetermined vector value corresponding to each color temperature of a reference device, and translate a color temperature range frame corresponding to the target color temperature according to the target vector value to obtain a target color temperature range frame;
[0007] A target white balance value is determined according to the white point ratio contained in the target color temperature range frame, and the target white balance value is used to perform white balance adjustment.
[0008] Further, determining the target color temperature corresponding to the current scene according to the first average white point coordinate information includes:
[0009] Selecting target second average white point coordinate information corresponding to the first average white point coordinate information from the pre-saved second average white point coordinate information corresponding to the device to be adjusted at each color temperature;
[0010] The color temperature corresponding to the target second average white point coordinate information is determined as the target color temperature corresponding to the current scene.
[0011] Furthermore, the selecting target second average white point coordinate information corresponding to the first average white point coordinate information includes:
[0012] For each piece of second average white point coordinate information, determining the Euclidean distance between the second average white point coordinate information and the first average white point coordinate information;
[0013] The second average white point coordinate information with the smallest Euclidean distance is selected as the target second average white point coordinate information corresponding to the first average white point coordinate information.
[0014] Further, the color temperature range frame corresponding to the target color temperature is translated according to the target vector value to obtain the target color temperature range frame, including:
[0015] The target center coordinate information is determined according to the target second average white point coordinate information and the target vector value; the color temperature range frame corresponding to the target color temperature is translated to obtain the target color temperature range frame, so that the center coordinate information of the target color temperature range frame is the target center coordinate information.
[0016] Furthermore, the process of predetermining the vector values corresponding to each color temperature includes:
[0017] Obtaining third average white point coordinate information and center coordinate information of the color temperature range frame corresponding to the reference device at each color temperature;
[0018] The vector values corresponding to the respective color temperatures are determined according to the third average white point coordinate information corresponding to the respective color temperatures and the center coordinate information of the color temperature range frame.
[0019] Furthermore, determining the target white balance value according to the proportion of white points included in the target color temperature range frame includes:
[0020] If the proportion of white points included in the target color temperature range frame is greater than a preset proportion threshold, the white balance value corresponding to the target color temperature is determined as the target white balance value.
[0021] Furthermore, the method further comprises:
[0022] If the proportion of white points included in the target color temperature range box is not greater than a preset proportion threshold, determine whether the white points not included in the target color temperature range box are included in the candidate color temperature range box adjacent to the target color temperature range box; if not, determine the white balance value corresponding to the target color temperature as the target white balance value; if yes, determine the target white balance value based on the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range box.
[0023] On the other hand, an embodiment of the present invention provides a white balance adjustment device, the device comprising:
[0024] A first determination module, configured to obtain first average white point coordinate information of the device to be adjusted in a current scene, and determine a target color temperature corresponding to the current scene according to the first average white point coordinate information;
[0025] A second determination module is used to determine a target vector value corresponding to the target color temperature according to the vector values corresponding to each color temperature of the predetermined reference device, and to translate the color temperature range frame corresponding to the target color temperature according to the target vector value to obtain the target color temperature range frame;
[0026] The adjustment module is used to determine a target white balance value according to the proportion of white points contained in the target color temperature range frame, and use the target white balance value to perform white balance adjustment.
[0027] Furthermore, the first determination module is specifically used to select the target second average white point coordinate information corresponding to the first average white point coordinate information from the pre-saved second average white point coordinate information corresponding to the device to be adjusted at each color temperature; and determine the color temperature corresponding to the target second average white point coordinate information as the target color temperature corresponding to the current scene.
[0028] Furthermore, the first determination module is specifically used to determine, for each second average white point coordinate information, the Euclidean distance between the second average white point coordinate information and the first average white point coordinate information; and select the second average white point coordinate information with the smallest Euclidean distance as the target second average white point coordinate information corresponding to the first average white point coordinate information.
[0029] Furthermore, the second determination module is specifically used to determine the target center coordinate information based on the target second average white point coordinate information and the target vector value; translate the color temperature range box corresponding to the target color temperature to obtain the target color temperature range box, so that the center coordinate information of the target color temperature range box is the target center coordinate information.
[0030] Furthermore, the second determination module is also used to obtain the third average white point coordinate information and the center coordinate information of the color temperature range box corresponding to the reference device at each color temperature; and determine the vector value corresponding to each color temperature according to the third average white point coordinate information and the center coordinate information of the color temperature range box corresponding to each color temperature.
[0031] Furthermore, the adjustment module is specifically configured to determine the white balance value corresponding to the target color temperature as the target white balance value if the proportion of white points included in the target color temperature range frame is greater than a preset proportion threshold.
[0032] Furthermore, the adjustment module is also used to determine whether the white points not included in the target color temperature range frame are included in the candidate color temperature range frame adjacent to the target color temperature range frame if the proportion of white points included in the target color temperature range frame is not greater than a preset proportion threshold; if not, determine the white balance value corresponding to the target color temperature as the target white balance value; if yes, determine the target white balance value based on the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame.
[0033] On the other hand, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0034] Memory, used to store computer programs;
[0035] The processor is used to implement any of the method steps described above when executing the program stored in the memory.
[0036] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described above is implemented.
[0037] An embodiment of the present invention provides a white balance adjustment method, device, electronic device and storage medium, the method comprising: obtaining first average white point coordinate information of a device to be adjusted in a current scene, determining a target color temperature corresponding to the current scene according to the first average white point coordinate information; determining a target vector value corresponding to the target color temperature according to vector values corresponding to each color temperature of a predetermined reference device, translating a color temperature range box corresponding to the target color temperature according to the target vector value to obtain a target color temperature range box; determining a target white balance value according to a proportion of white points contained in the target color temperature range box, and using the target white balance value to perform white balance adjustment.
[0038] The above technical solution has the following advantages or beneficial effects:
[0039] In the embodiment of the present invention, the target color temperature corresponding to the current scene is first obtained and determined according to the first average white point coordinate information of the device to be adjusted in the current scene, and then the target vector value corresponding to the target color temperature is determined, and the color temperature range frame corresponding to the target color temperature is translated according to the target vector value to obtain the target color temperature range frame, and finally the target white balance value is determined according to the white point ratio contained in the target color temperature range frame, and then the white balance adjustment is performed. The white balance adjustment scheme provided by the embodiment of the present invention can ensure that the white balance style of the image output by the device to be adjusted is consistent with that of the reference device, so that the white balance effect is better. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 A schematic diagram of a white balance adjustment process provided in Embodiment 1 of the present invention;
[0042] Figure 2 A detailed flow chart of white balance adjustment provided in Embodiment 3 of the present invention;
[0043] Figure 3 A schematic diagram of a white point and color temperature range provided in Example 3 of the present invention;
[0044] Figure 4 A schematic diagram of a color temperature range frame translation process provided in Embodiment 3 of the present invention;
[0045] Figure 5 A schematic diagram of the structure of a white balance adjustment device provided in Embodiment 4 of the present invention;
[0046] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Example 5 of the present invention. DETAILED DESCRIPTION
[0047] The present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Embodiment 1:
[0049] Figure 1 A schematic diagram of a white balance adjustment process provided by an embodiment of the present invention, the process includes the following steps:
[0050] S101: Acquire first average white point coordinate information of a device to be adjusted in a current scene, and determine a target color temperature corresponding to the current scene according to the first average white point coordinate information.
[0051] S102: determining a target vector value corresponding to the target color temperature according to a predetermined vector value corresponding to each color temperature of a reference device, and translating a color temperature range frame corresponding to the target color temperature according to the target vector value to obtain a target color temperature range frame.
[0052] S103: Determine a target white balance value according to the proportion of white points included in the target color temperature range frame, and use the target white balance value to perform white balance adjustment.
[0053] The white balance adjustment method provided by the embodiment of the present invention is applied to an electronic device, which may be a PC, a tablet computer, a server, etc., or a device to be adjusted. If the electronic device is a device to be adjusted, after the device to be adjusted collects an image under the current scene, each white point in the image is identified, and the coordinate information of each white point is determined, and then the average value of the coordinate information of each white point is determined to obtain the first average white point coordinate information. Then the subsequent white balance adjustment step is performed. If the electronic device is a PC, a tablet computer, a server, etc., after the device to be adjusted collects an image under the current scene, the image can be sent to the electronic device, and the electronic device identifies each white point in the image, determines the coordinate information of each white point, and then determines the average value of the coordinate information of each white point to obtain the first average white point coordinate information. Then the subsequent white balance adjustment step is performed. Or after the device to be adjusted collects an image under the current scene, each white point in the image is identified, and the coordinate information of each white point is determined, and then the average value of the coordinate information of each white point is determined to obtain the first average white point coordinate information. Then the first average white point coordinate information is sent to the electronic device, and the electronic device performs the subsequent white balance adjustment step after receiving the first average white point coordinate information.
[0054] It should be noted that the coordinate information of the white point refers to (RGain, BGain), RGain = G / R, BGain = G / B. R, G, B are the pixel values of the three pixel channels of red, green, and blue, respectively. Determining the average value of the coordinate information of each white point means calculating the average value of the abscissa information of each white point as the abscissa information of the first average white point coordinate information, and calculating the average value of the ordinate information of each white point as the ordinate information of the first average white point coordinate information.
[0055] The electronic device determines the target color temperature corresponding to the current scene according to the first average white point coordinate information. The average white point coordinate information ranges corresponding to different color temperatures can be pre-stored, and the color temperature corresponding to the average white point coordinate information range to which the first average white point coordinate information belongs is used as the target color temperature.
[0056] The vector values corresponding to the reference device at each color temperature are predetermined. Specifically, the third average white point coordinate information and the center coordinate information of the color temperature range frame corresponding to the reference device at each color temperature are obtained; according to the third average white point coordinate information and the center coordinate information of the color temperature range frame corresponding to each color temperature, the vector values corresponding to each color temperature are determined. The color temperatures generally include A (2700 color temperature), TL84 (4200 color temperature), D50 (5000 color temperature), D65 (6500 color temperature), D75 (7500 color temperature), etc.
[0057] The color temperature range frame refers to the range frame that limits the color temperature range of the white point coordinate information under different color temperatures of the reference device. At any time, as long as the white point coordinate information counted by the current scene falls within a certain range frame, the color temperature of the current scene is the color temperature to which the range frame belongs. The color temperature range frames are all rectangular frames. Each color temperature has a color temperature range frame to which it belongs. There are overlapping parts between the color temperature range frames. The shape formed by all the color temperature range frames conforms to the shape of the Planck curve.
[0058] The vector values corresponding to the reference devices at various color temperatures are predetermined. After the target color temperature is determined, the vector value corresponding to the target color temperature is called the target vector value. In addition, there is a corresponding color temperature range frame for the target color temperature. The color temperature range frame corresponding to the target color temperature is translated according to the target vector value to obtain the target color temperature range frame. After the target color temperature range frame is determined, the white points within the target color temperature range frame and the white points outside the target color temperature range frame are counted, and then the proportion of white points contained in the target color temperature range frame is determined. According to the proportion of white points contained in the target color temperature range frame, the target white balance value is determined, and the target white balance value is used to adjust the white balance. Among them, when the proportion of white points contained in the target color temperature range frame is large, the white balance value corresponding to the target color temperature can be determined as the target white balance value. When the proportion of white points contained in the target color temperature range frame is small, the target white balance value can be determined by weighted calculation based on the white balance values corresponding to all the color temperature range frames to which the white points belong. Then the target white balance value is used to adjust the white balance.
[0059] In the embodiment of the present invention, the target color temperature corresponding to the current scene is first obtained and determined according to the first average white point coordinate information of the device to be adjusted in the current scene, and then the target vector value corresponding to the target color temperature is determined, and the color temperature range frame corresponding to the target color temperature is translated according to the target vector value to obtain the target color temperature range frame, and finally the target white balance value is determined according to the white point ratio contained in the target color temperature range frame, and then the white balance adjustment is performed. The white balance adjustment scheme provided by the embodiment of the present invention can ensure that the white balance style of the image output by the device to be adjusted is consistent with that of the reference device, so that the white balance effect is better.
[0060] Embodiment 2:
[0061] In order to determine the target color temperature corresponding to the current scene more accurately, based on the above embodiment, in an embodiment of the present invention, determining the target color temperature corresponding to the current scene according to the first average white point coordinate information includes:
[0062] Selecting target second average white point coordinate information corresponding to the first average white point coordinate information from the pre-saved second average white point coordinate information corresponding to the device to be adjusted at each color temperature;
[0063] The color temperature corresponding to the target second average white point coordinate information is determined as the target color temperature corresponding to the current scene.
[0064] The device to be adjusted collects images at various color temperatures, and determines the second average white point coordinate information corresponding to the device to be adjusted at various color temperatures according to the collected images. According to the distance between each second average white point coordinate information and the first average white point coordinate information, the target second average white point coordinate information corresponding to the first average white point coordinate information is determined. For example, the second average white point coordinate information closest to the abscissa of the first average white point coordinate information is determined as the target second average white point coordinate information corresponding to the first average white point coordinate information. Or the second average white point coordinate information closest to the ordinate of the first average white point coordinate information is determined as the target second average white point coordinate information corresponding to the first average white point coordinate information. Preferably, for each second average white point coordinate information, the Euclidean distance between the second average white point coordinate information and the first average white point coordinate information is determined; and the second average white point coordinate information with the smallest Euclidean distance is selected as the target second average white point coordinate information corresponding to the first average white point coordinate information. Then the color temperature corresponding to the target second average white point coordinate information is determined as the target color temperature corresponding to the current scene. Thus, the target color temperature corresponding to the current scene is determined to be more accurate.
[0065] Embodiment 3:
[0066] In order to determine the target color temperature range frame more accurately, based on the above embodiments, in an embodiment of the present invention, the color temperature range frame corresponding to the target color temperature is translated according to the target vector value to obtain the target color temperature range frame, including:
[0067] The target center coordinate information is determined according to the target second average white point coordinate information and the target vector value; the color temperature range frame corresponding to the target color temperature is translated to obtain the target color temperature range frame, so that the center coordinate information of the target color temperature range frame is the target center coordinate information.
[0068] After determining the target second average white point coordinate information and the target vector value, the target center coordinate information can be determined by a vector calculation method. Then, the color temperature range frame corresponding to the target color temperature is translated according to the target center coordinate information, so that the center coordinate information of the target color temperature range frame obtained after the translation is the target center coordinate information.
[0069] In order to determine the target white balance value more accurately, based on the above embodiments, in an embodiment of the present invention, determining the target white balance value according to the proportion of white points included in the target color temperature range frame includes:
[0070] If the proportion of white points included in the target color temperature range frame is greater than a preset proportion threshold, the white balance value corresponding to the target color temperature is determined as the target white balance value.
[0071] If the proportion of white points included in the target color temperature range box is not greater than a preset proportion threshold, determine whether the white points not included in the target color temperature range box are included in the candidate color temperature range box adjacent to the target color temperature range box; if not, determine the white balance value corresponding to the target color temperature as the target white balance value; if yes, determine the target white balance value based on the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range box.
[0072] After determining the target color temperature range frame, the white points within the target color temperature range frame and the white points outside the target color temperature range frame are counted, and then the proportion of white points contained in the target color temperature range frame is determined. The electronic device stores a preset proportion threshold, for example, the preset proportion threshold is 50%, 60%, etc. If the proportion of white points contained in the target color temperature range frame is greater than the preset proportion threshold, the white balance value corresponding to the target color temperature is directly determined as the target white balance value. If the proportion of white points contained in the target color temperature range frame is not greater than the preset proportion threshold, a second judgment is performed at this time. Specifically, it is determined whether the white points not included in the target color temperature range frame are included in the candidate color temperature range frame adjacent to the target color temperature range frame. If the white points not included in the target color temperature range frame are not completely included in the candidate color temperature range frame adjacent to the target color temperature range frame, the white balance value corresponding to the target color temperature is still determined as the target white balance value. If the white point not included in the target color temperature range frame is completely included in the candidate color temperature range frame adjacent to the target color temperature range frame, the target white balance value is determined according to the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame. Different weights may be assigned to the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame, respectively, wherein the weight assigned to the white balance value corresponding to the target color temperature is greater than the weight assigned to the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame. Then, the target white balance value is obtained by weighted summing the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame.
[0073] Since in the embodiment of the present invention, the proportion of white points included in the target color temperature range frame is greater than the preset proportion threshold, or although the proportion of white points included in the target color temperature range frame is not greater than the preset proportion threshold, but the white points not included in the target color temperature range frame are not included in the candidate color temperature range frame adjacent to the target color temperature range frame, the white balance value corresponding to the target color temperature is determined as the target white balance value. Otherwise, the target white balance value is determined according to the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame. Thereby, the determined target white balance value is more accurate, and the effect of white balance adjustment according to the target white balance value is better.
[0074] Figure 2 A detailed flow chart of white balance adjustment provided by an embodiment of the present invention, the process includes the following steps:
[0075] S201: The electronic device stores the third average white point coordinate information corresponding to each reference device at different color temperatures, recorded as an array benchWhitePoint; and the corresponding color temperature range frame information, the color temperature range frame information includes: the center coordinate information of the color temperature range frame is recorded as an array benchFramePoint, and the color temperature range frame shape information is recorded as data benchFrame, and then proceeds to S202.
[0076] S202: Calculate the vector value between the benchWhitePoint and benchFramePoint arrays at each color temperature and store it as an array benchVector, and proceed to S203.
[0077] S203: The electronic device stores the second average white point coordinate information corresponding to the devices to be adjusted at different color temperatures, recorded as an array tuningWhitePoint; and the white balance values tuningAWBValue at different color temperatures, and then performs S204.
[0078] S204: In actual operation of the electronic device, the white blocks of the current scene are analyzed and obtained, and the geometric centers of all the white block coordinates counted are calculated to obtain the first average white point coordinate information of the current scene, which is recorded as currWhitePoint, and then S205 is performed.
[0079] S205: currWhitePoint finds the point data closest to currWhitePoint in the array tuningWhitePoint by traversing all the recorded point data in the array using the Euclidean distance, and records the target second average white point coordinate information as tuningWhitePoint-α, and proceeds to S206.
[0080] S206: Find the corresponding target vector value benchVector-α in the vector array benchVector based on tuningWhitePoint-α, and proceed to S207.
[0081] S207: Based on tuningWhitePoint-α and the target vector value benchVector-α, calculate the target center coordinate information tuningFramePoint-α of the device to be adjusted, and proceed to S208.
[0082] Assuming the benchWhitePoint-α value is (2, 3) and the benchFramePoint-α value is (4, 5), then the vector benchVector-α is (2-4, 3-5). Assuming the tuningWhitePoint-α value is (6, 7), then the tuningFramePoint-α value is (x, y), and we have: 2-4 = 6-x; 3-5 = 7-y.
[0083] S208: Based on the calculated tuningFramePoint-α value, take it as the frame center, translate the reference device frame shape information benchFrame-α, construct the target color temperature range frame tuningFrame-α of the device to be adjusted, and proceed to S209.
[0084] S209: Determine whether the proportion of white dots contained in tuningFrame-α is above 50%, if so, proceed to S2010; if not, proceed to S2011.
[0085] S2010: directly use the white balance value corresponding to the previously calibrated target color temperature as the target white balance value tuningAWBValue-α, and end.
[0086] S2011: Determine whether the white point not included in the target color temperature range frame is included in the candidate color temperature range frame adjacent to the target color temperature range frame. If so, proceed to S2012; if not, proceed to S2010.
[0087] S2012: Assuming that the adjacent white balance value is tuningVaule-β, a mixed calculated target white balance value result is: tuningAWBVaule-α*coef1+tuningAWBVaule-β*coef2, and the process ends. coef1 is the weight value of the white balance value corresponding to the target color temperature range frame; coef2 is the weight value of the white balance value corresponding to the adjacent candidate color temperature range frame, for example, coef1 is 1.0 and coef2 is 0.1.
[0088] The “different color temperatures” described in S201 above, in the concept of image services, generally include A (2700 color temperature), TL84 (4200 color temperature), D50 (5000 color temperature), D65 (6500 color temperature), and D75 (7500 color temperature).
[0089] The "average white point coordinate information" described in the above steps refers to the RGain and BGain statistical values presented on the gray and white blocks on the color card after the reference device or the device to be adjusted collects 24 color card images at different color temperatures. The array benchWhitePoint described in S201 above is specifically a white point value at each color temperature, representing a white point center weight value of the benchmark device at different color temperatures. The specific calculation method of the white point value is to calculate the average of several gray and white block statistical values at the corresponding color temperature. The tuningWhitePoint described in S203 has the same meaning, but the object is changed to the device to be adjusted.
[0090] The "color temperature range frame information" described in S201 above refers to the range frame that limits the color temperature range to which the statistical value belongs under different color temperatures of the reference device. At any time, as long as the white point coordinate information counted by the current scene falls within a certain range frame, the color temperature of the current scene is the color temperature to which the range frame belongs. The range frames are all rectangular frames. Each color temperature has a range frame to which it belongs. There are overlapping parts between the range frames, and the shape formed by all the range frames conforms to the shape of the Planck curve. The center coordinates of the frame are recorded as the array benchFramePoint, which stores the center coordinates of the range frame under all color temperatures. The corresponding frame shape information is recorded as the data benchFrame, which stores the coordinates of the upper left and lower right points of the range frame under all color temperatures.
[0091] The "vector value at each color temperature is stored as an array benchVector" described in S202 above is specifically to obtain the array benchWhitePoint at different color temperatures and the array benchFramePoint at different color temperatures, and calculate the vector array benchVector according to the one-to-one correspondence of color temperatures. For example, using the data at color temperature A, benchVector_A = (benchWhitePoint_A - benchFramePoint_A) is obtained. It should be noted that the schematic formula actually covers the calculation of two dimensions of RGain and BGain.
[0092] The “white balance value tuningAWBValue at different color temperatures” described in S203 above refers to the white balance gain value of the device to be adjusted when performing white balance calibration at different color temperatures.
[0093] The "obtaining the first average white point coordinate information of the current scene, recorded as currWhitePoint" in the above S204 means that the device to be adjusted runs in the real scene to find the white point information in the scene, and calculates the white point center mean value in the current real scene. There are many methods for the device to find the white point information in the real scene, which are mature technologies and will not be described here. The available methods include the gray world method to find the white point.
[0094] In the above S205, the calculated white point value of the current scene is matched with the data in the array tuningWhitePoint, in order to preliminarily determine the approximate color temperature position of the current scene. The value of tuningWhitePoint-α, α represents a certain color temperature.
[0095] The above S206 is to find the vector value benchVector-α at the corresponding color temperature in the vector array benchVector according to tuningWhitePoint-α.
[0096] The calculation basis of the above S207 is vector calculation, which can quickly calculate the coordinate value of the fourth point by knowing the coordinate values of three points.
[0097] The above-mentioned S208 "translate the frame shape information benchFrame-α of the reference device to construct the frame range tuningFrame-α of the device to be adjusted", specifically, after obtaining the frame center coordinates of the device to be adjusted in S207, keep the frame size and shape of the reference device at the corresponding color temperature unchanged, and only translate the frame center to the frame center coordinates of the device to be calibrated, to obtain the frame information of the device to be debugged at the corresponding color temperature. In actual use, the constructed frame range tuningFrame-α can be regenerated each time according to the traversal of the device usage scenario; or it can be recorded one by one according to the scene traversal, and the next time the same color temperature is encountered, it can be directly used without repeated calculation.
[0098] The above S209 is based on the white area feedback of the actual scene and the block status of the picture statistics in the algorithm.
[0099] The color temperature range frame described in the above steps will affect the white balance style. For example, if the color temperature range frame under color temperature A is relatively small, then if the white point information counted by the device in the actual scene is not concentrated enough, then some white points may fall within the color temperature range frame A, and some may fall outside the color temperature range frame A. At this time, it is necessary to continue to calculate whether these points falling outside the color temperature range frame A fall within other color temperature range frames. If so, the corresponding white balance correction value must be weighted as in step S2012. If the color temperature range frame is relatively large, it is considered to be completely within the color temperature A, and the output white balance correction value does not need to be weighted. The values obtained by the two calculation results are different, and the reflection from the image is that the white balance style is inconsistent.
[0100] Figure 3 A schematic diagram of a white point and color temperature range provided by an embodiment of the present invention is shown in FIG. Figure 3As shown, in a two-dimensional coordinate system, the horizontal axis represents RGain (G / R) and the vertical axis represents BGain (G / B). Figure 3 The color temperature range box under different color temperatures is shown in the figure, and each color temperature range box is a rectangular box. The blue dots represent the corresponding white point values when the reference device is photographed at different color temperatures against the 24-color card. The center coordinates of each color temperature range box here constitute the array benchFramePoint, and the upper left and lower right coordinates of each color temperature range box constitute the array benchFrame. Here, the average of several white point values corresponding to each color temperature is calculated separately, and a white point average value is obtained at each color temperature, forming the array benchWhitePoint. The red dots represent the white points of the device to be adjusted at different color temperatures. Similarly, the average of these white points is calculated separately to form the array tuningWhitePoint.
[0101] Figure 4 Schematic diagram of the color temperature range frame translation process provided by an embodiment of the present invention. Figure 4 As shown, the step "finding the point data tuningWhitePoint-α closest to currWhitePoint" in S205 of this case is missing, and the result of the final quantization migration of all color temperature range frames is directly presented. In the actual operation of the device, the currWhitePoint counted in the current scene is used to roughly determine which color temperature it falls under, and then the benchWhitePoint (blue dot), benchFrame (blue frame), and tuningWhitePoint (red dot) under the corresponding color temperature are taken out to find tuningFrame (red frame).
[0102] In the process of calculating the target white balance value, there are four cases. The first is that the white point is completely within a target color temperature range frame. In this case, the white balance value corresponding to the previously calibrated target color temperature is directly used as the target white balance value. The second is that the white point is not completely within a target color temperature range frame, and the white point not included in the target color temperature range frame is not included in the adjacent candidate color temperature range frame. In this case, the white balance value corresponding to the previously calibrated target color temperature is directly used as the target white balance value. The third is that the white point is not completely within a target color temperature range frame, and the white point not included in the target color temperature range frame is included in the adjacent candidate color temperature range frame. In this case, the target white balance value is obtained by weighted summation based on the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the adjacent candidate color temperature range frame. The fourth type is that the white point is completely within the target color temperature range frame, and part of the white point is included in the adjacent candidate color temperature range frame. In this case, the target white balance value can be obtained by weighted summation based on the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the adjacent candidate color temperature range frame. You can also directly use the white balance value corresponding to the previously calibrated target color temperature as the target white balance value.
[0103] The embodiment of the present invention provides a method for dynamic quantitative migration of white balance style, which solves the problem of consistency of white balance style; it proposes that the white balance style is quantitatively defined by means of a color temperature range frame, and the positional relationship of the white point statistical values between the device to be adjusted and the reference device is used to calculate the target color temperature range frame of the device to be adjusted, and the migration action is dynamically completed as the device runs, which solves the problem that the manual intervention of white balance debugging is time-consuming and the effect is inconsistent; according to the white point data obtained in the actual scene, combined with its positional relationship with different color temperature frame ranges, weight iteration is performed to obtain the final target white balance value, and then the white balance adjustment is performed according to the target white balance value.
[0104] Embodiment 4:
[0105] Figure 5 A schematic diagram of the structure of a white balance adjustment device provided in an embodiment of the present invention includes:
[0106] A first determination module 51 is used to obtain first average white point coordinate information of the device to be adjusted in the current scene, and determine the target color temperature corresponding to the current scene according to the first average white point coordinate information;
[0107] A second determination module 52 is used to determine a target vector value corresponding to the target color temperature according to the vector values corresponding to each color temperature of the predetermined reference device, and to translate the color temperature range frame corresponding to the target color temperature according to the target vector value to obtain the target color temperature range frame;
[0108] The adjustment module 53 is used to determine a target white balance value according to the white point ratio included in the target color temperature range frame, and use the target white balance value to perform white balance adjustment.
[0109] The first determination module 51 is specifically used to select the target second average white point coordinate information corresponding to the first average white point coordinate information from the pre-saved second average white point coordinate information corresponding to the device to be adjusted at each color temperature; and determine the color temperature corresponding to the target second average white point coordinate information as the target color temperature corresponding to the current scene.
[0110] The first determination module 51 is specifically used to determine, for each second average white point coordinate information, the Euclidean distance between the second average white point coordinate information and the first average white point coordinate information; and select the second average white point coordinate information with the smallest Euclidean distance as the target second average white point coordinate information corresponding to the first average white point coordinate information.
[0111] The second determination module 52 is specifically used to determine the target center coordinate information based on the target second average white point coordinate information and the target vector value; translate the color temperature range frame corresponding to the target color temperature to obtain the target color temperature range frame, so that the center coordinate information of the target color temperature range frame is the target center coordinate information.
[0112] The second determination module 52 is also used to obtain the third average white point coordinate information and the center coordinate information of the color temperature range box corresponding to each color temperature of the reference device; and determine the vector value corresponding to each color temperature according to the third average white point coordinate information and the center coordinate information of the color temperature range box corresponding to each color temperature.
[0113] The adjustment module 53 is specifically configured to determine the white balance value corresponding to the target color temperature as the target white balance value if the proportion of white points included in the target color temperature range frame is greater than a preset proportion threshold.
[0114] The adjustment module 53 is further used to determine whether the white points not included in the target color temperature range frame are included in the candidate color temperature range frame adjacent to the target color temperature range frame if the proportion of white points included in the target color temperature range frame is not greater than a preset proportion threshold; if not, determine the white balance value corresponding to the target color temperature as the target white balance value; if yes, determine the target white balance value according to the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame.
[0115] Embodiment 5:
[0116] Based on the above embodiments, an electronic device is also provided in an embodiment of the present invention, such as Figure 6As shown, it includes: a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304;
[0117] The memory 303 stores a computer program. When the program is executed by the processor 301, the processor 301 performs the following steps:
[0118] Acquire first average white point coordinate information of the device to be adjusted in the current scene, and determine the target color temperature corresponding to the current scene according to the first average white point coordinate information;
[0119] Determine a target vector value corresponding to the target color temperature according to a predetermined vector value corresponding to each color temperature of a reference device, and translate a color temperature range frame corresponding to the target color temperature according to the target vector value to obtain a target color temperature range frame;
[0120] A target white balance value is determined according to the white point ratio contained in the target color temperature range frame, and the target white balance value is used to perform white balance adjustment.
[0121] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present invention. Since the principle of solving the problem by the above electronic device is similar to that of the white balance adjustment method, the implementation of the above electronic device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0122] The electronic device provided in the embodiment of the present invention may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), a network side device, etc.
[0123] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0124] The communication interface 302 is used for communication between the electronic device and other devices.
[0125] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0126] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0127] Embodiment 6:
[0128] On the basis of the above embodiments, an embodiment of the present invention further provides a computer storage readable storage medium, wherein the computer readable storage medium stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device implements the following steps when executing:
[0129] Acquire first average white point coordinate information of the device to be adjusted in the current scene, and determine the target color temperature corresponding to the current scene according to the first average white point coordinate information;
[0130] Determine a target vector value corresponding to the target color temperature according to a predetermined vector value corresponding to each color temperature of a reference device, and translate a color temperature range frame corresponding to the target color temperature according to the target vector value to obtain a target color temperature range frame;
[0131] A target white balance value is determined according to the white point ratio contained in the target color temperature range frame, and the target white balance value is used to perform white balance adjustment.
[0132] Based on the same inventive concept, a computer-readable storage medium is also provided in an embodiment of the present invention. Since the principle of solving the problem when the processor executes the computer program stored on the above-mentioned computer-readable storage medium is similar to the white balance adjustment method, the implementation of the processor when executing the computer program stored on the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0133] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.
[0134] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0137] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0138] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A white balance adjustment method, characterized in that: The method comprises: Acquire first average white point coordinate information of the device to be adjusted in the current scene, and determine the target color temperature corresponding to the current scene according to the first average white point coordinate information; Determine a target vector value corresponding to the target color temperature according to a predetermined vector value corresponding to each color temperature of a reference device, and translate a color temperature range frame corresponding to the target color temperature according to the target vector value to obtain a target color temperature range frame; Determine a target white balance value according to the proportion of white points contained in the target color temperature range frame, and use the target white balance value to perform white balance adjustment; Among them, if the proportion of white points included in the target color temperature range frame is greater than a preset proportion threshold, the white balance value corresponding to the target color temperature is determined as the target white balance value; if the proportion of white points included in the target color temperature range frame is not greater than the preset proportion threshold, it is determined whether the white points not included in the target color temperature range frame are included in the candidate color temperature range frame adjacent to the target color temperature range frame. If not, the white balance value corresponding to the target color temperature is determined as the target white balance value. If yes, the target white balance value is determined according to the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame.
2. The method according to claim 1, characterized in that The determining, according to the first average white point coordinate information, a target color temperature corresponding to the current scene includes: Selecting target second average white point coordinate information corresponding to the first average white point coordinate information from the pre-saved second average white point coordinate information corresponding to the device to be adjusted at each color temperature; The color temperature corresponding to the target second average white point coordinate information is determined as the target color temperature corresponding to the current scene.
3. The method according to claim 2, characterized in that The selecting target second average white point coordinate information corresponding to the first average white point coordinate information includes: For each piece of second average white point coordinate information, determining the Euclidean distance between the second average white point coordinate information and the first average white point coordinate information; The second average white point coordinate information with the smallest Euclidean distance is selected as the target second average white point coordinate information corresponding to the first average white point coordinate information.
4. The method according to claim 2, characterized in that The step of translating the color temperature range frame corresponding to the target color temperature according to the target vector value to obtain the target color temperature range frame comprises: The target center coordinate information is determined according to the target second average white point coordinate information and the target vector value; the color temperature range frame corresponding to the target color temperature is translated to obtain the target color temperature range frame, so that the center coordinate information of the target color temperature range frame is the target center coordinate information.
5. The method according to claim 1, characterized in that The process of predetermining the vector values corresponding to the reference device at each color temperature includes: Obtaining third average white point coordinate information and center coordinate information of the color temperature range frame corresponding to the reference device at each color temperature; The vector values corresponding to the respective color temperatures are determined according to the third average white point coordinate information corresponding to the respective color temperatures and the center coordinate information of the color temperature range frame.
6. A white balance adjustment device, characterized in that: The device comprises: A first determination module, configured to obtain first average white point coordinate information of the device to be adjusted in a current scene, and determine a target color temperature corresponding to the current scene according to the first average white point coordinate information; A second determination module is used to determine a target vector value corresponding to the target color temperature according to the vector values corresponding to each color temperature of the predetermined reference device, and to translate the color temperature range frame corresponding to the target color temperature according to the target vector value to obtain the target color temperature range frame; An adjustment module, configured to determine a target white balance value according to the proportion of white points contained in the target color temperature range frame, and use the target white balance value to perform white balance adjustment; Among them, if the proportion of white points included in the target color temperature range frame is greater than a preset proportion threshold, the white balance value corresponding to the target color temperature is determined as the target white balance value; if the proportion of white points included in the target color temperature range frame is not greater than the preset proportion threshold, it is determined whether the white points not included in the target color temperature range frame are included in the candidate color temperature range frame adjacent to the target color temperature range frame. If not, the white balance value corresponding to the target color temperature is determined as the target white balance value. If yes, the target white balance value is determined according to the white balance value corresponding to the target color temperature and the white balance value of the candidate color temperature corresponding to the candidate color temperature range frame.
7. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 5 when executing a program stored in a memory.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.
