Color temperature determination method and device, equipment and medium
By using multi-channel photosensitive arrays and mapping matrix technology, the accuracy problem of existing color temperature estimation technology in mixed light source scenarios has been solved, achieving higher precision and stable color temperature output.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-31
AI Technical Summary
Existing color temperature estimation technologies have low accuracy in mobile terminals, cameras, wearable devices and smart lighting, making it difficult to distinguish light sources with similar RGB responses but different actual spectra, especially in mixed light source scenarios where they cannot accurately reflect real visual perception.
A multi-channel photosensitive array is used for data preprocessing. The data is mapped to a color space using a pre-calibrated mapping matrix. Chromaticity coordinates are calculated and light source type is identified. Color temperature is evaluated by combining chromaticity difference and confidence level. The target color temperature is output through an exponentially weighted moving average operation.
It improves the accuracy and reliability of color temperature estimation, reduces short-term fluctuations caused by changes in ambient light and sensor noise, and ensures the stability and accuracy of color temperature output.
Smart Images

Figure CN121762041A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of optical measurement technology, and in particular to a method, apparatus, device and medium for determining color temperature. Background Technology
[0002] Color temperature (CCT) estimation technology is widely used in mobile terminals, cameras, wearable devices and smart lighting. Currently, the main measurement methods are image statistical methods based on RGB three channels and direct measurement methods based on three-color photoelectric sensors.
[0003] Among them, the RGB three-channel image statistical method uses image pixel information and algorithms such as grayscale world and white point detection, or automatic white balance (AWB) algorithm based on grayscale assumption and learning, to estimate the white point and color temperature of the scene from the RGB signal output by the camera; the direct measurement method based on three-color photoelectric sensors configures one or a few three-channel light sensors (covering R / G / B channels) at the front end of the device to measure ambient light and map the measurement results into color temperature values.
[0004] However, among the aforementioned related color temperature measurement techniques, RGB and three-channel light sensors provide coarse spectral sampling, making it difficult to distinguish light sources with similar RGB responses but different actual spectra (such as some LEDs and fluorescent lamps), leading to errors and color bias in color temperature estimation. Furthermore, in mixed light source scenarios (such as indoor-outdoor mixed lighting or multiple light sources coexisting), the RGB method struggles to effectively separate the contributions of each light source, resulting in the overall color temperature failing to accurately reflect real visual perception. Consequently, the aforementioned related color temperature estimation techniques suffer from low accuracy in color temperature calculation in relevant fields, making it difficult to meet the application needs of various sectors. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for determining color temperature, aiming to solve the technical problem of low accuracy in color temperature calculation in related fields.
[0006] In a first aspect, this application provides a method for determining color temperature, including: Data preprocessing is performed on the N-channel raw digital-to-analog converter (ADC) data acquired through a multi-channel photosensitive sensor array to obtain preprocessed data of the current optical signal; The preprocessed data is mapped to a color space using a pre-calibrated mapping matrix, and the color space value and chromaticity coordinates corresponding to the current light signal are calculated. Based on the color space values, determine the light source type of the current light signal; Based on the chromaticity coordinates, the estimated color temperature of the current light signal is determined using the color temperature estimation method corresponding to the light source type of the current light signal; Calculate the chromaticity difference and confidence level of the estimated color temperature; When the chromaticity difference and confidence level of the estimated color temperature meet the preset conditions, an exponentially weighted moving average operation is performed on the estimated color temperature to output the target color temperature of the current light signal.
[0007] Secondly, this application also provides a color temperature determining device, comprising: The data preprocessing module is used to preprocess the N-channel raw digital-to-analog converter (ADC) data acquired through the multi-channel photosensitive array to obtain the preprocessed data of the current optical signal. The spatial mapping module is used to map the preprocessed data to a color space using a pre-calibrated mapping matrix, and to calculate the color space value and chromaticity coordinates corresponding to the current light signal. A light source type determination module is used to determine the light source type of the current light signal based on the color space values; The color temperature estimation module is used to determine the estimated color temperature of the current light signal based on the chromaticity coordinates and using the color temperature estimation method corresponding to the light source type of the current light signal. The color difference and confidence level calculation module is used to calculate the color difference and confidence level of the estimated color temperature; The target color temperature output module is used to perform an exponentially weighted moving average operation on the estimated color temperature when the chromaticity difference and confidence level of the estimated color temperature meet preset conditions, and output the target color temperature of the current light signal.
[0008] Thirdly, this application also provides a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the steps of the color temperature determination method as described above.
[0009] Fourthly, this application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the color temperature determination method as described above.
[0010] This application provides a method, apparatus, device, and storage medium for determining color temperature. The method preprocesses N-channel raw ADC data acquired by a multi-channel photosensitive array to effectively remove noise and correct channel differences, providing high-quality input data for subsequent color space mapping. A pre-calibrated mapping matrix is used to map the preprocessed data to a color space, thereby accurately calculating color space values and chromaticity coordinates, achieving accurate conversion between photosensitive data and standard color representation. The light source type is determined based on the color space values, providing a basis for color temperature estimation. A color temperature estimation method matching the light source type is adopted to further improve the accuracy of the estimation. The chromaticity difference and confidence level of the estimated color temperature are calculated to provide a reliability assessment of the color temperature estimation results, ensuring the stability of the color temperature output. An exponentially weighted moving average operation is applied when preset conditions are met to further smooth the color temperature output, reducing short-term fluctuations caused by ambient light changes or sensor noise, thereby significantly improving the accuracy and reliability of the color temperature output results. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating a first embodiment of a color temperature determination method provided in this application. Figure 2 This application provides a schematic diagram of a 12-channel detection narrowband wavelength response. Figure 3 This is a flowchart illustrating a second embodiment of a color temperature determination method provided in this application. Figure 4 This is a schematic diagram of the structure of a first embodiment of a color temperature determination device provided in this application; Figure 5 This is a schematic block diagram of the structure of a computer device provided in an embodiment of this application.
[0013] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0015] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0016] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0017] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a first embodiment of a color temperature determination method provided in this application.
[0018] like Figure 1 As shown, the color temperature determination method includes steps S101 to S106.
[0019] S101. Perform data preprocessing on the N-channel raw digital-to-analog converter (ADC) data acquired through the multi-channel photosensitive array to obtain the preprocessed data of the current optical signal; A multi-channel photosensitive array consists of multiple photosensors, each sensitive to light within a specific wavelength range, thus enabling multi-channel sampling of optical signals. The multi-channel photosensitive array can include photosensors targeting different narrowband wavelengths, allowing the photosensors to acquire richer and more detailed spectral information. This helps distinguish the spectral characteristics of different light sources and improves the accuracy of color temperature estimation and light source analysis.
[0020] For example, in Figure 2 The diagram illustrates a 12-channel narrowband wavelength response detection scheme. The horizontal axis represents wavelength, measured in nanometers (nm), ranging from 300nm to 900nm, covering the visible and near-infrared light wavelength range. The vertical axis represents relative sensitivity, a dimensionless quantity representing the relative response intensity of the photosensor to light at different wavelengths. The curves in the diagram illustrate the sensitivity variations of multiple photosensors in a multi-channel photosensor array at different wavelengths. Typically, these curves represent the sensitivity characteristics of each channel in a multi-channel photosensor array.
[0021] like Figure 2 As shown, this 12-channel photosensitive array includes multispectral photosensitive sensors. The center wavelengths of each photosensitive sensor are, for example, [410, 440, 450, 470, 500, 550, 570, 620, 650, 690, 770, 850] nm. Each channel has a bandwidth of approximately 20-40 nm (FWHM (Full Width at Half Maximum Height) can be designed). This multispectral photosensitive sensor has 12 independent channels, each corresponding to a specific center wavelength, enabling simultaneous detection of optical signals across 12 different wavelength ranges. The center wavelength refers to the center position of the spectral range detected by each channel; the bandwidth refers to the width of the wavelength range that each channel can detect.
[0022] Multi-channel separation can be achieved by adding narrowband color filters or thin-film interference filters to the optical sensor. Specifically, in a multispectral optical sensor, a narrowband color filter is placed in front of each channel. When light shines on the optical sensor, the narrowband color filter allows light within its transmission wavelength range to pass through and reach the corresponding photosensitive element, while blocking light of other wavelengths, thereby achieving the separation and detection of optical signals of different wavelengths. Similar to narrowband color filters, thin-film interference filters are installed in front of each channel of the optical sensor. They can precisely select and allow light near the center wavelength of the corresponding channel to pass through, while suppressing the passage of light of other wavelengths, thus achieving effective separation and detection of optical signals of different wavelengths.
[0023] During the data acquisition phase, the multi-channel photosensor array converts the ambient light signal into an electrical signal. After analog-to-digital conversion (ADC), N-channel raw ADC data is obtained. This N-channel raw ADC data is represented in vector form, i.e., .in, This represents a vector used to represent raw analog-to-digital conversion (ADC) data or preprocessed data acquired from a multi-channel photosensitive array; Represents the set of real numbers, and represents a vector. Each element in the vector is a real number; N represents the dimension of the vector, corresponding to the number of channels of the optical sensor, i.e., the vector... It contains N elements, each corresponding to a sample value from one channel. The value of N depends on the specific design and application requirements of the multi-channel optical sensor array. In practical applications, the number of channels in a multi-channel optical sensor array can range from a few to dozens (N≥2) to capture more detailed spectral information.
[0024] Data preprocessing is performed on the N-channel raw ADC data to obtain preprocessed data of the current optical signal. Data preprocessing may include operations such as dark current / bias removal, channel gain correction, SNR (signal-to-noise ratio) estimation and channel masking, and brightness normalization.
[0025] Specifically, dark current is the current generated in a photosensitive sensor due to the thermal excitation of the semiconductor material under no-light conditions. The magnitude of the dark current varies with different temperatures, thus affecting the output signal of the photosensitive sensor. A solution is to use pre-stored dark frames for subtraction, that is, to use dark frame data acquired under no-light conditions. d Compared with the original ADC data s Subtraction, the formula is expressed as:
[0026] in, s This represents the raw ADC (analog-to-digital converter) data vector acquired from the multi-channel photosensitive sensor array. d This represents the dark current or bias vector. This represents the data vector after dark current / bias removal.
[0027] By using the original data vector Subtract dark current / bias vector d This can eliminate the effects of dark current and bias on the light sensor under no-light conditions, allowing subsequent data processing to more accurately reflect actual lighting conditions. Generally, the magnitude of the dark current changes when the temperature varies significantly. In this case, a temperature-dependent dark current model is used. d ( T This allows for more accurate correction of the effects of dark current. By monitoring the ambient temperature and adjusting the dark current model accordingly, the accuracy of dark current removal can be improved, especially in environments with significant temperature variations.
[0028] Specifically, a temperature-dependent dark current model is established, describing how the dark current changes with temperature. This is typically obtained by experimentally measuring dark current data at different temperatures. The model may employ linear or nonlinear equations to parameterize the relationship between dark current and temperature. For example, a simple linear model might be... d ( T )= aT+b ,in a and b These are model parameters. T This refers to the ambient temperature collected by a temperature sensor. During operation of devices such as mobile terminals, cameras, and wearable devices, the built-in temperature sensor monitors the ambient temperature in real time and dynamically adjusts the dark current model based on the temperature value; that is, it calculates the adjusted dark current value based on the current temperature and the dark current model. d (T Then, the adjusted dark current value is subtracted from the collected raw data. d ( T ), thus obtaining the preprocessed data.
[0029] Minor variations in the manufacturing process of optical sensors or differences in the characteristics of optical filters can lead to differences in the photosensitivity of different channels, resulting in differences in channel gain. Gain vectors obtained at the factory or through self-calibration can be used to address these differences. g Data after removing dark current Element-by-element division is performed to eliminate differences in response between channels. The formula can be expressed as:
[0030] in, This represents the data vector after dark current / bias removal. g Represents the gain vector. This represents the data vector after channel gain correction. This represents the element-wise division operator. The data vector after removing dark current / bias. with gain vector g Performing element-wise division (i.e., dividing the data of each channel by the corresponding gain value) can eliminate the response differences between channels, making the output of each channel tend to be consistent under the same light intensity.
[0031] The signal-to-noise ratio (SNR) reflects the ratio of signal strength to noise strength. Low SNR channels may contain more noise, affecting the accuracy of subsequent processing. The SNR or noise threshold for each channel can be calculated. Channels with SNR below a set threshold can be downweighted or masked during fitting to reduce noise interference with the final result.
[0032] By normalizing brightness, the impact of brightness variations on chromaticity calculations can be eliminated, allowing the data to focus more on color characteristics rather than absolute brightness differences. Specifically, brightness estimation can be normalized. Y As a normalization basis, it is directly output in subsequent mapping processes. Y Preserve brightness information.
[0033] Alternatively, the L2 normalization method can be used for brightness normalization, and the formula can be expressed as:
[0034] in, This represents the data vector after channel gain correction. Represents the data vector after channel gain correction. The L2 norm (Euclidean length) is the square root of the sum of the squares of each channel. This represents the data vector after brightness normalization. It is the data vector after channel gain correction. Divide by its L2 norm This makes the normalized vector length 1, eliminating the influence of brightness changes on chromaticity calculation and making the data focus more on color characteristics rather than absolute brightness differences.
[0035] Compared to the traditional RGB method, multispectral sampling can more accurately map to the spectral distribution, reducing misjudgments of similar RGB outputs with different spectra and improving the accuracy of color temperature estimation (in typical experiments, the average error can be significantly reduced, especially under specific LED or fluorescent light sources). Data preprocessing of the raw ADC data acquired by the multi-channel photosensor array effectively removes interference factors such as dark current, bias, and inter-channel gain differences, ensuring data quality and consistency and providing a reliable data foundation for subsequent color temperature estimation and light source analysis.
[0036] S102. Using a pre-calibrated mapping matrix, the preprocessed data is mapped to a color space, and the color space value and chromaticity coordinates corresponding to the current light signal are calculated. The mapping matrix can be used to convert the electrical signals acquired by a multi-channel photosensitive array into standard color space values (such as the CIEXYZ color space). The mapping matrix can be calibrated using a standard light source.
[0037] Specifically, a set of known reference light sources is selected as standard light sources. The spectral characteristics (i.e., true XYZ values) of these standard light sources have been measured using a precision spectrophotometer. The three-dimensional vector of the reference color of any light source in the CIEXYZ color space, as measured by the precision spectrophotometer, is denoted as... Data from a standard light source is acquired using a multi-channel photosensor array to obtain the corresponding photosensor response vector. ,in, k Indicates the first k One reference light source.
[0038] The training response matrix is composed of the light sensor response vectors of all reference light sources. S The size is N × K ( N For the number of channels, K (Number of reference light sources), training response matrix S Each row corresponds to a channel, and each column corresponds to a reference light source. Training response matrix S Each column Indicates the first k The response values of a reference light source on all channels, element Then it means the first n The first channel is for the first kThe response value of a reference light source.
[0039] The first k The real reference light source corresponds to each reference light source XYZ Values form the target matrix The size is 3× K .
[0040] A mapping matrix is found through least squares fitting. M , making as close as possible The mathematical expression is:
[0041] in, The norm of a vector is used to measure the magnitude of the fitting error. M This represents the mapping matrix. This represents the response vector of the optical sensor. Indicates all possible M Find the value that minimizes the objective function. M . Indicates the first k The optical sensor response vector of a reference light source Through the mapping matrix M The result after linear transformation. Indicates the first k The true color space values corresponding to each reference light source ( The target matrix is composed of (values).
[0042] In one embodiment, when training the response matrix S transpose When the mapping matrix is not invertible or nearly singular, solve directly. M This will lead to numerical instability issues. In this case, the Moore-Penrose pseudoinverse can be used. An optimal least-squares solution can be obtained, such that the mapping matrix... M It can fit the known reference data to the greatest extent possible. At this point, the mapping matrix... M The calculation formula is:
[0043] in, The Moore-Penrose pseudoinverse is represented by the training response matrix. S A generalized inverse matrix. M This represents the mapping matrix. Indicates the first k The true color space values corresponding to each reference light source ( The target matrix is composed of (values).
[0044] In the mapping matrix M The calculation formula needs to be checked. Is it invertible? If not, other methods (such as singular value decomposition) are needed to calculate the Moore-Penrose pseudoinverse. .when When reversible, pseudo-reversible The calculation formula is:
[0045] in, Represents the training response matrix S The transpose of . Represents the training response matrix S Rather than transpose The product of. Representation matrix The inverse matrix.
[0046] Through a pre-calibrated mapping matrix M The preprocessed data is mapped to a color space, and the color space value corresponding to the current light signal is calculated. Specifically, a mapping matrix is used. M The preprocessed data vector is mapped to the color space through matrix multiplication to obtain the color space values. XYZ The calculation formula is:
[0047] in, This represents the data vector after brightness normalization. M This represents the mapping matrix. XYZ This represents the color space value of the current light signal.
[0048] Chromaticity coordinates are parameters in a color space used to describe the purity and hue of a color, and are independent of luminance information. Common chromaticity coordinates include the CIE 1931 xy chromaticity coordinates and the CIE 1960 UCS chromaticity coordinates.
[0049] Taking the CIE XYZ color space as an example, the method for calculating the CIE1931 xy chromaticity coordinates is as follows:
[0050] in, X , Y , Z It is a color space value. These are chromaticity coordinates.
[0051] The calculation method for CIE1960UCS chromaticity coordinates is as follows:
[0052] in, X , Y , Z It is a color space value. These are chromaticity coordinates.
[0053] Understandably, different color spaces are suitable for different application scenarios and computational needs. In addition to the CIE XYZ color space, other color spaces can also be selected, such as the CIE LAB color space.
[0054] This embodiment calibrates the mapping matrix using a standard light source and combines mathematical tools such as least-squares fitting and Moore-Penrose pseudo-inverse to effectively solve the accuracy and stability issues in data conversion, especially when dealing with complex cases such as non-invertible matrices. This enables data acquired by a multi-channel photosensitive array to be accurately mapped to a standard color space and its luminance coordinates to be calculated. This not only improves the accuracy of color temperature estimation and light source analysis but also enhances the reliability and adaptability of the data preprocessing process, allowing it to better meet the color measurement and control needs of different application scenarios.
[0055] S103. Based on the color space values, determine the light source type of the current light signal; In one embodiment, after converting the preprocessed data into color space values using a mapping matrix, the vector difference between these color space values and the ideal color space values is calculated to quantify the difference between the actual measured values and the model predicted values, thus obtaining the mapping residual. The ideal color space value is based on the light sensor response vector of the aforementioned reference light source. Through the mapping matrix M The mapping calculation is the same as the calculation process for color space values.
[0056] Further, the vector difference between the color space value and the ideal color space value is calculated to obtain the mapping residual; if the mapping residual is less than a preset residual threshold, the light source type of the current light signal is determined to be a single light source; if the mapping residual is greater than or equal to the residual threshold, the light source type of the current light signal is determined to be a mixed light source.
[0057] In one embodiment, the formula for calculating the mapping residual can be expressed as:
[0058] in, r Represents the mapping residual. This represents the data vector after brightness normalization. M Represents the mapping matrix, XYZ This represents the color space value of the current light signal. This represents the ideal color space value calculated based on the light sensor response vector and the mapping matrix.
[0059] Generally, a residual threshold can be set based on the application scenario and requirements. This residual threshold is used to distinguish between single and mixed light sources and can be determined through experimental data and practical experience to ensure accurate identification of light source types under different lighting conditions. In practical applications, the residual threshold can be dynamically adjusted according to ambient light conditions and application scenarios. For example, in environments with significant changes in lighting conditions, the threshold can be appropriately relaxed to avoid frequently triggering mixed light detection; while in applications requiring high color temperature accuracy, the threshold can be tightened to improve the accuracy of the detection.
[0060] If the mapping residual is less than the set residual threshold, it indicates that the actual measured color space value is close to the ideal value predicted by the mapping model, meaning that the spectral characteristics of the light source match the characteristics of a single light source in the mapping model. At this point, it can be determined that the current light signal comes from a single light source.
[0061] If the mapping residual is greater than or equal to the set residual threshold, it indicates a significant difference between the actual measured color space value and the ideal value predicted by the mapping model. This suggests that the spectral characteristics of the light source are complex, possibly composed of a mixture of multiple light sources, or that the light source type does not match the light source type in the mapping model. In this case, it can be determined that the current light signal may originate from a mixed light source or a light source that does not match the model.
[0062] For mixed light sources, spectral decomposition can be performed to separate the different light source components, and further analysis can be conducted based on the color temperature of each component. For a single light source, the color temperature of that light source can be used directly, thereby improving processing efficiency.
[0063] This embodiment calculates the mapping residual and identifies the light source type of the current light signal based on the residual. This effectively distinguishes between single light sources and mixed light sources, providing an accurate basis for subsequent color temperature calculation and processing, thereby improving the accuracy and reliability of color temperature estimation.
[0064] S104. Based on the chromaticity coordinates, determine the estimated color temperature of the current light signal using the color temperature estimation method corresponding to the light source type of the current light signal; You can choose the appropriate color temperature estimation method based on the actual application requirements. For example, fast estimation methods are suitable for scenarios with high real-time requirements, such as white balance adjustment in video shooting; high-precision estimation methods are suitable for scenarios with high color temperature accuracy requirements, such as professional photography and display device calibration.
[0065] In one embodiment, when the light source type is a single light source, the color temperature estimation method is determined based on the current color temperature calculation requirements; and the estimated color temperature of the current light signal is determined using the color temperature estimation method according to the chromaticity coordinates.
[0066] For a single light source, a suitable color temperature estimation method should be selected based on the current color temperature calculation requirements, including application scenario needs and accuracy requirements. Color temperature estimation methods can include the McCamy approximation formula and the Robertson interpolation method. When the current color temperature calculation requires rapid estimation, the McCamy approximation formula can be chosen; while when the current color temperature calculation requires high-precision estimation, the Robertson interpolation method can be used to obtain the estimated color temperature through table lookup or interpolation calculation.
[0067] The selected color temperature estimation method is directly used, based on the selected color temperature estimation method and the chromaticity coordinates of the current light signal. The estimated color temperature of the current light signal can be calculated, and the estimated color temperature corresponding to the current light signal of a single light source can be recorded as the first color temperature.
[0068] For example, the fast color temperature estimation method is suitable for scenarios with high real-time requirements. It quickly calculates an approximate color temperature value using color space values or chromaticity coordinates, such as the McCamy approximation formula. This method is suitable for rapid estimation in the range of 2850K to 6500K, with the specific error depending on the situation. Its mathematical expression is:
[0069] in, These are chromaticity coordinates; The first color temperature is the estimated color temperature corresponding to the current light signal of a single light source.
[0070] For higher accuracy, Robertson interpolation or Planckianlocus-based interpolation methods can be used (executed on a more powerful computing platform or in the cloud).
[0071] S105. Calculate the chromaticity difference and confidence level of the estimated color temperature; Color difference ( Chromaticity difference is used to measure the deviation of the current light source color from the Planckian locus, thereby assessing the accuracy of color temperature estimation and the color cast of the light source. Chromaticity difference calculations can be performed in different color spaces such as CIE 1960 and CIE 1976, and can be output with or without a sign, depending on requirements. Signed chromaticity differences can indicate the direction of color deviation (warmer or cooler), providing more valuable information for light source adjustment.
[0072] By searching a pre-stored blackbody radiation trajectory table or by interpolation, the point on the blackbody radiation trajectory closest to the chromaticity coordinates calculated in the previous example can be found. The vertical distance between the current chromaticity coordinates and the nearest point can then be calculated, and this vertical distance is the chromaticity difference.
[0073] The planckian locus is a curve in the CIE 1960 UCS chromaticity diagram, representing the chromaticity coordinates of blackbody radiation at different color temperatures. This locus describes the color characteristics of light radiated by an ideal blackbody at different temperatures.
[0074] Confidence level is used to evaluate the reliability of color temperature estimation results, taking into account the impact of various factors on estimation accuracy, such as mapping residuals and signal-to-noise ratio.
[0075] Further, the coordinates of the trajectory closest to the chromaticity coordinates are found on the blackbody radiation trajectory in the chromaticity space; the perpendicular distance between the chromaticity coordinates and the trajectory coordinates is calculated to obtain the chromaticity difference; and the confidence level is calculated based on the mapping residual and the signal-to-noise ratio of each channel in the multi-channel photosensitive array.
[0076] After calculating the chromaticity coordinates, a search algorithm (such as binary search or linear interpolation) is used to find the trajectory coordinates closest to the current chromaticity coordinates in the pre-stored blackbody radiation trajectory table. Calculate the distance between the current chromaticity coordinates and the nearest point, and determine the direction.
[0077] Specifically, the formula for converting CIE XYZ color space values to the CIE 1960 UCS coordinate system is as follows:
[0078] in, X , Y , Z It is a color space value. These are chromaticity coordinates.
[0079] Calculate the perpendicular distance between the current chromaticity coordinates and the coordinates of the nearest trajectory, i.e., the chromaticity difference ( The formula is as follows:
[0080] in, It's a color difference. It is the blackbody radiation trajectory and its chromaticity coordinates The coordinates of the nearest point. It is the unit vector of the orthogonal direction of the blackbody radiation trajectory at the current point, used to determine the direction of chromaticity deviation.
[0081] Color difference The absolute value indicates the degree of color deviation; a positive value indicates a warmer tone (deviation towards red), and a negative value indicates a cooler tone (deviation towards blue).
[0082] The calculation of confidence level needs to consider several factors that affect the accuracy of color temperature estimation, such as mapping residuals and signal-to-noise ratio (SNR). Among them, mapping residuals reflect the difference between actual measured values and model predictions; signal-to-noise ratio (SNR) is used to evaluate the quality of the input optical signal, and the higher the SNR, the more reliable the input optical signal.
[0083] The signal-to-noise ratio (SNR) of each channel can be calculated using the following formula:
[0084] in, It's the signal-to-noise ratio. It's the signal strength. It refers to noise intensity.
[0085] The confidence level is calculated by combining the effects of the mapping residual and the signal-to-noise ratio using a weighted formula. C The calculation formula is:
[0086] in, , These are weighting coefficients, corresponding to the impact of mapping residuals and signal-to-noise ratio, respectively. Represents the mapping residual. This indicates the signal-to-noise ratio.
[0087] The confidence score is normalized to the range [0,1] to determine whether to adopt the estimated result (first color temperature) or trigger a conservative strategy. The closer the confidence score is to 1, the more reliable the estimated result (first color temperature); the closer the value is to 0, the greater the uncertainty of the result, i.e., the lower the accuracy of the first color temperature. For example, in automatic white balance on a camera, a high confidence score and a low confidence score are more reliable. The results can be directly used for white balance correction, low confidence or high confidence. This may trigger hybrid light source processing or conservative mode.
[0088] By calculating the chromaticity difference ( By combining the confidence level and the confidence level, a detailed quality assessment of the color temperature estimation results can be obtained. It provides information on the direction and degree of color deviation, while the confidence level reflects the reliability of the estimation results.
[0089] S106. When the chromaticity difference and confidence level of the estimated color temperature meet the preset conditions, perform an exponentially weighted moving average operation on the estimated color temperature and output the target color temperature of the current light signal.
[0090] Preset conditions can include threshold ranges for chromaticity difference and confidence level. For example, setting the chromaticity difference ( The threshold is 0.02, and the confidence threshold is 0.7. These threshold ranges can be adjusted according to specific application scenarios and needs.
[0091] After each calculation of the color difference and confidence level, the following judgment is made: if the color difference ( If the color temperature difference is less than or equal to the chromaticity difference threshold and the confidence level is greater than or equal to the confidence level threshold, then the current color temperature estimation result (first color temperature) is considered relatively reliable and an exponentially weighted moving average (EWMA) operation can be performed; if the chromaticity difference ( If the color temperature difference is greater than the color difference threshold and / or the confidence level is less than the confidence threshold, then the current color temperature estimation result is considered to have a large error or uncertainty. In this case, the exponential weighted moving average operation will not be performed for the time being, and the current first color temperature will be directly output or other processing measures will be taken.
[0092] Among them, the Exponentially Weighted Moving Average (EWMA) operation is used to smooth color temperature fluctuations in the time domain, reduce the impact of short-term fluctuations on the results, and improve the stability and reliability of the output color temperature.
[0093] When the chromaticity difference and confidence level of the first color temperature meet the preset conditions, the output first color temperature ( CCT An exponentially weighted moving average (EWMA) is applied to smooth out fluctuations in the time domain, resulting in a more stable output. The formula for the exponentially weighted moving average (EWMA) can be expressed as:
[0094] in, Indicates the target color temperature to be output at the current moment; This represents the weighting coefficient, which typically takes a value between 0 and 1; This indicates the newly calculated first color temperature at the current moment; This indicates the target color temperature output at the previous moment.
[0095] After performing an exponentially weighted moving average operation, the target color temperature of the current light signal is output. This target color temperature combines current and historical data, resulting in better stability and reliability.
[0096] In one embodiment, the target color temperature is output ( At the same time, output color difference ( ), confidence level ( CInformation such as color temperature (Y) and brightness (Y) is obtained to gain a more comprehensive understanding of the characteristics of the light source. Depending on the specific application scenario, the obtained target color temperature and other information are processed accordingly, such as adjusting the light color temperature in smart lighting devices or adjusting the white balance in a camera to optimize image color reproduction.
[0097] In one specific embodiment, a 12-channel photosensor is built into the smart glasses, equipped with a 12-bit ADC and a sampling frequency of 50Hz. The smart glasses can perform color temperature calculations via a configured MCU (MicroControl Unit). The smart glasses can also communicate with a computer device to enable data transmission. The smart glasses can transmit the acquired N-channel raw digital-to-analog converter (ADC) data to the computer device, where data preprocessing, analysis, and color temperature estimation are performed. The computer device then transmits the color temperature calculation results back to the smart glasses for color temperature adjustment. Specifically, seven reference light sources are used for calibration to obtain a mapping matrix M and a corresponding matrix R. The color temperature range of these reference light sources covers 2300K to 7500K. After acquiring the N-channel ADC data, the smart glasses can perform data preprocessing, color space mapping, and color temperature estimation in real time via the MCU configured in the smart glasses or computer device. A McCamy formula is used for rapid color temperature estimation. If the chromaticity difference exceeds a set chromaticity difference threshold (e.g., chromaticity difference > 0.02), high-precision spectral decomposition is initiated. This spectral decomposition is performed on the main control unit configured in the smart glasses or computer device, or on the ISP (Internet Service Provider), to obtain a more accurate dominant CCT. The EWMA method is used for color temperature smoothing. A confidence threshold is set to 0.6. When the confidence level is below the threshold, the AWB (Auto White Balance) system will adopt a conservative white balance strategy or delay switching to avoid sudden color changes in the image caused by inaccurate color temperature estimation.
[0098] This embodiment provides a color temperature determination method. This method preprocesses N-channel raw ADC data acquired by a multi-channel photosensitive array to effectively remove noise and correct channel differences. A pre-calibrated mapping matrix is used to map the preprocessed data to a color space, thereby accurately calculating color space values and chromaticity coordinates, achieving accurate conversion between photosensitive data and standard color representation. By calculating the mapping residual, the light source type is identified, distinguishing between single and mixed light sources, allowing for the selection of an appropriate method for subsequent color temperature estimation. A color temperature estimation method is used to calculate the first color temperature of a single light source, providing a preliminary color temperature estimate. Further calculations of chromaticity difference and confidence level are used to assess the reliability of the estimation results, ensuring the stability of the color temperature output. When preset conditions are met, an exponentially weighted moving average operation is applied to further smooth the color temperature output, reducing short-term fluctuations caused by ambient light changes or sensor noise, thereby significantly improving the accuracy and reliability of the color temperature output results.
[0099] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a second embodiment of a color temperature determination method provided in this application.
[0100] like Figure 3 As shown, based on the above Figure 1 In the illustrated embodiment, step S104 further includes: S201. When the light source type is a hybrid light source, perform spectral decomposition on the hybrid light source to determine the basic spectral components of the hybrid light source; In one embodiment, if the light source type of the current light signal is determined to be a mixed light source, or if the chromaticity difference and confidence level corresponding to the first color temperature output by a single light source do not meet preset conditions, then spectral decomposition of the current light signal is required to further analyze the components of each light source. Spectral decomposition can employ NNLS (Non-negative Least Squares), NMF (Non-negative Matrix Factorization), sparse coding, or a sparse representation method based on dictionary learning. Specifically, if the chromaticity difference and confidence level corresponding to the first color temperature output by a single light source do not meet preset conditions, the single light source can be considered incorrectly identified. In this case, it is treated as a mixed light source for spectral decomposition and further analysis.
[0101] Specifically, a set of spectral bases is established in advance. Where Q represents the number of spectral bases. The set of spectral bases typically includes the spectral characteristics of various common light sources, such as blackbody bases, LED spectra, and fluorescence spectra. These can be used as known spectral components to describe and decompose mixed light sources.
[0102] For example, the device can be illuminated on a calibration platform using a set of reference light sources with known SPDs (including blackbodies of different color temperatures, D65 lamps, several types of LEDs, and fluorescent lamps), and data from each light source can be collected using the multispectral light sensor to be calibrated. Simultaneously, the true SPD and XYZ values of the light sources are obtained using a standard spectrophotometer, and the multi-channel response of the device is recorded. Through mathematical modeling and calculation, the mapping matrix M and the response matrix R are solved. Simultaneously, temperature-related gain correction tables and dark current correction tables are constructed for subsequent on-site self-calibration. The mapping matrix M can be a linear 3×N matrix, a biased linear model, or a nonlinear regression model (such as a small neural network).
[0103] The on-site self-calibration process can be described as follows: During the operation of intelligent devices (communicating with computer equipment) in fields such as mobile terminals, cameras, wearable devices, and smart lighting, dark frames (output of light sensors under no-light conditions) are periodically collected, and the dark current vector is updated according to temperature changes. To compensate for the effect of temperature on dark current, a rapid gain calibration is performed upon detection of a reference surface (such as a white card or gray card) or user-triggered calibration. This involves measuring the response of the reference surface in each channel, calculating and updating the gain vector G to ensure the accuracy of the photosensitive sensor's response. Simultaneously, a temperature sensor is installed within the aforementioned smart device to monitor and record the temperature T in real time. A pre-stored temperature-dependent gain table is then used. and dark ammeter Dynamic compensation is applied to the optical sensor response to ensure the stability of measurement results under different temperature conditions.
[0104] Combining factory calibration and online self-calibration mechanisms, it can adapt to different usage environments and conditions, ensuring long-term accuracy, effectively improving the accuracy of color temperature calculation, and meeting the high-precision requirements of different application scenarios.
[0105] The response matrix of the optical sensor to the spectral basis is established through measurement or simulation. Each column of the response matrix corresponds to the response value of a spectral basis on each channel of the optical sensor, reflecting the response characteristics of the optical sensor to different spectral bases. Then, the non-negative coefficient vector is solved. :
[0106] in, It is the gain-corrected optical sensor response vector. R It is a response matrix. w It is a non-negative coefficient vector used to represent the weight of each spectral basis in the mixed light source. It is a regularization parameter used to control the degree of sparsity; This is an L1 regularization term used to achieve sparsity, that is, to reduce the number of non-zero coefficients, making the solution sparser. The regularization term and sparsity weights can be adjusted according to the application scenario to achieve a balance between accuracy and complexity.
[0107] The above optimization problem can be solved using nonnegative least squares (NNLS) or small-scale nonnegative matrix factorization (NMF) algorithms to obtain a nonnegative coefficient vector. This is to determine the weight of each basic spectral component in the mixed light source, thereby decomposing the complex mixed light into basic spectral components and determining the contribution ratio of each component.
[0108] By combining the set of spectral bases and the weight vector, the fundamental spectral components of the hybrid light source are extracted. Each fundamental spectral component corresponds to a spectral base, and its weight represents the relative contribution of that spectral base to the hybrid light. A spectral base with a larger weight indicates that the spectral component is dominant in the hybrid light source.
[0109] S202. For each basic spectral component in the mixed light source, calculate the color space value and chromaticity coordinates corresponding to each basic spectral component. For each spectral basis or reconstructed SPD component (Spectral Power Distributions), its corresponding value is calculated using a mapping matrix or in the spectral domain. , This leads to the acquisition of the values of each basic spectral component. and color temperature weight .
[0110] Furthermore, based on the non-negative weighting coefficients corresponding to each of the basic spectral components, the spectral power distribution corresponding to each of the basic spectral components is determined; discrete integration is performed on the spectral power distribution and the color matching function to obtain the color space value corresponding to each of the basic spectral components.
[0111] Specifically, for each fundamental spectral component, its contribution to SPD is expressed as:
[0112] in, It is the first in the reference library The SPD components corresponding to each spectral base. These are the weights in the nonnegative coefficient vector obtained from spectral decomposition.
[0113] By performing discrete integration on the SPD and CIE color matching functions, the corresponding values for this basic spectral component are obtained. Value (discrete integral):
[0114] in, , , For CIE color matching functions at wavelength The value at that location can be obtained by looking up a table. Indicates the first i The three coordinate components of the basic spectral (SPD) components in the CIEXYZ color space. It is the first in the reference library i The basic spectral components at wavelength Spectral power distribution value at [location] It is the first obtained by spectral decomposition i Non-negative weighting coefficients for each basic spectral component.
[0115] The color space values obtained using the above calculations The chromaticity coordinates are calculated using chromaticity coordinate formulas (such as the CIE 1931 xy chromaticity coordinate formula). .
[0116] S203. Based on the color space values and chromaticity coordinates corresponding to each of the basic spectral components, the estimated color temperature corresponding to each of the basic spectral components is calculated using the color temperature estimation method. To distinguish the first color temperature corresponding to the current light signal of a single light source, the estimated color temperature corresponding to each basic spectral component in the mixed light source can be recorded as the second color temperature.
[0117] Color temperature estimation methods, such as the aforementioned Robertson interpolation (for high-precision output) or McCamy approximation (for fast estimation), can be used based on color space values. Calculate the corresponding second color temperature This is used to quantify the temperature characteristics of color. For detailed calculation methods, please refer to the previous steps; they will not be repeated here.
[0118] At the same time, based on the relative intensity or brightness contribution of each basic spectral component, its color temperature weight, such as brightness weight or intensity weight, is calculated.
[0119] The luminance weight can be calculated based on the components, and the calculation formula is as follows:
[0120] in, Indicates brightness weight. The Y-coordinate component represents the color space value. The luminance weight reflects the proportion of each basic spectral component's contribution to the overall luminance.
[0121] The intensity weights can be calculated from the non-negative weight coefficients obtained from spectral decomposition, using the following formula:
[0122] in, Indicates intensity weight, Indicates the first i Non-negative weighting coefficients for each basic spectral component. Intensity weights are used to represent the relative intensity percentage of each component in the mixed light.
[0123] In one embodiment, after calculating the second color temperature corresponding to each basic spectral component, just like the first color temperature corresponding to the current light signal of a single light source, it is necessary to perform chromaticity difference and confidence assessment on the second color temperature corresponding to each basic spectral component.
[0124] S204. Calculate the chromaticity difference and confidence level of the estimated color temperature corresponding to each of the basic spectral components. For a hybrid light source, calculate the corresponding values for each basic spectral component separately. The value represents the degree of deviation of the color of each component from the blackbody radiation trajectory.
[0125] Each basic spectral component can be considered as a single light source, utilizing its corresponding CIE XYZ color space value. Transform to the CIE 1960 UCS coordinate system, and the calculation formula is as follows:
[0126] in, It is the first i Color space values of the basic spectral components, It is the first i The chromaticity coordinates of the basic spectral components.
[0127] Calculate the perpendicular distance between the chromaticity coordinates of each basic spectral component and the coordinates of the nearest locus, i.e., the chromaticity difference ( The formula is as follows:
[0128] in, It is the first The chromaticity difference of each basic spectral component, It is the blackbody radiation trajectory that is related to the first Chromaticity coordinates of the basic spectral components The coordinates of the nearest point. It is the unit vector of the orthogonal direction of the blackbody radiation trajectory at the current point, used to determine the direction of chromaticity deviation.
[0129] Meanwhile, the confidence level is calculated according to the established formula, and the overall confidence level of this estimation is evaluated by comprehensively considering factors such as mapping residual, signal-to-noise ratio, and spectral decomposition reconstruction quality.
[0130] Specifically, the mapping residual reflects the difference between the actual measured value and the model's predicted value, and is an important indicator for evaluating the goodness of fit of the model. The calculation formula is as follows:
[0131] in, These are ideal color space values calculated based on the new light sensor response data and mapping matrix. It is the actual measured value of the color space. It is the first i The mapping residuals of the basic spectral components.
[0132] Signal-to-noise ratio (SNR) is used to evaluate the signal quality of optical sensor channels. The SNR of each channel can be calculated using the following formula:
[0133] in, It's the signal-to-noise ratio. It's the signal strength. It refers to noise intensity.
[0134] The quality of spectral decomposition and reconstruction measures how well the spectral decomposition model fits the original data, and is of great significance for evaluating the accuracy of spectral composition.
[0135] The confidence level of the second color temperature corresponding to each basic spectral component is calculated by using a weighted formula that integrates the effects of mapping residual, signal-to-noise ratio, and spectral decomposition reconstruction quality.
[0136] in, , , These represent the weighting coefficients for the mapping residual, signal-to-noise ratio, and spectral decomposition reconstruction quality, respectively, and correspond to the effects of the mapping residual, signal-to-noise ratio, and spectral decomposition reconstruction quality. It is the first i The mapping residuals of the basic spectral components, This indicates the signal-to-noise ratio. It is the first i The confidence level of the second color temperature of each basic spectral component. Indicates the quality of spectral decomposition and reconstruction.
[0137] By accurately calculating the chromaticity difference and confidence level of each basic spectral component, it is possible to achieve more precise color temperature and color management, thereby improving the performance and user experience of functions such as intelligent lighting systems and automatic white balance in cameras.
[0138] S205. When the chromaticity difference and confidence level of the estimated color temperature meet the preset conditions, perform an exponentially weighted moving average operation on the estimated color temperature and output the smoothed target color temperature.
[0139] Understandably, color difference The absolute value of the value indicates the degree of chromaticity deviation; a positive value indicates a warmer bias (deviation towards red), and a negative value indicates a cooler bias (deviation towards blue). The chromaticity difference index can be used to assess how close the color of a light source is to the color of an ideal blackbody radiation, and thus determine the color deviation of each basic spectral component.
[0140] The confidence level is normalized to the range [0,1]. The closer the confidence level is to 1, the more reliable the estimation result; the closer the value is to 0, the greater the uncertainty of the result. By setting a threshold, the confidence level can be used to determine whether to adopt the current estimation result or trigger a conservative strategy (such as switching to the default white balance mode).
[0141] In one embodiment, each basic spectral component can be regarded as a single light source. The chromaticity difference and confidence assessment method of the first color temperature output by the aforementioned single light source is reused. By using preset chromaticity difference thresholds and confidence thresholds, the chromaticity difference and confidence of each basic spectral component are judged, and then the second color temperature corresponding to each basic spectral component decomposed from the mixed light source is evaluated.
[0142] If the The chromaticity difference corresponding to each basic spectral component ( If the color temperature estimation result is less than or equal to the chromaticity difference threshold, and the confidence level is greater than or equal to the confidence threshold, then the current color temperature estimation result (the first one) is considered to be... The second color temperature corresponding to the first basic spectral component is relatively reliable and can be subjected to exponentially weighted moving average (EWMA) operation; if the second color temperature corresponding to the first basic spectral component is relatively reliable, exponentially weighted moving average (EWMA) operation can be performed ... The chromaticity difference corresponding to each basic spectral component ( If the color temperature estimation result is greater than the chromaticity difference threshold and / or the confidence level is less than the confidence threshold, then the current color temperature estimation result (the first one) is considered to be... The second color temperature corresponding to the first basic spectral component may have significant errors or uncertainties. Therefore, we will not perform an exponentially weighted moving average operation for now, and will directly output the second color temperature. (The second color temperature corresponding to each basic spectral component) or other processing measures.
[0143] Furthermore, when the chromaticity difference and confidence level of the estimated color temperature corresponding to each of the basic spectral components meet the preset conditions, the dominant color temperature is determined based on the estimated color temperature and color temperature weight corresponding to each of the basic spectral components; an exponential weighted moving average operation is performed on the dominant color temperature or the estimated color temperature corresponding to each of the basic spectral components, and the smoothed target color temperature is output.
[0144] In one embodiment, the color temperature weights of each basic spectral component can be compared, and the estimated color temperature with the largest color temperature weight can be selected as the dominant color temperature. This method is suitable for situations where a certain light source component is clearly dominant.
[0145] In another embodiment, the dominant color temperature is obtained by weighted summation of the estimated color temperatures corresponding to each of the basic spectral components based on their respective color temperature weights.
[0146] Specifically, the dominant color temperature can be calculated by weighting and summing the secondary color temperatures corresponding to each basic spectral component based on their respective color temperature weights. The formula is as follows:
[0147] in, and They represent the first i The second color temperature and color temperature weight of each basic spectral component. This method can comprehensively reflect the color temperature characteristics of each light source component.
[0148] After determining the dominant color temperature, an exponentially weighted moving average (EWMA) can be applied to the dominant color temperature or the secondary color temperature of each basic spectral component to smooth color temperature changes in the time domain, reduce short-term fluctuations and noise effects, and improve the stability of the output color temperature.
[0149] The formula for the Exponentially Weighted Moving Average (EWMA) can be expressed as:
[0150] in, Indicates the target color temperature to be output at the current moment; Indicates the weighting coefficient (between 0 and 1); This indicates the newly calculated dominant or secondary color temperature at the current moment; This indicates the target color temperature output at the previous moment.
[0151] The target color temperature is output after smoothing, and detailed information on each basic spectral component in the mixed light source, including the dominant spectral components, can also be output. and its weights, components Color difference ( ), confidence level, brightness (Y), etc., to provide comprehensive data support for subsequent applications.
[0152] In one specific embodiment, in a smart lighting application scenario, a 6-channel light sensor can be fixed on the top of a smart desk lamp equipped with a computer device. The main control uses a low-power MCU (Microcontroller Unit). It periodically samples at a frequency of 10Hz to estimate the ambient color temperature and drives the RGBW LEDs to adjust the light color, making the light color temperature close to the ambient CCT or adjusted according to the user's "warm / cool preference". When mixed light is detected (decomposition weight significantly > 2 components), the light color is adjusted preferentially according to the dominant component. When the user sets a "stable mode", the response frequency is reduced to prevent the light from flickering due to frequent changes in ambient light, improving user comfort.
[0153] In this embodiment, under mixed light source scenarios, spectral decomposition is used to determine each basic spectral component, and its color space values and chromaticity coordinates are calculated, providing a foundation for accurate color temperature estimation. Based on actual application requirements, color temperature estimation methods such as Robertson interpolation or McCamy approximation are used to calculate the color temperature of each component, combined with luminance or intensity weights to comprehensively reflect the contribution of each light source component. Further calculation of chromaticity difference and confidence level is performed to assess the reliability of the estimation results, ensuring the stability of the color temperature output. Finally, an exponentially weighted moving average operation is used to smooth the color temperature output, reducing the impact of short-term fluctuations and noise, making the color temperature calculation results more accurate and stable.
[0154] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a first embodiment of a color temperature determination device provided in this application. The color temperature determination device is used to perform the aforementioned color temperature determination method.
[0155] like Figure 4 As shown, the color temperature determination device 300 includes: a data preprocessing module 301, a spatial mapping module 302, a mapping residual calculation module 303, a first color temperature estimation module 304, a chromaticity difference and confidence calculation module 305, and a target color temperature output module 306.
[0156] The data preprocessing module 301 is used to preprocess the N-channel raw digital-to-analog converter (ADC) data acquired by the multi-channel photosensitive array to obtain the preprocessed data of the current optical signal. The spatial mapping module 302 is used to map the preprocessed data to a color space through a pre-calibrated mapping matrix, and calculate the color space value and chromaticity coordinates corresponding to the current light signal; The light source type determination module 303 is used to determine the light source type of the current light signal based on the color space value; The color temperature estimation module 304 is used to determine the estimated color temperature of the current light signal based on the chromaticity coordinates and using the color temperature estimation method corresponding to the light source type of the current light signal. The chromaticity difference and confidence level calculation module 305 is used to calculate the chromaticity difference and confidence level of the estimated color temperature; The target color temperature output module 306 is used to perform an exponentially weighted moving average operation on the estimated color temperature when the chromaticity difference and confidence level of the estimated color temperature meet preset conditions, and output the target color temperature of the current light signal.
[0157] In one embodiment, the light source type determination module 303 includes: The mapping residual calculation unit is used to calculate the vector difference between the color space value and the ideal color space value to obtain the mapping residual. A single light source determination unit is used to determine that the light source type of the current light signal is a single light source if the mapping residual is less than a preset residual threshold. A hybrid light source determination unit is used to determine that the light source type of the current light signal is a hybrid light source if the mapping residual is greater than or equal to the residual threshold.
[0158] In one embodiment, the color temperature estimation module 304 includes: A color temperature estimation method determination unit is used to determine the color temperature estimation method based on the current color temperature calculation requirements when the light source type is a single light source. A single light source color temperature estimation unit is used to determine the estimated color temperature of the current light signal based on the chromaticity coordinates and the color temperature estimation method.
[0159] In one embodiment, the color temperature estimation module 304 further includes: The spectral decomposition unit is used to perform spectral decomposition on the mixed light source when the light source type is a mixed light source, and to determine the basic spectral components of the mixed light source; The basic spectral component parameter calculation unit is used to calculate the color space value and chromaticity coordinates corresponding to each basic spectral component in the mixed light source. The basic spectral component color temperature estimation unit is used to calculate the estimated color temperature corresponding to each basic spectral component based on the color space value and chromaticity coordinates corresponding to each basic spectral component, using the color temperature estimation method.
[0160] In one embodiment, the target color temperature output module 306 includes: The dominant color temperature determination unit is used to determine the dominant color temperature based on the estimated color temperature and color temperature weight of each of the basic spectral components when the chromaticity difference and confidence level of the estimated color temperature corresponding to each of the basic spectral components meet the preset conditions. The target color temperature output unit is used to perform an exponentially weighted moving average operation on the dominant color temperature or the estimated color temperature corresponding to each of the basic spectral components, and output the smoothed target color temperature.
[0161] In one embodiment, the dominant color temperature determination unit includes: The dominant color temperature determination first unit is used to select the estimated color temperature with the largest color temperature weight as the dominant color temperature; The dominant color temperature determination second unit is used to perform a weighted summation calculation on the estimated color temperatures corresponding to each of the basic spectral components based on the color temperature weights corresponding to each of the basic spectral components, so as to obtain the dominant color temperature.
[0162] In one embodiment, the basic spectral component parameter calculation unit includes: The spectral power distribution determination subunit is used to determine the spectral power distribution corresponding to each of the basic spectral components based on the non-negative weighting coefficients corresponding to each of the basic spectral components. The color space value calculation subunit is used to perform discrete integral calculation on the spectral power distribution and color matching function to obtain the color space value corresponding to each of the basic spectral components.
[0163] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the device and each module described above can be referred to the corresponding process in the aforementioned color temperature determination method embodiment, and will not be repeated here.
[0164] The apparatus provided in the above embodiments can be implemented as a computer program, which can be used in, for example... Figure 5 It runs on the computer device shown.
[0165] Please see Figure 5 , Figure 5 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device may be a server.
[0166] See Figure 5 The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0167] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any color temperature determination method.
[0168] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0169] Internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor, it enables the processor to execute any color temperature determination method.
[0170] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0171] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0172] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps: Data preprocessing is performed on the N-channel raw digital-to-analog converter (ADC) data acquired through a multi-channel photosensitive sensor array to obtain preprocessed data of the current optical signal; The preprocessed data is mapped to a color space using a pre-calibrated mapping matrix, and the color space value and chromaticity coordinates corresponding to the current light signal are calculated. Based on the color space values, determine the light source type of the current light signal; Based on the chromaticity coordinates, the estimated color temperature of the current light signal is determined using the color temperature estimation method corresponding to the light source type of the current light signal; Calculate the chromaticity difference and confidence level of the estimated color temperature; When the chromaticity difference and confidence level of the estimated color temperature meet the preset conditions, an exponentially weighted moving average operation is performed on the estimated color temperature to output the target color temperature of the current light signal.
[0173] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the color temperature determination methods provided in the embodiments of this application.
[0174] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0175] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for determining color temperature, characterized in that, The method includes: Data preprocessing is performed on the N-channel raw digital-to-analog converter (ADC) data acquired through a multi-channel photosensitive sensor array to obtain preprocessed data of the current optical signal; The preprocessed data is mapped to a color space using a pre-calibrated mapping matrix, and the color space value and chromaticity coordinates corresponding to the current light signal are calculated. Based on the color space values, determine the light source type of the current light signal; Based on the chromaticity coordinates, the estimated color temperature of the current light signal is determined using the color temperature estimation method corresponding to the light source type of the current light signal; Calculate the chromaticity difference and confidence level of the estimated color temperature; When the chromaticity difference and confidence level of the estimated color temperature meet the preset conditions, an exponentially weighted moving average operation is performed on the estimated color temperature to output the target color temperature of the current light signal.
2. The color temperature determination method according to claim 1, characterized in that, Determining the light source type of the current light signal based on the color space values includes: Calculate the vector difference between the color space value and the ideal color space value to obtain the mapping residual; If the mapping residual is less than a preset residual threshold, then the light source type of the current optical signal is determined to be a single light source. If the mapping residual is greater than or equal to the residual threshold, then the light source type of the current optical signal is determined to be a hybrid light source.
3. The color temperature determination method according to claim 2, characterized in that, The step of determining the estimated color temperature of the current light signal based on the chromaticity coordinates and using a color temperature estimation method corresponding to the light source type of the current light signal includes: When the light source type is a single light source, the color temperature estimation method is determined based on the current color temperature calculation requirements; The estimated color temperature of the current light signal is determined using the color temperature estimation method based on the chromaticity coordinates.
4. The color temperature determination method according to claim 2, characterized in that, The step of determining the estimated color temperature of the current light signal based on the chromaticity coordinates and using a color temperature estimation method corresponding to the light source type of the current light signal further includes: When the light source type is a hybrid light source, spectral decomposition is performed on the hybrid light source to determine the basic spectral components of the hybrid light source; For each basic spectral component in the hybrid light source, calculate the color space value and chromaticity coordinates corresponding to each basic spectral component; Based on the color space values and chromaticity coordinates corresponding to each of the basic spectral components, the estimated color temperature corresponding to each of the basic spectral components is calculated using the color temperature estimation method.
5. The color temperature determination method according to claim 4, characterized in that, When the chromaticity difference and confidence level of the estimated color temperature meet preset conditions, the estimated color temperature is subjected to an exponentially weighted moving average operation to output the target color temperature of the current light signal, including: When the chromaticity difference and confidence level of the estimated color temperature corresponding to each of the basic spectral components meet the preset conditions, the dominant color temperature is determined based on the estimated color temperature and color temperature weight corresponding to each of the basic spectral components. An exponentially weighted moving average operation is performed on the dominant color temperature or the estimated color temperature corresponding to each of the basic spectral components to output the smoothed target color temperature.
6. The color temperature determination method according to claim 5, characterized in that, The determination of the dominant color temperature based on the estimated color temperature and color temperature weight corresponding to each of the basic spectral components includes: Select the estimated color temperature with the highest color temperature weight as the dominant color temperature; or... Based on the color temperature weights corresponding to each of the basic spectral components, the estimated color temperatures corresponding to each of the basic spectral components are weighted and summed to obtain the dominant color temperature.
7. The color temperature determination method according to claim 4, characterized in that, The step of calculating the color space value corresponding to each basic spectral component in the mixed light source includes: Based on the non-negative weighting coefficients corresponding to each of the basic spectral components, the spectral power distribution corresponding to each of the basic spectral components is determined. Discrete integrals are performed on the spectral power distribution and color matching function to obtain the color space value corresponding to each of the basic spectral components.
8. A color temperature determining device, characterized in that, The color temperature determination device includes: The data preprocessing module is used to preprocess the N-channel raw digital-to-analog converter (ADC) data acquired through a multi-channel photosensitive array to obtain the preprocessed data of the current optical signal. The spatial mapping module is used to map the preprocessed data to a color space using a pre-calibrated mapping matrix, and to calculate the color space value and chromaticity coordinates corresponding to the current light signal. A light source type determination module is used to determine the light source type of the current light signal based on the color space values; A color temperature estimation module is used to determine the estimated color temperature of the current light signal based on the chromaticity coordinates and using a color temperature estimation method corresponding to the light source type of the current light signal. The color difference and confidence level calculation module is used to calculate the color difference and confidence level of the estimated color temperature; The target color temperature output module is used to perform an exponentially weighted moving average operation on the estimated color temperature when the chromaticity difference and confidence level of the estimated color temperature meet preset conditions, and output the target color temperature of the current light signal.
9. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the steps of the color temperature determination method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the color temperature determination method as described in any one of claims 1 to 7.