Chrominance information determination method and related electronic equipment
Through the combination of the multispectral sensor and the automatic white balance module, a suitable algorithm is selected and the confidence level is adjusted to calculate accurate target chromaticity information, which solves the problem of insufficient accuracy of the existing white balance algorithm in complex light source environments and ensures that the image is white. Balanced effects and color consistency.
Patent Information
- Application Number
- CN202410645824.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-12
- Publication Date
- 2024-09-10
AI Technical Summary
The existing white balance algorithm is not very accurate in calculating the RGB value of the white point of the image light source, resulting in poor image white balance adjustment. Especially in complex light source environments, the accuracy of the AWB algorithm is insufficient, while the AI AWB algorithm is in generalized scenes. It is also difficult to provide accurate colorimetric information when not done well.
Using a multispectral sensor combined with an automatic white balance module and an AI automatic white balance module, more accurate target chromaticity information can be calculated by selecting a suitable algorithm and adjusting the confidence level. The multispectral sensor is used to provide initial chromaticity information during cold start. Ensure that the first frame image has no color cast, and use the chromaticity information calculated by the multispectral sensor to adjust the white balance in a solid color scene.
It improves the accuracy and effect of image white balance adjustment, ensures the color consistency of the first frame image, and provides highly accurate chromaticity information in solid color scenes, improving the color performance of the image.
Smart Images

Figure CN118632134A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a method for determining chromaticity information and related electronic equipment. Background Art
[0002] White balance is an adjustment that a digital camera device or related software can make to a captured image to ensure that the whites in the image appropriately reflect the actual whites in the real-world scene where the image was taken. White balance is related to color temperature, which is a measure of the quality of light measured in Kelvin based on the ratio of the amount of blue light to the amount of red light in images and scenes. Images or scenes with higher color temperatures have more blue than those with lower color temperatures. Thus, "cooler" light has a higher color temperature, and "warmer" light has a lower color temperature.
[0003] The human eye and brain can adapt to different color temperatures. For example, whether in sunlight or under various lighting conditions, the human eye sees white objects as white, that is, the human eye has color constancy. Since the charge-coupled device (CCD) or CMOS circuit in the camera used to convert light signals into electrical signals cannot correct the color changes of the light source like the human eye. Therefore, it is necessary to estimate the chromaticity of the light source of the captured image through a white balance algorithm, and adjust the image color by using the estimated light source chromaticity so that the color of the adjusted image is consistent with the color actually observed by the human eye. How to improve the accuracy of the white balance algorithm is an issue that technicians are increasingly concerned about. Summary of the invention
[0004] The embodiments of the present application provide a method for determining chromaticity information and related electronic devices, which solve the problem that the chromaticity information calculated by the AWB and AI AWB fusion algorithms is not accurate enough.
[0005] In the first aspect, an embodiment of the present application provides a method for determining chromaticity information, which is applied to an electronic device, the electronic device includes a multispectral sensor, an automatic white balance module and an AI automatic white balance module, the automatic white balance module includes multiple algorithms, and the method includes: the electronic device starts a camera application; the multispectral sensor obtains a first channel value, wherein the multispectral sensor includes a first channel, and the first channel value is a value obtained by the first channel; the first channel value is sent to the automatic white balance module; according to the first channel value, the automatic white balance module selects a target algorithm from multiple algorithms; the electronic device determines the target chromaticity information according to the target algorithm. In the above embodiment, since the automatic white balance module can select a target algorithm according to the first channel value, this target algorithm is an AWB algorithm that matches the current shooting environment, the target chromaticity information calculated by the electronic device based on the target algorithm has a higher accuracy, and when the electronic device uses the target chromaticity information to adjust the white balance of the image, the adjustment effect is better.
[0006] In combination with the first aspect, in one embodiment, the method further includes: the multispectral sensor acquires a first correlated color temperature; the first correlated color temperature is sent to the AI automatic white balance module; the AI automatic white balance module determines the difference between the first correlated color temperature and the second correlated color temperature, the second correlated color temperature being the correlated color temperature value obtained by the AI automatic white balance module based on the image captured by the camera; when the difference is greater than a preset threshold, the confidence level output by the AI automatic white balance module is adjusted to the first confidence level; the electronic device determines the target chromaticity information based on the first confidence level. In the above embodiment, the electronic device adjusts the confidence level output by the AI automatic white balance according to the difference between the first correlated color temperature and the second correlated color temperature to obtain the first confidence level, thereby improving the accuracy of the first confidence level, so that the target chromaticity information calculated based on the first confidence level is more accurate, and when the electronic device uses the target chromaticity information to adjust the white balance of the image, the adjustment effect is better.
[0007] In combination with the first aspect, in one embodiment, the method further includes: when the startup is a cold startup, the multispectral sensor acquires first chromaticity information; the electronic device determines that the target chromaticity information is the first chromaticity information. In this way, the electronic device can use the first chromaticity information to perform white balance adjustment on the first frame or the first few frames of the image output by the camera, so that the first frame or the first few frames of the image will not have color cast.
[0008] In combination with the first aspect, in one embodiment, the method further includes: when the automatic white balance module or the AI automatic white balance module determines that the image captured by the camera is a pure color image, the electronic device determines that the target chromaticity information is the second chromaticity information, and the second chromaticity information is the chromaticity information acquired by the multispectral sensor. In this way, when the automatic white balance module or the AI automatic white balance module cannot accurately calculate the chromaticity information of the pure color image, the electronic device can also call the second chromaticity information with higher accuracy to adjust the white balance of the image, thereby solving the color cast problem of the image.
[0009] In combination with the first aspect, in one implementation, the first channel value includes one or more of the following: a visible light channel value, a NIR channel value, and a Clear channel value.
[0010] In combination with the first aspect, in one embodiment, the electronic device determines the target chromaticity information according to the first confidence level, specifically including: the automatic white balance module calculates the image captured by the camera through the target algorithm to obtain the third correlated color temperature and the first chromaticity distance; the AI automatic white balance module obtains the fourth correlated color temperature and the second chromaticity distance based on the image captured by the camera; the electronic device corrects the first confidence level to obtain the second confidence level; the electronic device fuses the third correlated color temperature with the fourth correlated color temperature according to the second confidence level to obtain the fifth correlated color temperature; the electronic device fuses the first chromaticity distance with the second chromaticity distance according to the second confidence level to obtain the third chromaticity distance; the electronic device obtains the target chromaticity information based on the fifth correlated color temperature and the third chromaticity distance. In the above embodiment, since the automatic white balance module uses the target algorithm to calculate the first chromaticity distance and the third correlated color temperature, the calculated first chromaticity distance and the third correlated color temperature are highly accurate. Since the electronic device adjusts the confidence of the AI automatic white balance output according to the difference between the first correlated color temperature and the second correlated color temperature, the first confidence is obtained, the accuracy of the first confidence is improved, and the second confidence is corrected by the first confidence, so the accuracy of the second confidence is also improved. Since the third chromaticity distance is obtained by the electronic device fusing the first chromaticity distance and the second chromaticity distance according to the second confidence, and the fifth correlated color temperature is obtained by the electronic device fusing the third correlated color temperature and the fourth correlated color temperature according to the second confidence, the accuracy of the third chromaticity distance and the fifth correlated color temperature is also improved, so that the accuracy of the target chromaticity information obtained based on the third chromaticity distance and the fifth correlated color temperature is also improved. When the electronic device uses the target chromaticity information to adjust the white balance of the image, the color cast problem of the image can be more effectively solved.
[0011] In combination with the first aspect, in one implementation, the electronic device obtains the target chromaticity information based on the fifth correlated color temperature and the third chromaticity distance, specifically including: adjusting the fifth correlated color temperature by a tendency to obtain a sixth correlated color temperature; adjusting the third chromaticity distance by a tendency to obtain a fourth chromaticity distance; and obtaining the target chromaticity information based on the sixth correlated color temperature and the fourth chromaticity distance. In this way, the electronic device can obtain the target chromaticity information with high accuracy according to the sixth correlated color temperature and the fourth chromaticity distance, and when the electronic device uses the target chromaticity information to adjust the white balance of the image, the color cast problem of the image can be solved more effectively.
[0012] In combination with the first aspect, in one implementation, the AI automatic white balance module obtains the fourth correlated color temperature and the second chromaticity distance based on the image captured by the camera, specifically including: the AI automatic white balance module outputs the second correlated color temperature and the initial chromaticity distance according to the image captured by the camera; the second correlated color temperature and the initial chromaticity distance are corrected to obtain the corrected second correlated color temperature and the corrected initial chromaticity distance; based on the corrected second correlated color temperature and the corrected initial chromaticity distance, time series filtering is performed to obtain the fourth correlated color temperature and the second chromaticity distance. In this way, the fourth correlated color temperature and the second chromaticity distance obtained by time series filtering are more accurate.
[0013] In combination with the first aspect, in one implementation, the method of performing temporal filtering based on the corrected second correlated color temperature and the corrected initial chromaticity distance to obtain the fourth correlated color temperature and the second chromaticity distance specifically includes: according to the formula Update the first covariance matrix to obtain an updated first covariance matrix; Sigma′1 is the updated first covariance matrix, Sigma1 is the first covariance matrix, λ1 is the first parameter, the first covariance matrix is the covariance matrix output by the AI automatic white balance module according to the image captured by the camera, or the first covariance matrix is the covariance matrix calculated based on the second confidence level; according to the formula Update the second covariance matrix to obtain an updated second covariance matrix; the second covariance matrix is the covariance matrix of the second image, the second image is the previous frame image captured by the camera, Sigma′2 is the updated second covariance matrix, Sigma2 is the second covariance matrix, and λ2 is the second parameter; based on the corrected second correlated color temperature and the corrected initial chromaticity distance calculation, obtain the first filter vector; according to the formula Mu=Mu1*(Sigma′1) -1 +Mu2*(Sigma′2) -1, get the second filter vector; Mu1 is the first filter vector, Mu2 is the filter vector of the second image, and Mu is the second filter vector; based on the second filter vector, the fourth correlated color temperature and the second chromaticity distance are calculated and processed to get. In this way, the fourth correlated color temperature and the second chromaticity distance obtained by time series filtering are more accurate.
[0014] In combination with the first aspect, in one implementation, the electronic device fuses the third correlated color temperature with the fourth correlated color temperature according to the second confidence level to obtain the fifth correlated color temperature, specifically including: determining the first probability value according to the brightness value of the image captured by the camera, the fourth correlated color temperature and the second chromaticity distance; calculating the fifth correlated color temperature according to the formula CCT5=Conf_2*X′*CCT4+(1-Conf_2*X′)*CCT3; wherein Conf_2 is the second confidence level, X′ is the first probability value, CCT4 is the fourth correlated color temperature, CCT3 is the third correlated color temperature, and CCT5 is the fifth correlated color temperature. In this way, the electronic device can obtain the target chromaticity information with high accuracy according to the fifth correlated color temperature and the third chromaticity distance, and when the electronic device uses the target chromaticity information to adjust the white balance of the image, the color cast problem of the image can be solved more effectively.
[0015] In combination with the first aspect, in one implementation, the electronic device fuses the first chromaticity distance with the second chromaticity distance according to the second confidence level to obtain a third chromaticity distance, specifically including: determining a second probability value according to the brightness value of the image captured by the camera, the fourth correlated color temperature, and the second chromaticity distance; determining a second probability value according to formula D uv3 =Conf_2*Y′*D uv2 +(1-Conf_2*Y′)*D uv1 , the third chromaticity distance is calculated; where Conf_2 is the second confidence, Y′ is the second probability value, D uv1 is the first chromaticity distance, D uv2 is the second chromaticity distance, D uv3 In this way, the electronic device can obtain target chromaticity information with high accuracy according to the fifth correlated color temperature and the third chromaticity distance, and when the electronic device uses the target chromaticity information to adjust the white balance of the image, the color cast problem of the image can be solved more effectively.
[0016] In combination with the first aspect, in one implementation, the fifth correlated color temperature is adjusted to obtain a sixth correlated color temperature, specifically including: determining a first correlated color temperature adjustment value according to the brightness value of the image captured by the camera, the fifth correlated color temperature, and the third chromaticity distance; obtaining a sixth correlated color temperature according to the formula CCT6=CCT5+Delta_CCT′, where CCT5 is the fifth correlated color temperature, CCT6 is the sixth correlated color temperature, and Delta_CCT′ is the first correlated color temperature adjustment value. In this way, when the electronic device uses the target chromaticity information calculated based on the sixth correlated color temperature and the fourth chromaticity distance to adjust the white balance of the image, the image color is made more in line with the user's visual habits on the basis of solving the image color deviation.
[0017] In combination with the first aspect, in one implementation, the third chromaticity distance is adjusted in a tendency to obtain a fourth chromaticity distance, specifically including: determining a first chromaticity distance adjustment value according to a brightness value of an image captured by a camera, a fifth correlated color temperature, and the third chromaticity distance; according to formula D uv4 =D uv3 +Delta_D uv ′, and get the fourth chromaticity distance, D uv4 is the fourth chromaticity distance, D uv3 is the third chromaticity distance, Delta_D uv Thus, when the electronic device uses the target chromaticity information calculated based on the sixth correlated color temperature and the fourth chromaticity distance to adjust the white balance of the image, the image color is made more in line with the user's visual habits on the basis of solving the image color cast.
[0018] In a second aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: the electronic device starts a camera application; the multispectral sensor obtains a first channel value, wherein the multispectral sensor includes a first channel, and the first channel value is a value obtained by the first channel; the first channel value is sent to an automatic white balance module; according to the first channel value, the automatic white balance module selects a target algorithm from multiple algorithms; the electronic device determines target chromaticity information according to the target algorithm.
[0019] In combination with the second aspect, in one embodiment, the one or more processors are also used to call the computer instructions to enable the electronic device to execute: the multispectral sensor obtains a first correlated color temperature; the first correlated color temperature is sent to the AI automatic white balance module; the AI automatic white balance module determines the difference between the first correlated color temperature and the second correlated color temperature, where the second correlated color temperature is the correlated color temperature value obtained by the AI automatic white balance module based on the image captured by the camera; when the difference is greater than a preset threshold, the confidence level output by the AI automatic white balance module is adjusted to a first confidence level; the electronic device determines the target chromaticity information based on the first confidence level.
[0020] In combination with the second aspect, in one embodiment, the one or more processors are also used to call the computer instruction to cause the electronic device to execute: when the startup is a cold start, the multispectral sensor obtains first chromaticity information; the electronic device determines that the target chromaticity information is the first chromaticity information.
[0021] In combination with the second aspect, in one embodiment, the one or more processors are also used to call the computer instructions to cause the electronic device to execute: when the automatic white balance module or the AI automatic white balance module determines that the image captured by the camera is a pure color image, the electronic device determines that the target chromaticity information is second chromaticity information, and the second chromaticity information is the chromaticity information obtained by the multispectral sensor.
[0022] In combination with the second aspect, in one embodiment, the one or more processors are also used to call the computer instructions so that the electronic device executes: the automatic white balance module calculates the image captured by the camera through the target algorithm to obtain the third correlated color temperature and the first chromaticity distance; the AI automatic white balance module obtains the fourth correlated color temperature and the second chromaticity distance based on the image captured by the camera; the electronic device corrects the first confidence level to obtain the second confidence level; the electronic device merges the third correlated color temperature with the fourth correlated color temperature according to the second confidence level to obtain the fifth correlated color temperature; the electronic device merges the first chromaticity distance with the second chromaticity distance according to the second confidence level to obtain the third chromaticity distance; the electronic device obtains the target chromaticity information based on the fifth correlated color temperature and the third chromaticity distance.
[0023] In combination with the second aspect, in one embodiment, the one or more processors are also used to call the computer instructions to cause the electronic device to execute: adjusting the fifth correlated color temperature to obtain a sixth correlated color temperature; adjusting the third chromaticity distance to obtain a fourth chromaticity distance; and obtaining the target chromaticity information based on the sixth correlated color temperature and the fourth chromaticity distance.
[0024] In combination with the second aspect, in one embodiment, the one or more processors are also used to call the computer instructions so that the electronic device executes: the AI automatic white balance module outputs a second correlated color temperature and an initial chromaticity distance based on the image captured by the camera; corrects the second correlated color temperature and the initial chromaticity distance to obtain a corrected second correlated color temperature and a corrected initial chromaticity distance; and performs time series filtering based on the corrected second correlated color temperature and the corrected initial chromaticity distance to obtain a fourth correlated color temperature and the second chromaticity distance.
[0025] In conjunction with the second aspect, in one embodiment, the one or more processors are further configured to call the computer instruction to cause the electronic device to execute: according to the formula Update the first covariance matrix to obtain an updated first covariance matrix; Sigma′1 is the updated first covariance matrix, Sigma1 is the first covariance matrix, λ1 is the first parameter, the first covariance matrix is the covariance matrix output by the AI automatic white balance module according to the image captured by the camera, or the first covariance matrix is the covariance matrix calculated based on the second confidence level; according to the formula Update the second covariance matrix to obtain an updated second covariance matrix; the second covariance matrix is the covariance matrix of the second image, the second image is the previous frame image captured by the camera, Sigma′2 is the updated second covariance matrix, Sigma2 is the second covariance matrix, and λ2 is the second parameter; based on the corrected second correlated color temperature and the corrected initial chromaticity distance calculation, obtain the first filter vector; according to the formula Mu=Mu1*(Sigma′1) -1 +Mu2*(Sigma′2) -1 , obtain the second filter vector; Mu1 is the first filter vector, Mu2 is the filter vector of the second image, and Mu is the second filter vector; based on the second filter vector, calculation and processing are performed to obtain the fourth correlated color temperature and the second chromaticity distance.
[0026] In combination with the second aspect, in one implementation, the one or more processors are further used to call the computer instructions so that the electronic device executes: determining a first probability value based on the brightness value of the image captured by the camera, the fourth correlated color temperature, and the second chromaticity distance; calculating a fifth correlated color temperature according to the formula CCT5=Conf_2*X′*CCT4+(1-Conf_2*X′)*CCT3; wherein Conf_2 is the second confidence level, X′ is the first probability value, CCT4 is the fourth correlated color temperature, CCT3 is the third correlated color temperature, and CCT5 is the fifth correlated color temperature.
[0027] In conjunction with the second aspect, in one implementation, the one or more processors are further configured to call the computer instruction to enable the electronic device to execute: determining a second probability value according to the brightness value, the fourth correlated color temperature, and the second chromaticity distance of the image captured by the camera; and determining the second probability value according to formula D uv3 =Conf_2*Y′*D uv2 +(1-Conf_2*Y′)*D uv1 , the third chromaticity distance is calculated; where Conf_2 is the second confidence, Y′ is the second probability value, D uv1 is the first chromaticity distance, D uv2 is the second chromaticity distance, D uv3 is the third chromaticity distance.
[0028] In combination with the second aspect, in one implementation, the one or more processors are further used to call the computer instructions so that the electronic device executes: determining a first correlated color temperature adjustment value according to the brightness value of the image captured by the camera, the fifth correlated color temperature, and the third chromaticity distance; obtaining a sixth correlated color temperature according to the formula CCT6=CCT5+Delta_CCT′, where CCT5 is the fifth correlated color temperature, CCT6 is the sixth correlated color temperature, and Delta_CCT′ is the first correlated color temperature adjustment value.
[0029] In combination with the second aspect, in one embodiment, the one or more processors are further configured to call the computer instruction to enable the electronic device to execute: determining a first chromaticity distance adjustment value according to the brightness value of the image captured by the camera, the fifth correlated color temperature, and the third chromaticity distance; and adjusting the first chromaticity distance according to formula D uv4 =D uv3 +Delta_D uv ′, and get the fourth chromaticity distance, D uv4 is the fourth chromaticity distance, D uv3 is the third chromaticity distance, Delta_D uv ' is the first chromaticity distance adjustment value.
[0030] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a touch screen, a camera, one or more processors and one or more memories; the one or more processors are coupled to the touch screen, the camera, and the one or more memories, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the method described in the first aspect or any possible implementation method of the first aspect.
[0031] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation method of the first aspect.
[0032] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0033] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on an electronic device, causes the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application;
[0035] Figure 2A-2C is a set of shooting interface diagrams provided in an embodiment of the present application;
[0036] Figure 2D This is a comparison effect diagram of an image adjusted by an automatic white balance algorithm provided in an embodiment of the present application;
[0037] Figure 3 is a flow chart of a method for determining chromaticity information provided by an embodiment of the present application;
[0038] Figure 4 This is a shooting interface diagram provided by an embodiment of the present application;
[0039] Figure 5 is a corresponding diagram of the preview image and its RGB adjustment value provided by the embodiment of the present application;
[0040] Fig. 6A is a CCT conversion table provided in an embodiment of the present application;
[0041] Figure 6B It is a CCT Shift Table three-dimensional space coordinate system provided in an embodiment of the present application;
[0042] Fig. 7A This is a D provided in the embodiment of the present application. uv Conversion table;
[0043] Figure 7B This is a D provided in the embodiment of the present application. uvShift Table three-dimensional space coordinate system;
[0044] Fig. 8A is a Confidence conversion table provided in an embodiment of the present application;
[0045] Figure 8B It is a Confidence Shift Table three-dimensional space coordinate system provided in an embodiment of the present application;
[0046] Fig. 9 This is a (CCT, D uv ) is converted into a schematic diagram of chromaticity information;
[0047] Fig.10 is a CCT fusion table provided in an embodiment of the present application;
[0048] Fig.11 This is a D provided in the embodiment of the present application. uv Fusion table;
[0049] Fig.12 It is a CCT tendency adjustment table provided in the embodiment of the present application;
[0050] Fig.13 This is a D provided in the embodiment of the present application. uv Tendency adjustment table. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiments may be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various positions in the specification is not necessarily the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It can be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0052] The terms "first", "second", "third", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or optionally, steps or units not listed are included, or optionally, other steps or units inherent to these processes, methods, products or devices are included.
[0053] Only the part relevant to the present application but not all content is shown in the accompanying drawings.Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods described as flow charts.Although flow charts describe various operations (or steps) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously.In addition, the order of various operations can be rearranged.Described processing can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings.Described processing can correspond to method, function, procedure, subroutine, subprogram etc.
[0054] As used in this specification, the terms "component", "module", "system", "unit", etc. are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a unit can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or distributed between two or more computers. In addition, these units can be executed from various computer-readable media having various data structures stored thereon. Units can communicate through local and / or remote processes, for example, based on signals having one or more data packets (e.g., data from a second unit interacting with another unit in a local system, a distributed system, and / or a network. For example, the Internet interacts with other systems via signals).
[0055] Below, some special terms involved in the embodiments of the present application are explained.
[0056] (1) Planck locus: An object that neither reflects nor projects completely under the action of radiation, but can absorb all the radiation falling on it, is called a black body or a perfect radiator. When a black body is continuously heated, the maximum value of its relative spectral power distribution will move toward the short-wave direction, and the corresponding light color will change in the order of red, yellow, white, and blue. At different temperatures, the arc-shaped locus formed by the light color change corresponding to the black body on the chromaticity diagram is called the black body locus or Planck locus.
[0057] (2) Correlated Colour Temperature (CCT): refers to the temperature of a black body radiator that is closest to the colour of the same brightness stimulus, expressed in degrees Kelvin, and is used to describe the colour of light near the Planckian locus. Other light sources, except thermal radiation sources, have linear spectra, and their radiation characteristics are quite different from those of black body radiation. Therefore, the colour of these light sources may not fall exactly on the black body locus on the chromaticity diagram. For such light sources, CCT is usually used to describe the colour characteristics of the light source.
[0058] (3) Chromaticity distance (D uv ): refers to the distance from the chromaticity value (u, v) of the test light source to the nearest point on the Planckian locus, D uv Characterizes the information of the color shift (green or pink) and direction of the chromaticity value (u, v) of the test light source and the Planckian locus.
[0059] (4) Lighting Value (LV): used to estimate the ambient brightness. The specific calculation formula is as follows:
[0060]
[0061] Among them, Exposure is the exposure time, Aperture is the aperture size, Iso is the sensitivity, and Luma is the average value of Y in the XYZ color space of the image.
[0062] (5) XYZ space: The RGB value in the embodiment of the present application is DeviceRGB. The DeviceRGB color space is a device-related color space, that is, different devices have different understandings of RGB values. Therefore, DeviceRGB is not suitable for calculating parameters such as brightness values. To calculate LV, the DeviceRGB color space needs to be converted into the device-independent XYZ space, that is, the RGB value is converted into the XYZ value.
[0063] The common method of converting RGB color space to XYZ space is: calibrate a 3*3 color correction matrix (ColorCorrection Matrix, CCM) under different light sources (typical light sources include A, H, U30, TL84, D50, D65, D75, etc.), and store the CCM of different light sources in the memory of the electronic device, through the formula:
[0064]
[0065] Get the three-dimensional vector corresponding to the image in the XYZ space, thereby realizing the conversion from RGB space to XYZ space. During the shooting process, the corresponding light source is often matched according to the white balance reference point in the image, and the CCM corresponding to the light source is selected. If there is an RGB value of the white balance reference point between the two light sources (for example, the RGB value of the image falls between D50 and D65), the CCM can be obtained by bilinear interpolation of D50 and D65. For example, the color correction matrix of D50 is CCM1, and the correlated color temperature is CCT1, the color correction matrix of D60 is CCM2, and the correlated color temperature is CCT2, and the correlated color temperature of the image light source is CCT a . Electronic devices can be based on the formula:
[0066]
[0067] Calculate the ratio value g, based on the ratio value, according to the formula:
[0068] CCM=g*CCM1+(1-g)*CCM2
[0069] The CCM of the image can be calculated.
[0070] See also Figure 1 , Figure 1 1 is a schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0071] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0072] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0073] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0074] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0075] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0076] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0077] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0078] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0079] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0080] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0081] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0082] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .
[0083] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0084] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0085] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0086] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0087] Since the CCD circuit or CMOS circuit in electronic devices such as digital cameras or mobile phones cannot correct the color change of the light source, in order to prevent the captured image from having problems such as color temperature, the image needs to be white balanced. At present, the most commonly used white balance algorithms include the traditional automatic white balance (Automatic White Balance, AWB) algorithm and the artificial intelligence automatic white balance algorithm (AI AWB algorithm). The AWB algorithm includes algorithms such as the gray world, and the AI AWB algorithm usually calculates the color description value of the image light source white point (such as the RGB value of the image light source white point, the R / G and B / G of the image light source white point, and the chromaticity value of the image light source white point) through a trained AI AWB model. Among them, the AI AWB model can be a neural network model, or a Fast Fourier Color Constancy (Fast Fourier Color Constancy, FFCC) model, or other models with the function of calculating the color description value of the image light source white point, and the embodiments of the present application are not limited to this. The color of the white point of the image light source is the color of the image light source. When the RGB value or R / G, B / G of the white point is calculated, the RGB value or R / G, B / G of the image pixel can be adjusted based on the RGB value or R / G, B / G of the white point, thereby achieving white balance adjustment of the image.
[0088] The advantages of using the AWB algorithm to white balance an image are small amount of calculation and a wide range of application scenarios. However, due to its simple calculation logic and small amount of calculation, when the light source environment of the shooting scene is complex, the accuracy of the RGB value of the image light source white point calculated by the AWB algorithm is not high, which leads to the effect of white balancing the image based on the RGB value of the image light source white point is not obvious.
[0089] For the AI AWB algorithm, since the AI AWB model it uses performs complex calculations on the input image, the accuracy of the RGB value of the image light source white point calculated by the AI AWB model is very high in shooting scenarios similar to the training scenarios. However, due to the limited training samples in the process of training the AI AWB model, the AI AWB model cannot be applied to all shooting environments. When users take photos in shooting scenarios with poor generalization, the accuracy of the RGB value of the image light source white point calculated by the AI AWB model is extremely low. When the ISP adjusts the white balance of the image based on the RGB value of the image light source white point, the adjustment effect is not obvious.
[0090] In order to solve the problem that the RGB value of the image light source white point calculated by the AWB algorithm is not accurate enough and the application scenarios of the AI AWB algorithm are limited, the embodiment of the present application provides a method for determining chromaticity information, the principle of which is that the multispectral sensor sends the first chromaticity information of the light source white point of the image to be processed calculated by the multispectral sensor to the memory. Since the multispectral sensor has a fast startup speed, during the cold start of the camera, the electronic device can use the first chromaticity information to adjust the white balance of the first frame or the first few frames of the image, so that the first frame or the first few frames of the image will not have a color cast problem. In addition, in the process of the electronic device calculating the chromaticity information of the image through the AWB algorithm and the AI AWB algorithm using the original data of the image, if the number of white points of the image light source is less than a certain threshold, the electronic device determines that the current shooting scene is a pure color scene. In the pure color scene, the chromaticity information of the image light source white point calculated by the electronic device through the AWB algorithm and the AI AWB algorithm is inaccurate. Therefore, the electronic device can also call the multispectral sensor to adjust the white balance of the image based on the calculated first chromaticity information. The electronic device processes the raw data of the image to be processed output by the camera and the spectral data and correlated color temperature CCT output by the multispectral sensor through the AWB algorithm to obtain the RGB value of the white point of the light source of the image. Based on the RGB value, the ratio R of the R (red) color channel to the G (green) color channel of the white point of the light source of the image can be obtained. 11 / G 11 And the ratio of the B (blue) color channel to the G (green) color channel 11 / G 11 At the same time, the electronic device calculates and processes the raw data of the image to be processed output by the camera and the spectral data and CCT output by the multispectral sensor through an artificial intelligence automatic white balance algorithm (AI AWB algorithm) to obtain the RGB value of the white point of the image light source. Based on the RGB value, the ratio R of the R (red) color channel to the G (green) color channel of the white point of the image light source can be obtained. 21 / G 21 And the ratio of the B (blue) color channel to the G (green) color channel 21 / G 21 Then, the electronics are based on R 11 / G 11 and B 11 / G 11 Calculate the correlated color temperature CCT of the image light source white point 11 and chromaticity distance D uv11 , based on R 21 / G 21 and B 21 / G 21 Calculate the correlated color temperature CCT of the image light source white point 21 and chromaticity distance D uv21 The electronics then convert the CCT 11 and CCT 21 Fusion is performed to obtain the fused CCT, and D uv11 and D uv21 Fusion is performed to obtain the fused D uv Finally, the electronic device is based on the fused CCT and fused D uv The fourth chromaticity information is obtained and sent to the memory so that the ISP can adjust the white balance of the image based on the fourth chromaticity information.
[0091] Next, combine Figure 2A-2D The application scenario of the method for determining chromaticity information is introduced.
[0092] like Figure 2A As shown, the electronic device 100 may display a home screen interface 210, which includes multiple application icons. For example, a weather application icon, a video application icon, a memo icon, a settings application icon, and a camera application icon 211. When the electronic device 100 detects an input operation (such as a single click) for the camera application icon 211, in response to the input operation, the electronic device 100 may display the following Figure 2B The shooting interface 220 is shown.
[0093] like Figure 2B As shown, the shooting interface 220 includes a shooting preview interface 221, a photo control 222, and an echo control 223. The shooting preview interface 221 is used to display the current shooting environment. When the electronic device 100 detects an input operation (such as a single click) for the echo control 223, the electronic device 100 will display the historical photos taken. When the electronic device 100 detects an input operation (such as a single click) for the photo control 222, in response to the operation, the electronic device displays the following Figure 2C The photo preview interface 230 shown. In this way, the user can preview the taken photos in the photo preview interface 230.
[0094] When the electronic device 100 detects Figure 2B After the photo control 222 is pressed, the electronic device 100 starts taking photos and performs white balance processing on the image. Figure 2D As shown, due to the different color temperatures of the light sources in the shooting environment, the image 1 before processing has color cast (the overall color of the image 1 is gray). After the electronic device 100 performs white balance processing on the image 1, the overall color of the processed image 1 is no longer gray and is consistent with the color actually observed by the human eye.
[0095] The following is a flowchart of a method for determining chromaticity information in conjunction with the accompanying drawings. Figure 3 , Figure 3 This is a flow chart of a method for determining chromaticity information provided by an embodiment of the present application. The specific process is as follows:
[0096] Step S301: The camera application is started.
[0097] For example, in the above Figure 2A In an embodiment, when the electronic device detects an input operation (eg, a single click) on the camera application icon 211 , the camera application is started.
[0098] Step S302: the electronic device sends the first chromaticity information of the white point of the image light source calculated by the multi-spectral sensor to the memory.
[0099] Specifically, the multispectral sensor is used to obtain the spectral data of the image light source, and calculate the color description values such as the correlated color temperature CCT and RGB values of the white point of the image light source based on these spectral data, so that the ISP can perform image processing based on these color description values (for example, white balance adjustment of the image). The embodiment of the present application is illustrated by a multispectral sensor including 8 visible light channels (F1 channel to F8 channel), an all-pass channel (Clear channel) and a near-infrared channel (NIR Value channel). Each channel of the multispectral sensor corresponds to a different wavelength range. When the device is exposed to light, each channel will generate a channel response value per unit time. This response value is the spectral data obtained by the multispectral sensor. Among them, the response value of the all-pass channel is used to characterize the brightness of the image, and the response value of the near-infrared channel is used to characterize the intensity of infrared light. The multispectral sensor can calculate the first chromaticity information based on the spectral data it obtains. The first chromaticity information can be the R1G1B1 value of the image light source white point, or the R1 / G1 and B1 / G1 of the image light source white point, or the chromaticity value (u1, v1) of the image light source white point. The embodiment of the present application does not limit this. Among them, the R1G1B1 value is used to characterize the channel response value of the image light source white point on the red, green, and blue color channels, and R1G1B1 can be converted to the chromaticity value (u1, v1).
[0100] When the camera is cold-started, the multispectral sensor will calculate the first chromaticity information, spectral data and the correlated color temperature CCT of the image light source white point. During the period from camera startup to taking pictures, the multispectral sensor will calculate the first chromaticity information of the preview image every one or more frames, and store the first chromaticity information in the memory. The preview image is the image displayed on the preview interface of the electronic device after the camera application is started. For example, when the camera application is started, the electronic device will display the following Figure 4 The shooting interface 410 shown in the figure includes a preview interface 411, and the preview interface 411 is used to display the real-time image of the current shooting environment. The real-time image displayed in the preview interface 411 is presented to the user in units of image frames, and the image frame is a preview image. At the same time, the multispectral sensor will calculate the spectral data and the correlated color temperature (CCT) of each frame of the image, and the electronic device will calculate and process the spectral data, raw data and correlated color temperature of the image through the AWB algorithm and the AI AWB algorithm, respectively, to obtain the chromaticity information of each frame of the image. However, the speed at which the camera outputs the image is faster than the speed at which the electronic device calculates the chromaticity information of the image through the AWB algorithm and the AI AWB algorithm, and the startup speed of the multispectral sensor is fast. Therefore, after the camera is started, the electronic device uses the first chromaticity information calculated by the multispectral sensor to adjust the white balance of the first frame or the first few frames of the preview image, so that the first frame or the first few frames of the preview image will not have a color cast problem. For example, as Figure 5 As shown, after the camera is started, it outputs images 1 to 8 in sequence. At the same time as the camera is started, the electronic device begins to use the AWB algorithm and the AIAWB algorithm to calculate the RGB value (chromaticity information) of the white point of the light source of each frame of the preview image. Since the camera outputs images faster than the electronic device calculates the RGB value of the white point of the light source of the preview image through the AWB algorithm and the AI AWB algorithm, when the camera outputs image 3, the electronic device calculates the RGB1 value of the white point of the light source of image 1 through the AWB algorithm and the AI AWB algorithm. When the camera outputs image 4, the electronic device calculates the RGB2 value of the white point of the light source of image 2. Since the timing differences between image 1 and image 3, and between image 2 and image 4 are extremely small, the electronic device can use the RGB1 value of image 1 to adjust the white balance of image 3 after outputting image 3, and can use the RGB2 value to adjust the white balance of image 4 after outputting image 4. However, when the camera outputs image 1 (first frame image) and image 2, the electronic device has not calculated the RGB value of the white point of its light source. Therefore, after the camera outputs image 1 and image 2, the electronic device uses the first chromaticity information (RGB value) sent to the memory by the multispectral sensor to adjust the white balance of image 1 and image 2, thereby solving the color cast problem of image 1 and image 2.
[0101] In some shooting environments, when the camera calculates and processes the original data of the image and the correlated color temperature CCT and spectral data output by the multispectral sensor through the AWB algorithm and the AI AWB algorithm, when it is detected that the number of effective image light source white points near the Planckian locus of the image is less than the first threshold, the electronic device determines that the current shooting scene is a pure color scene. In the pure color scene, the accuracy of the chromaticity information of the light source white point calculated by the AWB algorithm or the AI AWB algorithm is not high. Therefore, in the pure color scene, the electronic device can adjust the white balance of the preview image based on the first chromaticity information calculated by the multispectral sensor. Among them, the first threshold can be obtained based on empirical values, can also be obtained based on historical values, and can also be obtained based on experimental data, and the embodiments of the present application do not limit this.
[0102] Step S303: the electronic device calculates and processes the raw data output by the camera, the spectral data output by the spectral sensor, and the CCT through an AWB algorithm to obtain second chromaticity information of the white point of the image light source.
[0103] Specifically, raw data is the data that the image sensor in the camera converts the light source signal it captures into a digital signal. The image sensor includes multiple image-sensitive units, and each image-sensitive unit obtains an RGB value after sampling and quantization. The RGB value obtained by the electronic device downsampling the image-sensitive unit is the raw data.
[0104] For example, if the sensor has 6400x4800 pixel units, and the electronic device downsamples it by 100 times to obtain the RGB values of 64x48 pixel units, then the raw data obtained by the electronic device is a vector of size 64x48x3, where 64x48 is the number of pixel units and 3 is the RGB value calculated for each pixel unit.
[0105] The electronic device uses the raw data as the input of the AWB module, and performs calculation processing through the AWB algorithm to obtain the chromaticity information of the image light source white point, which is the second chromaticity information of the image light source white point. The second chromaticity information can be the R2G2B2 value of the image light source white point, or the R2 / G2, B2 / G2 of the image light source white point, or the chromaticity value (u2, v2) of the image light source white point, which is not limited in the embodiment of the present application.
[0106] The spectral data includes the channel response values of the 8 visible light channels output by the multi-spectral sensor, the response value of the full-pass channel, and the response value of the near-infrared channel. Multiple sets of AWB algorithms are stored in the electronic device, and each set of AWB algorithms corresponds to different shooting scenes. The electronic device can determine the type of the current shooting scene based on the spectral data output by the multi-spectral sensor, and select the corresponding AWB algorithm to calculate the second chromaticity information according to the type of the current shooting scene. In this way, the calculated second chromaticity information is more accurate. Exemplarily, the electronic device can determine multiple shooting scenes based on the NIR value output by the NIR channel in the spectral data. The correspondence table between the NIR value and the shooting scene and its related AWB algorithm is shown in Table 1:
[0107] Table 1
[0108] NIR value Shooting scene AWB algorithm 100-200 Blue sky and white clouds Algorithm 1 201-401 Outdoor greenery Algorithm 2 402-402 City night scene Algorithm 3 …… …… ……
[0109] If the NIR value is 150, the electronic device can determine that the type of the current shooting scene is blue sky and white clouds based on Table 1, and select Algorithm 1 to calculate the second chromaticity information.
[0110] Step S304: the electronic device converts the second chromaticity information into a first correlated color temperature of the image light source white point and a first chromaticity distance of the image light source white point.
[0111] Specifically, the first correlated color temperature is CCT1, and the first chromaticity distance is D uv1 .
[0112] Exemplarily, the electronic device calculates D uv1 The method can be:
[0113] When the second chromaticity information is R2 / G2 and B2 / G2 or R2G2B2 values, the electronic device can calculate the chromaticity value (u2, v2) of the frame image according to formula (1), and formula (1) is as follows:
[0114]
[0115] in, The conversion matrix is a conversion matrix. The embodiment of the present application only provides an exemplary description of the conversion matrix and does not limit the specific content of the conversion matrix.
[0116] Then, the electronic device obtains the coordinates (u′2, v′2) of the point on the Planckian locus that is the shortest distance from (u2, v2) on the chromaticity diagram. Finally, D is calculated according to formula (2) uv1 , formula (2) is as follows:
[0117] D uv1 =sgn(v2-v′2)*[(u2-u′2) 2+(v2-v′2) 2 ] 1 / 2 (2)
[0118] Among them, when v2-v′2≥0, sgn(v2-v′2)=1; when v2-v′2<0, sgn(v2-v′2)=-1.
[0119] Exemplarily, the method for the electronic device to calculate CCT1 may be:
[0120] When the second chromaticity information is R2 / G2 and B2 / G2 or R2G2B2 values, the electronic device can calculate the chromaticity value (u2, v2) of the frame image with reference to formula (1). Then, the electronic device obtains the point M with the shortest distance from (u2, v2) on the Planckian locus on the chromaticity diagram, and the CCT corresponding to the point M is CCT1.
[0121] Step S305: the electronic device calculates and processes the raw data output by the camera and the spectral data and the correlated color temperature output by the multispectral sensor through the AI AWB algorithm to obtain the third chromaticity information and the first confidence level of the white point of the image light source.
[0122] Specifically, the AI AWB algorithm includes a trained AI AWB model, and the electronic device uses the raw data, spectral data, and the correlated color temperature CCT calculated by the multi-spectral sensor as input, and obtains the third chromaticity information of the image light source white point after calculation and processing by the AI AWB model. The third chromaticity information can be the R3G3B3 value of the image light source white point, or the R3 / G3 and B3 / G3 of the image light source white point, or the chromaticity value (u3, v3) of the image light source white point, and the embodiment of the present application does not limit this. The first confidence level is used to characterize the reliability of the AI AWB model.
[0123] Step S306: The electronic device converts the third chromaticity information into a second correlated color temperature and a second chromaticity distance.
[0124] Specifically, the second correlated color temperature is CCT2, and the second chromaticity distance is D uv2 Electronic devices calculate CCT2 and D uv2 The method and process of converting the second chromaticity information into CCT1 and D in step S304 can be seen in FIG. uv1 The related description of the embodiments of the present application will not be repeated here.
[0125] Step S307: the electronic device adjusts the first confidence level based on the CCT output by the multispectral sensor to obtain a second confidence level.
[0126] Specifically, the electronic device calculates a deviation value Fn based on CCT and CCT2 output by the multispectral sensor, where Fn is used to characterize the degree of deviation between CCT and CCT2 output by the multispectral sensor. The larger the Fn, the greater the degree of deviation between CCT and CCT2 output by the multispectral sensor. When the deviation value exceeds a preset range, the electronic device determines that the first confidence level output by the AI AWB calculation model (e.g., AIAWB model) is inaccurate, and the electronic device adjusts the first confidence level based on Fn to obtain a second confidence level.
[0127] For example, if the preset range of Fn is 500K, the first confidence Conf_1 is 70%, the CCT output by the multispectral sensor is 3500K, and CCT2 is 4500K, then the deviation value Fn is 1000K. At this time, Fn exceeds the preset range, and the electronic device determines that the first confidence output by the AI AWB model is inaccurate, and the electronic device lowers the first confidence from 70% to 60%. Therefore, the second confidence Conf_2 is 60%.
[0128] Step S308: the electronic device corrects the second correlated color temperature, the second chromaticity distance, and the second confidence level to obtain a third correlated color temperature, a third chromaticity distance, and a third confidence level.
[0129] Specifically, the AI AWB model in the AI AWB algorithm is a pre-trained model. During the training process, due to limited training samples, the AI AWB model cannot be applied to all shooting environments. When the user takes a photo in a scene with poor generalization, the CCT2 and D uv2 And Conf_2 has very low accuracy. In order to effectively solve the above problems, electronic equipment needs to convert CCT2, D uv2 and Conf_2, and in CCT2, D uv2 When any item in Conf_2 deviates too much from its correction value, the electronic device can correct it so that CCT2, D uv2 And Conf_2 is within a reasonable value range.
[0130] The process of the electronic device correcting CCT2 is as follows: a CCT shift table (CCT ShiftTable) is stored in the electronic device. Fig. 6A As shown, CCT Shift Table is a three-dimensional coordinate table with three coordinate axes: CCT axis, D uv In the three-dimensional space of the CCT Shift Table, there are many cells, each of which corresponds to a CCT correction value. The electronic device adjusts the image based on the LV, CCT2 and D axis of the white point of the image light source. uv2Find the corresponding point in the CCT Shift Table three-dimensional coordinate system and determine the cells adjacent to this point. Then, calculate the weight of each adjacent cell by trilinear interpolation, and multiply the cell weight by its corresponding CCT correction value to obtain the product of each adjacent cell. Sum the products of each adjacent cell to obtain CCT3, which is the third correlated color temperature.
[0131] For example, Figure 6B As shown, if the electronic device is based on the LV, CCT2 and D uv2 Find point M in the three-dimensional coordinate system of CCTShift Table, where point M is the midpoint of line segment XY. X is the intersection of cells 1 to 4, and Y is the intersection of cells 5 to 8. Based on the coordinate position of point M in CCTShift Table, the electronic device determines that cells 1 to 8 are adjacent cells of point M. The electronic device performs trilinear interpolation on cells 1 to 8 to obtain weights f1 to f8 of cells 1 to 8, and then calculates CCT3 according to formula (3), which is as follows:
[0132] CCT3=CCT 11 *f1+…+CCT 13 *f3+CCT 14 *f4+CCT 21 *f5+…+CCT 24 *f8 (3)
[0133] Among them, CCT 11 ~CCT 14 、CCT 21 ~CCT 24 are the CCT correction values of cells 1 to 8, f1 to f8 are the weights of cells 1 to 8, and f1+…+f8=1.
[0134] Electronic equipment to D uv2 The correction process is as follows: D is stored in the electronic device. uv Conversion table (D uv Shift Table). Fig. 7A As shown, D uv Shift Table is a three-dimensional coordinate table with three coordinate axes: D uv axis, CCT axis and LV axis. uv In the three-dimensional space of Shift Table, there are many cells, each of which corresponds to a D uv The electronic device is based on the LV and D of the white point of the image light source.uv2 and CCT2 in D uv Find the corresponding point in the Shift Table 3D coordinate system and determine the cells adjacent to this point. Each adjacent cell corresponds to a D uv Then, the electronic device calculates the weight of each adjacent cell through trilinear interpolation and compares the weight of the cell with its corresponding D uv Multiply the correction values to get the product of each related cell, and sum the products of each related cell to get D uv3 , D uv3 is the third chromaticity distance.
[0135] For example, Figure 7B As shown, if the electronic device is based on the LV, CCT2 and D uv2 In D uv Find point M' in the Shift Table three-dimensional coordinate system, and point M' is the midpoint of line segment X'Y'. Among them, X' is the intersection of cells 1 to 4, and Y' is the intersection of cells 5 to 8. Based on the coordinate position of point M' in the CCT Shift Table, the electronic device determines that cells 1 to 8 are adjacent cells of point M', and performs trilinear interpolation on cells 1 to 8 to obtain weights f'1 to f'8 of cells 1 to 8, and then calculates the third chromaticity distance according to formula (4), which is as follows:
[0136] D uv3 =D uv11 *f′1+…+D uv13 *f′3+D uv14 *f′4+D uv21 *f′5+…+D uv24 *f′8 (4)
[0137] Among them, D uv11 ~D uv14 , D uv21 ~D uv21 D of cells 1 to 8 respectively uv Correction value, f′1~f′8 are the weights of cells 1 to 8 respectively, and f′1+…+f′8=1, D uv3 is the third chromaticity distance.
[0138] The electronic device corrects Conf_2 as follows: a confidence shift table is stored in the electronic device. Fig. 8AAs shown in the figure, the Confidence Shift Table is a three-dimensional coordinate table with three coordinate axes: CCT axis, D uv In the three-dimensional space of the Confidence Shift Table, there are many cells, each of which corresponds to a confidence adjustment value (Mult_Conf). The electronic device adjusts the confidence adjustment value based on the LV, D and LV axes of the image. uv2 And CCT2 finds the corresponding point in the three-dimensional coordinate system of Confidence Shift Table, and determines the cells adjacent to this point. Then, the electronic device calculates the weight of each adjacent cell through Trilinear interpolation, and multiplies the weight of the cell by its corresponding Mult_Conf to obtain the product of each adjacent cell, and sums the products of each adjacent cell to obtain Mult_Conf_new. Then, the electronic device calculates the third confidence level according to the formula Conf_3=Conf_2+Mult_Conf_new. Among them, Conf_3 is the third confidence level. It should be noted that Conf_3 may be greater than 1. When Conf_3 is greater than 1, the electronic device sets Conf_3 to 1, and when Conf_3 is less than 0, the electronic device sets Conf_3 to 0.
[0139] For example, Figure 8B As shown, if the electronic device is based on the LV, CCT2 and D uv2 Find point M″ in the ConfidenceShift Table three-dimensional coordinate system, where point M″ is the midpoint of line segment X″Y″. X″ is the intersection of cells 1 to 4, and Y″ is the intersection of cells 5 to 8. Based on the coordinate position of point M″ in the ConfidenceShift Table, the electronic device determines that cells 1 to 8 are adjacent cells of point M″. The electronic device calculates weights f″1 to weights f″8 of cells 1 to 8 according to Trilinear interpolation, and then calculates Mult_Conf_new according to formula (5). Formula (5) is as follows:
[0140] Mult_Conf_new=Mult_Conf 11 *f″1+…+Mult_Conf 14 *f″4+Mult_Conf 21 *f″5+…+Mult_Conf 24 *f″8 (5)
[0141] Among them, Mult_Conf 11 ~Mult_Conf14 、Mult_Conf 21 ~Mult_Conf 24 are the confidence adjustment values of cells 1 to 8 respectively, f″1~f″8 are the weights of cells 1 to 8 respectively, and f″1+…+f″8=1.
[0142] Finally, the electronic device obtains the third confidence level according to the formula Conf_3=Mult_Conf_new+Conf_2.
[0143] Step S309: The electronic device calculates a first filter vector based on the third correlated color temperature and the third chromaticity distance.
[0144] Specifically, electronic equipment has a certain degree of sensitivity to CCT2 and D uv2 After the correction of Conf_2, we get CCT3 and D uv3 The electronic device will convert CCT3 and D uv3 Converted into the first filter vector Mu1 for time series filtering.
[0145] Wherein, the Mu1 is [log(R4 / G4), log(B4 / G4)], and Mu1 includes the chromaticity information of the white point of the image light source (R4B4G4 value).
[0146] Exemplary electronic devices based on CCT3 and D uv3 , the process of obtaining Mu1 is as follows Fig. 9 As shown, the electronic device determines point D on the Planckian locus of the chromaticity diagram based on CCT3, and the chromaticity value of point D is (u′4, v′4). Then, the coordinates (u″4, v″4) of point E on the Planckian locus with a correlated color temperature of CCT3+ΔT are calculated. Wherein, ΔT is a small increment of CCT3 (for example, ΔT=0.001K). Then, the electronic device calculates the inclination angle θ, and obtains du, dv, sinθ and cosθ according to formulas (6) to (9), and formulas (6) to (9) are as follows:
[0147] du=u′4-u″4(6); dv=v′4-v″4(7);
[0148]
[0149] Then, the electronic device calculates the chromaticity value (u4, v4) according to formula (10) and formula (11), and formula (10) and formula (11) are as follows:
[0150] u3=u′4-D uv3 *sinθ(10);
[0151] v3=v4′+D uv3*cosθ(11);
[0152] Then, the electronic device calculates R4G4B4 according to formula (12), which is as follows:
[0153]
[0154] in, The conversion matrix is a conversion matrix. The embodiment of the present application only provides an exemplary description of the conversion matrix and does not impose any limitation on the specific content of the conversion matrix.
[0155] Finally, the electronic device calculates the first filter vector Mu1 based on the R4G4B4 value.
[0156] Step S310: The electronic device performs time-series filtering on the first filter vector to obtain a second filter vector.
[0157] Specifically, time series filtering is to fuse multiple frame signals in time series into multiple frame stationary signals. The purpose of time series filtering by electronic equipment is to fuse the chromaticity information of the frame image with the chromaticity information of the previous frame image to obtain the fused chromaticity information, so as to improve the accuracy of the third chromaticity information of the frame image.
[0158] The embodiment of the present application takes the example of an electronic device performing time series filtering on Mu1 through a Kalman filter as an example to illustrate the process of time series filtering: the electronic device first obtains the first covariance matrix Sigma1, wherein Sigma1 is used to characterize the reliability of the chromaticity information of the white point of the light source of the frame image output by the AIAWB model, and can be converted to and from the confidence level. Sigma1 can be output by the AI AWB model, or calculated by the electronic device based on Conf_3 to obtain Sigma1. Then, the electronic device updates Sigma1 according to formula (13) to obtain the updated Sigma1, and formula (13) is as follows:
[0159]
[0160] Wherein, Sigma′1 is the updated Sigma1, and λ1 is the first parameter.
[0161] Then, the electronic device updates the second covariance matrix Sigma2 based on formula (14), where Sigma2 is the covariance matrix obtained by calculating the chromaticity information of the white point of the light source of the previous frame image by the AI AWB model. Formula (14) is as follows:
[0162]
[0163] Sigma′2 is the updated Sigma2, and λ2 is the second parameter. λ1 and λ2 can be obtained from empirical values, historical data, or experimental test data, which is not limited in the present embodiment.
[0164] Finally, the electronic device performs time-series filtering on Mu1 according to formula (15) to obtain a second filtering vector Mu. Formula (15) is as follows:
[0165] Mu=Mu1*(Sigma′1) -1 +Mu2*(Sigma′2) -1 (15)
[0166] Among them, Mu2 is the filter vector of the previous frame image, and Mu is the second filter vector.
[0167] Step S311: the electronic device calculates a fourth correlated color temperature and a fourth chromaticity distance based on the second filter vector.
[0168] Specifically, after the electronic device calculates Mu, it can calculate the R5G5B5 value of the white point of the image light source according to Mu, and convert the R5G5B5 value into the fourth correlated color temperature CCT4 and the fourth chromaticity distance D uv4 The electronics convert the R5G5B5 value to CCT4 and D uv4 The process of converting the second chromaticity information into CCT1 and D uv1 The relevant description of CCT4 and D is not repeated in the present embodiment. uv4 The accuracy is comparable to that of CCT3 and D uv3 higher.
[0169] Step S312: the electronic device obtains a fifth correlated color temperature based on the first correlated color temperature and the fourth correlated color temperature.
[0170] Specifically, a correlated color temperature fusion table (CCT Merging Table) is stored in the electronic device. Fig.10 As shown, CCT Merging Table is a three-dimensional coordinate table with three coordinate axes: D uv In the three-dimensional space of the CCT Merging Table, there are many cells, each of which corresponds to a probability value X. The electronic device determines the probability value X based on the LV, CCT4 and D axis of the image. uv4Find the corresponding point in the three-dimensional coordinate system of the CCT Merging Table and determine the cells adjacent to this point. Then, the electronic device calculates the weight of each adjacent cell by trilinear interpolation, and multiplies the weight of the cell by its corresponding probability value X to obtain the product of each related cell, and sums the products of each related cell to obtain the first probability value X′. Finally, the electronic device calculates the fifth correlated color temperature CCT5 by formula (16). Formula (16) is as follows:
[0171] CCT5=Conf_3*X′*CCT4+(1-Conf_3*X′)*CCT1 (16)
[0172] Step S313: The electronic device obtains a fifth chromaticity distance based on the first chromaticity distance and the fourth chromaticity distance.
[0173] Specifically, a chromaticity distance fusion table (D uv Merging Table). Fig.11 As shown, D uv Merging Table is a three-dimensional coordinate table with three coordinate axes: D uv axis, CCT axis and LV axis. uv In the three-dimensional space of the Merging Table, there are many cells, each of which corresponds to a probability value Y. The electronic device calculates the probability value Y based on the LV, CCT4 and D uv4 In D uv Find the corresponding point in the Merging Table three-dimensional coordinate system and determine the cells adjacent to this point. Then, the electronic device calculates the weight of each adjacent cell by trilinear interpolation, and multiplies the weight of the cell by its corresponding probability value Y to obtain the product of each related cell, and sums the products of each related cell to obtain the second probability value Y′. Finally, the electronic device calculates the fifth chromaticity distance D by formula (17). uv5 , formula (17) is as follows:
[0174] D uv5 =Conf_3*Y′*D uv4 +(1-Conf_3*Y′)*D uv1 (17)
[0175] Step S314: the electronic device adjusts the fifth correlated color temperature to obtain a sixth correlated color temperature.
[0176] Specifically, some users have other requirements for the color of the image after taking photos with an electronic device. For example, some users want the color of the image to be warm overall, while some users want the color of the image to be cool overall, and so on. In order to make the overall color of the image more inclined to the color desired by the user, the electronic device needs to adjust the CCT5 and D uv5 The specific process of the electronic device adjusting the inclination of CCT5 is as follows: Fig.12 The CCT Propensity Table (correlated color temperature tendency adjustment table) shown in the figure is a three-dimensional coordinate table with three coordinate axes: CCT axis, D uv In the three-dimensional space of the CCT Propensity Table, there are many cells, each of which corresponds to a CCT adjustment value (Delta_CCT). The electronic device adjusts the CCT value based on the LV, CCT5 and D of the image. uv5 Find the corresponding point in the three-dimensional coordinate system of the CCT Propensity Table, and determine the cell adjacent to this point. Then calculate the weight of each adjacent cell by trilinear interpolation, and multiply the weight of the cell by its corresponding Delta_CCT to obtain the product of each related cell, and sum the products of each related cell to obtain the first correlated color temperature adjustment value Delta_CCT′. Then, the electronic device calculates the sixth correlated color temperature according to formula (18), and formula (18) is as follows:
[0177] CCT6=CCT5+Delta_CCT′ (18)
[0178] In formula (18), CCT6 is the sixth correlated color temperature.
[0179] Step S315: the electronic device performs a trend adjustment on the fifth chromaticity distance to obtain a sixth chromaticity distance.
[0180] Specifically, electronic devices are uv5 The specific process of adjusting the inclination is as follows: storing the following information in the electronic device: Fig.13 D uv Propensity Table (chromaticity distance tendency adjustment table), D uv Propensity Table is a three-dimensional coordinate table with three coordinate axes: CCT axis, D uv axis and LV axis. uv In the three-dimensional space of the Propensity Table, there are many cells, each corresponding to a Duv Adjustment value (Delta_D uv ). The electronic device is based on the LV, D uv5 and CCT5 in D uv Find the corresponding point in the three-dimensional coordinate system of the Propensity Table and determine the cells adjacent to this point. Then calculate the weight of each adjacent cell through trilinear interpolation and compare the cell weight with its corresponding Delta_D uv Multiply them to get the product of each related cell, and sum the products of each related cell to get the first chromaticity distance adjustment value Delta_D uv '. Then, the electronic device calculates the adjusted chromaticity distance according to formula (19), which is as follows:
[0181] D uv6 =D uv5 +Delta_D uv ′ (19)
[0182] In formula (19), D uv6 is the sixth chromaticity distance.
[0183] Step S316: The electronic device calculates a third filter vector based on the sixth correlated color temperature and the sixth chromaticity distance.
[0184] Specifically, the third filter vector is Mu3, and the electronic device is based on CCT6 and D uv6 For the method of calculating Mu3, please refer to the method of calculating Mu3 calculated by the electronic device based on CCT3 and D in step S309. uv3 The description related to the calculation of Mu1 will not be repeated in the present embodiment.
[0185] Step S317: the electronic device performs time-series filtering on the third filter vector to obtain a fourth filter vector.
[0186] Specifically, in order to prevent the color information of two adjacent frames from being too different, resulting in a sudden change in the color of the two adjacent frames, the electronic device performs time-series filtering on the filter vector of the current frame of the image and the filter vector of the previous frame of the image, thereby obtaining a fused filter vector (fourth filter vector), and the electronic device can obtain fourth color information based on the fourth filter vector. In this way, after the electronic device uses the fourth color information to adjust the white balance of the current frame of the image, the overall color of the adjusted image will not be significantly different from the overall color of the previous frame of the image, and the problem of sudden color changes between the two adjacent frames of the image will not occur. First, the electronic device updates the first covariance matrix of the image according to formula (20) to obtain a third covariance matrix, and formula (20) is as follows:
[0187]
[0188] Among them, Sigma3 is the third covariance matrix, Sigma1 is the first covariance matrix, and a1 is the third parameter.
[0189] Then, the electronic device updates the second covariance matrix according to formula (21) to obtain a fourth covariance matrix. Formula (21) is as follows:
[0190]
[0191] Among them, Sigma4 is the fourth covariance matrix, Sigma2 is the second covariance matrix, a1 is the third parameter, a1 can be obtained from historical values, empirical values, or experimental data, and the embodiment of the present application does not limit this.
[0192] Then, the electronic device performs time-series filtering on Mu3 according to formula (18) to obtain a fourth filtering vector Mu5. Formula (22) is as follows:
[0193] Mu5=Mu3**(Sigma3) -1 +Mu4*(Sigma4) -1 (twenty two)
[0194] Among them, Mu4 is the filter vector of the previous frame image, and Mu4 is the electronic device based on CCT2′ and D′ uv2 Calculated. Among them, CCT′2 is the correlated color temperature of the previous frame image after adjusting the CCT tendency, D′ uv2 For the previous frame image through D uv Chromaticity distance after desirability adjustment.
[0195] Step S318: The electronic device calculates fourth chrominance information based on the fourth filter vector.
[0196] Specifically, Mu5=[log(R6 / G6), log(B6 / G6)]. The fourth chromaticity information may be the R6G6B6 value of the image light source white point, or may be R6 / G6 and B6 / G6 of the image light source white point, which is not limited in the embodiment of the present application.
[0197] Step S319: The electronic device sends the fourth chromaticity information to the memory.
[0198] Specifically, the fourth chromaticity information is used to adjust the color of the image in a non-pure color scene.
[0199] In an embodiment of the present application, the electronic device selects the corresponding AWB algorithm to calculate the second chromaticity information based on the spectral data output by the multispectral sensor, thereby improving the accuracy of the first correlated color temperature and the first chromaticity distance calculated based on the second chromaticity information. The electronic device adjusts the confidence output by the AI AWB algorithm based on the CCT output by the multispectral sensor, thereby improving the accuracy of the confidence. Since the accuracy of the first correlated color temperature, the first chromaticity distance, and the confidence output by the AI AWB algorithm are all improved, when the electronic device fuses the first correlated color temperature with the fourth correlated color temperature calculated based on the AI AWB algorithm, the accuracy of the fifth correlated color temperature obtained is also improved. After the electronic device fuses the first chromaticity distance with the fourth chromaticity distance calculated based on the AI AWB algorithm, the accuracy of the fifth chromaticity distance obtained is also improved, so that the accuracy of the fourth chromaticity information based on the fifth correlated color temperature and the fifth chromaticity distance stored in the memory is also improved. Since the accuracy of the fourth chromaticity information is improved, the effect of the electronic device using the fourth chromaticity information to adjust the white balance of the image is better. In addition, since the multispectral sensor has been sending the first chromaticity value of the image calculated by it to the memory during the period from the cold start of the camera to the electronic device taking a photo, when the camera is in the process of cold start, since the camera output speed is fast, the electronic device can use the first chromaticity information to adjust the white balance of the first frame or the first few frames of preview image, thereby avoiding the color cast problem in the first frame or the first few frames of preview image. Alternatively, when the electronic device detects that the current shooting scene is a pure color scene (the number of white points of the image light source is insufficient), since the fourth chromaticity information calculated by the AWB algorithm and the AI AWB algorithm is not accurate, the electronic device can also call the first chromaticity information to adjust the white balance of the image.
[0200] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.
[0201] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0202] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for determining chromaticity information, characterized in that: Applied to an electronic device, the electronic device comprises a multispectral sensor, a first module and a second module, the first module comprises a plurality of algorithms, and the method comprises: The electronic device starts a camera application; The multispectral sensor acquires a first channel value, wherein the multispectral sensor includes a first channel, and the first channel value is a value acquired by the first channel; sending the first channel value to a first module; The electronic device determines target chromaticity information according to the target algorithm determined based on the first channel value.
2. The method according to claim 1, characterized in that The method further comprises: The multispectral sensor acquires a first correlated color temperature; sending the first correlated color temperature to a second module; The second module determines a difference between a first correlated color temperature and a second correlated color temperature, where the second correlated color temperature is a correlated color temperature value obtained by the second module based on the image captured by the camera; The electronic device determines target chromaticity information according to the target algorithm determined based on the first channel value, including: When the difference is greater than a preset threshold, the electronic device determines target chromaticity information according to the target algorithm, the first correlated color temperature, and the second correlated color temperature.
3. The method according to claim 1 or 2, characterized in that The starting the camera application includes cold starting the camera application, and the method further includes: When the camera application is cold started, the multispectral sensor acquires first chromaticity information; After the camera application is started, the electronic device performs white balance adjustment on the first frame image captured by the camera based on the first chromaticity information; The multispectral sensor acquiring a first channel value includes: after the camera application is started, the multispectral sensor acquiring a first channel value, the target chromaticity information is used to perform white balance adjustment on a first image captured by the camera, the first image being an image captured by the camera after the first frame image.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: After the camera application is started, when the first module or the second module determines that the image captured by the camera is a pure color image, the electronic device performs white balance adjustment on the pure color image based on second chromaticity information, where the second chromaticity information is chromaticity information acquired by the multispectral sensor.
5. The method according to any one of claims 1 to 4, characterized in that: The first channel value includes one or more of the following: a visible light channel value, a NIR channel value, and a Clear channel value.
6. The method according to any one of claims 2 to 5, characterized in that: The electronic device determines target chromaticity information according to the target algorithm, the first correlated color temperature and the second correlated color temperature, specifically including: The first module calculates the image captured by the camera through the target algorithm to obtain a third correlated color temperature and a first chromaticity distance; The second module obtains a fourth correlated color temperature and a second chromaticity distance based on the image captured by the camera; The electronic device combines the third correlated color temperature with the fourth correlated color temperature to obtain a fifth correlated color temperature; The electronic device merges the first chromaticity distance and the second chromaticity distance to obtain a third chromaticity distance; The electronic device obtains the target chromaticity information based on the fifth correlated color temperature and the third chromaticity distance.
7. The method according to claim 6, characterized in that The electronic device obtains the target chromaticity information based on the fifth correlated color temperature and the third chromaticity distance, specifically comprising: Adjusting the fifth correlated color temperature to obtain a sixth correlated color temperature; Adjusting the third chromaticity distance by a tendency to obtain a fourth chromaticity distance; The target chromaticity information is obtained based on the sixth correlated color temperature and the fourth chromaticity distance.
8. The method according to any one of claims 6 to 7, characterized in that: The second module obtains a fourth correlated color temperature and a second chromaticity distance based on the image captured by the camera, specifically including: The second module outputs the second correlated color temperature and the initial chromaticity distance according to the image captured by the camera; Correcting the second correlated color temperature and the initial chromaticity distance to obtain a corrected second correlated color temperature and a corrected initial chromaticity distance; Based on the corrected second correlated color temperature and the corrected initial chromaticity distance, temporal filtering is performed to obtain the fourth correlated color temperature and the second chromaticity distance.
9. The method according to claim 8, characterized in that The performing of temporal filtering based on the corrected second correlated color temperature and the corrected initial chromaticity distance to obtain the fourth correlated color temperature and the second chromaticity distance specifically includes: According to the formula Update the first covariance matrix to obtain an updated first covariance matrix; the Sigma′1 is the updated first covariance matrix, the Sigma1 is the first covariance matrix, the λ1 is the first parameter, the first covariance matrix is the covariance matrix output by the second module according to the image captured by the camera, or the first covariance matrix is the covariance matrix calculated based on the second confidence level; the second confidence level is obtained by correcting the first confidence level, and the first confidence level is used to characterize the reliability of the second module; According to the formula Update the second covariance matrix to obtain an updated second covariance matrix; the second covariance matrix is the covariance matrix of the second image, the second image is the previous frame image captured by the camera, the Sigma′2 is the updated second covariance matrix, the Sigma2 is the second covariance matrix, and the λ2 is the second parameter; Obtain a first filter vector based on the modified second correlated color temperature and the modified initial chromaticity distance calculation; According to the formula Mu = Mu1*(Sigma′1) -1 +Mu2*(Sigma′2) -1 , obtain a second filter vector; Mu1 is the first filter vector, Mu2 is the filter vector of the second image, and Mu is the second filter vector; Calculation is performed based on the second filter vector to obtain the fourth correlated color temperature and the second chromaticity distance.
10. The method according to any one of claims 6 to 9, characterized in that: The electronic device combines the third correlated color temperature with the fourth correlated color temperature to obtain a fifth correlated color temperature, specifically including: Determine a first probability value according to the brightness value of the image captured by the camera, the fourth correlated color temperature, and the second chromaticity distance; The fifth correlated color temperature is calculated according to the formula CCT5=Conf_2*X′*CCT1+(1-Conf_2*X′)*CCT3; wherein Conf_2 is the second confidence, X′ is the first probability value, CCT4 is the fourth correlated color temperature, CCT3 is the third correlated color temperature, and CCT5 is the fifth correlated color temperature; the second confidence is obtained by correcting the first confidence, and the first confidence is used to characterize the reliability of the second module.
11. The method according to any one of claims 6 to 10, characterized in that: The electronic device combines the first chromaticity distance with the second chromaticity distance to obtain a third chromaticity distance, specifically including: Determine a second probability value according to the brightness value of the image captured by the camera, the fourth correlated color temperature, and the second chromaticity distance; According to formula D uv3 =Conf_2*Y′*D uv2 +(1-Conf_2*Y′)*D uv1 , the third chromaticity distance is calculated; wherein, Conf_2 is the second confidence, and Y ′ is the second probability value, the D uv1 is the first chromaticity distance, the D uv2 is the second chromaticity distance, the D uv3 is the third chromaticity distance; the second confidence level is obtained by correcting the first confidence level, and the first confidence level is used to characterize the reliability of the second module.
12. The method according to any one of claims 7 to 11, characterized in that: The step of adjusting the fifth correlated color temperature to obtain a sixth correlated color temperature specifically includes: Determine a first correlated color temperature adjustment value according to the brightness value of the image captured by the camera, the fifth correlated color temperature, and the third chromaticity distance; According to the formula CCT6=CCT5+Delta_CCT′, the sixth correlated color temperature is obtained, wherein CCT5 is the fifth correlated color temperature, CCT6 is the sixth correlated color temperature, and Delta_CCT′ is the first correlated color temperature adjustment value.
13. The method according to any one of claims 7 to 12, characterized in that: The step of adjusting the third chromaticity distance by a tendency to obtain a fourth chromaticity distance specifically includes: Determine a first chromaticity distance adjustment value according to the brightness value of the image captured by the camera, the fifth correlated color temperature, and the third chromaticity distance; According to formula D uv4 =D uv3 +Delta_D uv ', get the fourth chromaticity distance, the D uv4 is the fourth chromaticity distance, the D uv3 is the third chromaticity distance, the Delta_D uv ' is the first chromaticity distance adjustment value.
14. An electronic device, characterized in that: include: A touch screen, a camera, one or more processors, and one or more memories; The one or more processors are coupled to the touch screen, the camera, and the one or more memories, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the method described in any one of claims 1-13.
15. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 13.
16. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-13.
17. A computer program product comprising instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 13.
