A method, device, and readable storage medium for color correction
By segmenting light sources into color temperature intervals and applying a color correction matrix with interpolation and weightings, the method addresses color inconsistencies in image processing, achieving enhanced color accuracy across varying lighting conditions.
Patent Information
- Application Number
- CN202110750154.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-01
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-07-01
AI Technical Summary
The existing color correction methods cannot accurately restore the color when the color temperatures of different light sources are close, resulting in poor color correction effect.
By determining the color temperature interval and color correction matrix (CCM), and performing linear interpolation and weighting, the final CCM is obtained for color correction, and adapted to various light source environments.
Improves the accuracy and adaptability of color correction, and can accurately restore colors in different light sources.
Smart Images

Figure CN115567774B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to a method, an apparatus, and a readable storage medium for color correction. Background Art
[0002] The image signal processing (ISP) process in a camera includes multiple processing procedures. Among them, color correction processing is a relatively important processing in ISP, which is used to convert from the camera RGB space to the standard RGB space.
[0003] Since the response of the camera sensor is directly related to the spectrum of the light source, the camera RGB value is the result of the integral of the light source power spectral density, the camera response curve, and the object reflectivity. When the color temperatures of different light sources are close, the corresponding spectra may be quite different. Therefore, in many cases, the conventional color correction method cannot obtain the set of calibration parameters corresponding to the actual shooting environment, and thus cannot accurately restore colors. Summary of the Invention
[0004] In view of this, the present disclosure provides a method, an apparatus, and a readable storage medium for color correction.
[0005] According to a first aspect of an embodiment of the present disclosure, a method for color correction is provided, including:
[0006] Determine K color temperature intervals according to the color temperature of each of N light sources; wherein, the difference between the color temperatures of any two light sources in the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are positive integers;
[0007] Determine the CCM of each color temperature interval according to the color correction matrix CCM of the light source;
[0008] Perform linear interpolation according to the CCMs of the respective color temperature intervals in the K color temperature intervals to obtain a final CCM;
[0009] Use the final CCM for color correction.
[0010] In an embodiment, the method further includes:
[0011] Determine T reference color temperature intervals from the K color temperature intervals; wherein, each reference color temperature interval in the T reference color temperature intervals corresponds to at least two light sources; wherein, T is less than or equal to N, and T is a positive integer;
[0012] Determining the CCM of each color temperature interval according to the CCM of the light source includes: determining the CCM of each reference color temperature interval according to the CCM of the light source.
[0013] In one embodiment, the method further includes:
[0014] Determining the CCM of each reference color temperature interval according to the CCM of the light source includes:
[0015] Determining M light sources among the N light sources that best match the current environment according to a light source estimation algorithm, and determining the first weight of each light source among the M light sources; where M is less than N and M is a positive integer;
[0016] Determining the second weight of each light source in each reference color temperature interval according to the first weight of each light source among the M light sources and the light source attributes;
[0017] Using the second weight of each light source in each reference color temperature interval to perform weighted processing on the CCM of each light source corresponding to the reference color temperature interval to obtain the CCM of the reference color temperature interval.
[0018] In one embodiment, the method further includes:
[0019] Determining M light sources among the N light sources that best match the current environment according to a light source estimation algorithm, and determining the first weight of each light source among the M light sources includes:
[0020] Determining an original image;
[0021] Determining the first ratio of the first color component to the third color component and the second ratio of the second color component to the third color component in each set area in the original image;
[0022] Generating a two-dimensional histogram corresponding to a first variable and a second variable according to the first correction coefficient of the first color component and the second correction coefficient of the second color component corresponding to each light source among the N light sources; where the first variable is a first function with the product of the first ratio and the first correction coefficient as the input parameter, and the second variable is a first function with the product of the second ratio and the second correction coefficient as the input parameter;
[0023] Determining the entropy of the two-dimensional histogram corresponding to each light source among the N light sources;
[0024] Determining M light sources that best match the current environment according to the N entropies, and the first weight of each light source among the M light sources.
[0025] In one embodiment, the method further includes:
[0026] Determining the M light sources that best match the current environment according to N entropies, and the first weight of each light source among the M light sources includes:
[0027] Determining the sorting of the N entropies according to the N entropies, and determining the M entropies at the end with the minimum value in the sorting;
[0028] Performing quadratic curve fitting according to the sorting, determining a quadratic curve, and determining the first weight of the light source corresponding to each entropy among the M entropies according to the quadratic curve.
[0029] In one embodiment, the method further includes:
[0030] The first weight of the light source corresponding to each entropy among the M entropies is inversely proportional to the corresponding projection distance, and the projection distance is the projection distance of the vector between the entropy and the vertex of the quadratic curve on the set coordinate axis.
[0031] In one embodiment, the method further includes:
[0032] Determining the second weight of each light source in each reference color temperature interval according to the first weight of each light source among the M light sources and the light source attributes includes:
[0033] For a light source to be weighted in each reference color temperature interval, determining at least one light source among the M light sources that has the same light source attribute as the light source to be weighted, and taking the sum of the first weights corresponding to each light source among the at least one light source as the second weight of the light source to be weighted;
[0034] Wherein, the sum of the second weights of all light sources corresponding to each reference color temperature interval is 1.
[0035] In one embodiment, the method further includes:
[0036] Determining the CCM of each color temperature interval according to the color correction matrix CCM of the light source includes:
[0037] For the K - T color temperature intervals among the K color temperature intervals other than the T reference color temperature intervals, determining the CCM of each color temperature interval among the K - T color temperature intervals as the CCM of the light source corresponding to the color temperature interval.
[0038] In one embodiment, the method further includes:
[0039] The light source attributes include at least one of the following:
[0040] The light source has an infrared light component, and the spectrum of the light source corresponds to a narrow - band spectrum.
[0041] According to the second aspect of the embodiments of the present disclosure, a color correction device is provided, including:
[0042] A first determination module, configured to determine K color temperature intervals according to the color temperature of each light source among N light sources; wherein, the difference between the color temperatures of any two light sources in the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are integers greater than zero;
[0043] A second determination module, configured to determine the CCM of each color temperature interval according to the color correction matrix CCM of the light source;
[0044] An interpolation module, configured to perform linear interpolation according to the CCMs of the respective color temperature intervals among the K color temperature intervals to obtain a final CCM;
[0045] A correction module, configured to perform color correction using the final CCM.
[0046] In an embodiment, the method further includes:
[0047] The apparatus further includes:
[0048] A third determination module, configured to determine T reference color temperature intervals from the K color temperature intervals; wherein, each reference color temperature interval in the T reference color temperature intervals corresponds to at least two light sources; wherein, T is less than or equal to N, and T is an integer greater than zero;
[0049] The second determination module is further configured to determine the CCM of each reference color temperature interval according to the CCM of the light source.
[0050] In an embodiment, the method further includes:
[0051] The second determination module includes:
[0052] A selection unit, configured to determine M light sources among the N light sources that are most matched to the current environment according to a light source estimation algorithm, and determine the first weights of the light sources among the M light sources; wherein, M is less than N, and M is an integer greater than zero;
[0053] A calculation unit, configured to determine the second weights of the light sources in each reference color temperature interval according to the first weights of the light sources among the M light sources and the light source attributes;
[0054] A weighting unit, configured to use the second weights of the light sources in each reference color temperature interval to perform a weighting process on the color correction matrices of the light sources corresponding to the reference color temperature intervals to obtain the CCM of the reference color temperature intervals.
[0055] In an embodiment, the method further includes:
[0056] The selection unit is configured to determine, according to a light source estimation algorithm, M light sources among the N light sources that best match the current environment, and determine the first weight of each light source among the M light sources, including:
[0057] A first determination subunit, configured to determine an original image;
[0058] A second determination subunit, configured to determine a first ratio of a first color component to a third color component, and a second ratio of a second color component to the third color component in each set region of the original image;
[0059] A generation subunit, configured to generate a two-dimensional histogram corresponding to a first variable and a second variable according to a first correction coefficient of a first color component and a second correction coefficient of a second color component corresponding to each of the N light sources; wherein, the first variable is a first function with the product of the first ratio and the first correction coefficient as an input parameter, and the second variable is a first function with the product of the second ratio and the second correction coefficient as an input parameter;
[0060] A third determination subunit, configured to determine the entropy of the two-dimensional histogram corresponding to each of the N light sources;
[0061] A fourth determination subunit, configured to determine M light sources that best match the current environment among the N light sources according to the N entropies, and the first weight of each light source among the M light sources.
[0062] In an embodiment, the method further includes:
[0063] The fourth determination subunit is further configured to use the following method to determine M light sources that best match the current environment among the N light sources according to the N entropies, and the first weight of each light source among the M light sources:
[0064] Determine the sorting of the N entropies according to the N entropies, and determine M entropies at the end with the minimum value in the sorting;
[0065] Perform quadratic curve fitting according to the sorting to determine a quadratic curve, and determine the first weight of the light source corresponding to each entropy among the M entropies according to the quadratic curve.
[0066] In an embodiment, the method further includes:
[0067] The first weight of the light source corresponding to each entropy among the M entropies is inversely proportional to the corresponding projection distance, and the projection distance is the projection distance of the vector between the entropy and the vertex of the quadratic curve on a set coordinate axis.
[0068] In an embodiment, the method further includes:
[0069] The calculation unit is further configured to use the following method to determine the second weight of each light source in each reference color temperature range according to the first weight of each light source in the M light sources and the light source attributes;
[0070] For a light source to be weighted in each reference color temperature range, determine at least one light source in the M light sources that has the same light source attribute as the light source to be weighted, and use the sum of the first weights corresponding to each light source in the at least one light source as the second weight of the light source to be weighted;
[0071] Wherein, the sum of the second weights of all light sources corresponding to each reference color temperature range is 1.
[0072] In an embodiment, the method further includes:
[0073] The second determination module is further configured to use the following method to determine the CCM of each color temperature range according to the color correction matrix CCM of the light source:
[0074] For the K - T color temperature ranges among the K color temperature ranges other than the T reference color temperature ranges, determine the CCM of each color temperature range in the K - T color temperature ranges as the CCM of the light source corresponding to the color temperature range.
[0075] In an embodiment, the method further includes:
[0076] The light source attributes include at least one of the following:
[0077] The light source has an infrared light component, and the spectrum of the light source corresponds to a narrow - band spectrum.
[0078] According to a third aspect of the embodiments of the present disclosure, there is provided a color correction device applied to a terminal, including:
[0079] A processor;
[0080] A memory for storing executable instructions of the processor;
[0081] Wherein, the processor is configured to execute the executable instructions in the memory to implement the steps of the color correction method.
[0082] According to a third aspect of the embodiments of the present disclosure, there is provided a non - transitory computer - readable storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the steps of the color correction method are implemented.
[0083] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects: The concepts of color temperature range and CCM of the color temperature range are proposed. Each color temperature range corresponds to at least one light source. When a certain color temperature range corresponds to more than one light source, the more than one light source may include two light sources with similar color temperatures but significant spectral differences. The CCM of the corresponding color temperature range comprehensively reflects the characteristics of these light sources with similar color temperatures but significant spectral differences, which is beneficial for better color correction and accurate color restoration.
[0084] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. Brief Description of the Drawings
[0085] The accompanying drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.
[0086] Figure 1 is a flowchart of a color correction method shown according to an exemplary embodiment;
[0087] Figure 2 is a flowchart of another color correction method shown according to an exemplary embodiment;
[0088] Figure 3 is a structural diagram of a color correction device shown according to an exemplary embodiment;
[0089] Figure 4 is a structural diagram of another color correction device shown according to an exemplary embodiment. Detailed Description of the Embodiments
[0090] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments in the present disclosure. On the contrary, they are only examples of devices and methods consistent with some aspects of the embodiments in the present disclosure as detailed in the appended claims.
[0091] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present disclosure. The singular forms "a", "the" and "said" used in the embodiments of the present disclosure and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0092] An embodiment of the present disclosure provides a color correction method. Refer to Figure 1 , Figure 1 which is a flowchart of a color correction method shown according to an exemplary embodiment. As Figure 1 shown, this method may include:
[0093] Step S11: Determine K color temperature intervals according to the color temperature of each of the N light sources; wherein, the difference between the color temperatures of any two light sources in the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are integers greater than zero;
[0094] Step S12: Determine the CCM of each color temperature interval according to the color correction matrix CCM of the light source;
[0095] Step S13: Perform linear interpolation according to the CCMs of the respective color temperature intervals in the K color temperature intervals to obtain a final CCM;
[0096] Step S14: Perform color correction using the final CCM.
[0097] In one embodiment, before step S11, it further includes: determining N light sources.
[0098] In some possible examples, the light source may be a standard light source. A standard light source refers to an artificial light source whose radiation approximates the CIE standard illuminant as stipulated by the International Commission on Illumination (abbreviated as CIE). The color of an object is the spectral reflection presented after light irradiates the surface of the object. When the same object is irradiated by different light sources, due to the difference in the absorption degree of light of different wavelengths, the color presented by the object is different. Commonly used standard light sources: D75, D65, D50, F11, F12, A, etc.
[0099] In some possible examples, when determining N light sources, make the color temperature interval covered by the color temperatures of the determined N light sources as large as possible. Thus, better color correction effects can be achieved in various environments. If the color temperature interval covered by the color temperatures of the determined N light sources is small, when the illumination condition of the current environment is far from the illumination conditions corresponding to the N light sources, the color correction effect cannot be guaranteed.
[0100] In some possible examples, when determining N light sources, make the color temperature interval covered by the color temperatures of the determined N light sources as large as possible, and moreover, the distribution of the color temperatures of the N light sources within the color temperature interval is as uniform as possible. Thus, better color correction effects can be achieved in various environments. If the values of the color temperatures of the determined N light sources are relatively concentrated, when the color temperature condition of the current environment is far from the color temperature conditions corresponding to the N light sources, the color correction effect cannot be guaranteed.
[0101] In one embodiment, before step S11, it further includes: determining the CCM of each of the N light sources. Specifically, it includes: calibrating the parameters of each standard light source among the N light sources to determine the color correction matrix (CCM) of each standard light source.
[0102] In one embodiment, the color temperature difference values at the interval endpoints corresponding to each color temperature interval may be the same. For example, the color temperature intervals may include: [8000, 7000), [7000, 6000), [6000, 5000), [5000, 4000), [4000, 3000), [3000, 2000), [2000, 1000).
[0103] In one embodiment, K color temperature intervals are determined according to the N light sources.
[0104] There are no corresponding standard light sources for some color temperature values, so when setting the color temperature intervals, these color temperature values are not covered by the color temperature intervals. In some examples, the color temperature span of the color temperature intervals does not need to be set too large, and it is sufficient to correspond light sources with similar color temperatures to the same color temperature interval.
[0105] For example: the N light sources may include: D75, D65, D50, F2, F11, F12, A, Horizon, and the K color temperature intervals may include: [8000, 7000], [7000, 6000], [5200, 4800], [3800, 4200], [3200, 2800], [2500, 2100].
[0106] In one embodiment, the color temperature difference values at the interval endpoints corresponding to each color temperature interval may not be completely the same.
[0107] In one embodiment, the first threshold is a value that can be adjusted, and the first threshold can be increased or decreased according to the usage requirements.
[0108] A feasible color correction method is: performing linear interpolation processing based on the CCMs of multiple standard light sources to obtain a final CCM, and using the final CCM for color correction.
[0109] In the embodiments of the present disclosure, compared with the above available color correction methods, the concepts of color temperature intervals and the CCMs of color temperature intervals are proposed. Each color temperature interval corresponds to at least one light source. When a color temperature interval corresponds to more than one light source, the more than one light source may include two light sources with similar color temperatures but significant spectral differences. The characteristics of these light sources with similar color temperatures but significant spectral differences are comprehensively reflected in the CCM of the corresponding color temperature interval, which is beneficial to better color correction and accurate color restoration.
[0110] In the embodiments of the present disclosure, a color correction method is provided. Refer to Figure 2 , Figure 2 which is a flowchart of a color correction method shown according to an exemplary embodiment. As Figure 2 shown, this method may include:
[0111] Step S11: Determine K color temperature intervals according to the color temperature of each light source among the N light sources; wherein, the difference between the color temperatures of any two light sources in the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are positive integers greater than zero;
[0112] Step S11': Determine T reference color temperature intervals from the K color temperature intervals; wherein, each reference color temperature interval in the T reference color temperature intervals corresponds to at least two light sources; wherein, T is less than or equal to N, and T is a positive integer greater than zero;
[0113] Step S12: Determine the CCM of each color temperature interval according to the color correction matrix CCM of the light source. Wherein, determining the CCM of each color temperature interval includes: determining the CCM of each reference color temperature interval according to the CCM of the light source.
[0114] Step S13: Perform linear interpolation according to the CCMs of the color temperature intervals in the K color temperature intervals to obtain a final CCM;
[0115] Step S14: Use the final CCM for color correction.
[0116] Wherein, each reference color temperature interval is a color temperature interval among the K color temperature intervals.
[0117] In one embodiment, the K color temperature intervals include two types of color temperature intervals. The first type of color temperature interval is a reference color temperature interval, and each reference color temperature interval corresponds to at least two light sources. Each color temperature interval in the second type of color temperature interval corresponds to only one light source.
[0118] In the embodiments of the present disclosure, among the K color temperature intervals, there are T reference color temperature intervals. Each reference color temperature interval corresponds to at least two light sources. The at least two light sources corresponding to each reference color temperature interval may include two light sources with similar color temperatures but significantly different spectra. The CCM of the corresponding color temperature interval comprehensively reflects the characteristics of these light sources with similar color temperatures but significantly different spectra, which is beneficial for better color correction and accurate color restoration.
[0119] In the embodiments of the present disclosure, a color correction method is provided. This method includes Figure 2 In the method shown, for example, determining the CCM of each reference color temperature interval according to the CCM of the light source may include:
[0120] Step S131: Determine M light sources among the N light sources that best match the current environment according to a light source estimation algorithm, and determine the first weight of each light source among the M light sources; where M is less than N and M is a positive integer greater than zero;
[0121] Step S132: Determine the second weight of each light source in each reference color temperature interval according to the first weight of each light source among the M light sources and the light source attributes;
[0122] Step S133: Use the second weight of each light source in each reference color temperature interval to perform weighted processing on the color correction matrix of each light source corresponding to the reference color temperature interval to obtain the CCM of the reference color temperature interval.
[0123] In one embodiment, in step S132, the light source attributes may include at least one of the following: the light source has an infrared light component, and the spectrum of the light source corresponds to a narrowband spectrum.
[0124] In the embodiments of the present disclosure, it is proposed to use light source attributes to assist in determining the second weight of each light source in each reference color temperature interval, so that the second weight of the reference color temperature interval is related to the light source attributes, thereby providing the possibility of realizing the weights of light sources with the same light source attributes.
[0125] In one embodiment, in step S131, determining M light sources among the N light sources that best match the current environment according to a light source estimation algorithm and determining the first weight of each light source among the M light sources includes:
[0126] Step S131-1: Determine the original image;
[0127] Step S131-2: Determine the first ratio of the first color component to the third color component and the second ratio of the second color component to the third color component in each set area of the original image;
[0128] Among them, the set area can be a pixel block of a set size, and the size of this pixel block can be 4*4, 8*8, 16*16, etc.
[0129] Step S131-3: Generate a two-dimensional histogram corresponding to the first variable and the second variable according to the first correction coefficient of the first color component and the second correction coefficient of the second color component corresponding to each light source among the N light sources; wherein, the first variable is a first function with the product of the first ratio and the first correction coefficient as the input parameter, and the second variable is a first function with the product of the second ratio and the second correction coefficient as the input parameter.
[0130] Step S131-4: Determine the entropy of the two-dimensional histogram corresponding to each light source among the N light sources.
[0131] Step S131-5: Determine M light sources that best match the current environment and the first weight of each light source among the M light sources according to the N entropies.
[0132] In one embodiment, in step S131-2, the first color component, the second color component, and the third color component are different color components. For example: the first color component can be the R component, the second color component can be the B component, and the third color component can be the G component.
[0133] The first ratio is the ratio of the first color component to the third color component, that is, R / G.
[0134] The second ratio is the ratio of the second color component to the third color component, that is, B / G.
[0135] In addition to the above RGB components, corresponding components in other color component spaces other than the RGB color space can also be used.
[0136] In one example, the first ratio can be the ratio of the first color component to the third color component statistically obtained from the original image in blocks, and the second ratio can be the ratio of the second color component to the third color component statistically obtained from the original image in blocks. The block here refers to a pixel set including a rectangular area.
[0137] In one example, the first ratio can be the ratio of the first color component to the third color component statistically obtained from the original image pixel by pixel, and the second ratio can be the ratio of the second color component to the third color component statistically obtained from the original image pixel by pixel.
[0138] In one embodiment, in step S131-3, the first color component is the R component, and the first correction coefficient of the first color component corresponding to each light source is called R_Map. The second color component is the B component, and the second correction coefficient of the second color component corresponding to each light source is called B_Map.
[0139] Among them, the first correction coefficient is the correction coefficient of the first color component obtained by using a lens shading correction algorithm; the second correction coefficient is the correction coefficient of the second color component obtained by using a lens shading correction algorithm.
[0140] The shading correction algorithm is to solve the situation where shadows appear around the lens due to the uneven optical refraction of the lens. Due to the optical characteristics of the lens, the light intensity received by the edge area of the captured image area is smaller than that of the center, resulting in the phenomenon of inconsistent brightness between the center and the four corners. The first correction coefficient and the second correction coefficient obtained by using the shading correction algorithm are used to compensate for the brightness attenuation of the lens from the center to the periphery. After weighting the first correction coefficient and the second correction coefficient, the image is flattened from the center to the periphery.
[0141] In an example, the first variable can be log(R*R_Map), and the second variable can be log(B*B_Map).
[0142] In an embodiment, step S131-5 of determining M light sources that best match the current environment and the first weight of each light source among the M light sources according to the N entropies may include:
[0143] Determine the sorting of the N entropies according to the N entropies, and determine M entropies at the end with the minimum value in the sorting; perform quadratic curve fitting according to the sorting to determine the quadratic curve, and determine the first weight of the light source corresponding to each entropy among the M entropies according to the quadratic curve.
[0144] In an example, both the abscissa and the ordinate in the coordinate system used for the quadratic curve correspond to the real number value range. The Lagrangian polynomial fitting method can be used for quadratic curve fitting.
[0145] Among them, the quadratic curve can be a parabola.
[0146] The entropy corresponding to each light source can reflect the effect of attenuation compensation of this light source. The better the effect of attenuation compensation, the closer this light source is to the illumination condition of the current environment, and thus the more it matches the illumination condition of the current environment, that is, the more it matches the current environment.
[0147] In an embodiment, the first weight of the light source corresponding to each entropy among the M entropies is inversely proportional to the projection distance corresponding to the entropy. The projection distance is the projection distance of the vector between the entropy and the vertex of the quadratic curve on the set coordinate axis. Exemplarily, the set coordinate axis is the abscissa axis.
[0148] An embodiment of the present disclosure provides a color correction method, which includes Figure 2The method shown in the figure, exemplarily, in step S132, determining the second weight of each light source in each reference color temperature interval according to the first weight of each light source in the M light sources and the light source attribute may include:
[0149] For a light source to be weighted in each reference color temperature interval, determine at least one light source among the M light sources that has the same light source properties as the light source to be weighted, and use the sum of the first weights corresponding to each light source in the at least one light source as the second weight of the light source to be weighted;
[0150] The sum of the second weights of all light sources corresponding to each reference color temperature interval is 1.
[0151] In this implementation, the sum of the first weights of at least one light source having the same light source properties as the light source to be weighted is used as the second weight of the light source to be weighted, thereby increasing the weight of the light source to be weighted, so that the weight of the light source to be weighted carries the proportion of multiple light sources having the same light source properties in this parameter color temperature range, and the proportion of the multiple light sources having the same light source properties is reflected in the CCM of the parameter color temperature range, effectively reflecting the different spectral characteristics of light sources with similar color temperatures, thereby improving the accuracy of color reproduction.
[0152] The present disclosure provides a method for color correction, which includes: Figure 2 The method shown, for example, wherein determining the CCM of each color temperature interval may include:
[0153] For KT color temperature intervals among the K color temperature intervals except the T reference color temperature intervals, the CCM of each color temperature interval among the KT color temperature intervals is the CCM of the corresponding light source.
[0154] The following is a detailed description using an exemplary embodiment.
[0155] Example 1
[0156] Step 1, select 8 (corresponding to N) standard light sources, the 8 standard light sources are: D75, D65, D50, F2, F11, F12, A and H.
[0157] Each light source corresponds to a CCM of the light source, for example, the CCM corresponding to F11 is CCM_F11.
[0158] Step 2: Determine the color temperature of each light source, as shown in Table 1.
[0159] Table 1
[0160] Light source D75 D65 D50 F2 F11 F12 A H Color temperature 7500 6500 5000 4150 4000 3000 2856 2300
[0161] Step 3, the first threshold is 200. Six (corresponding to K) color temperature intervals are determined according to the first threshold, and the difference between the color temperatures of any two light sources within each color temperature interval is less than 200. As shown in Table 2:
[0162] Table 2
[0163]
[0164] Step 4, determine that two (corresponding to T) reference color temperature intervals among the six color temperature intervals are the fourth interval and the fifth interval.
[0165] Among them, the fourth interval corresponds to a total of two light sources, F2 and F11, and the fifth interval corresponds to a total of two light sources, F12 and A. Each of the other intervals corresponds to one light source.
[0166] Step 6, set the value of M to 3. Use the eight standard light sources according to the light source estimation algorithm to determine the three light sources that best match the current environment, and determine the weights of these three light sources. Exemplarily, it may include:
[0167] Step 6.1, determine the original image;
[0168] Step 6.2, count the first ratio of R to G, and the second ratio of B to G;
[0169] Step 6.3, according to the first correction coefficient of R, i.e., R_map, corresponding to each of the eight light sources, and the first correction coefficient of B, i.e., B_map;
[0170] Step 6.4, count the two-dimensional histogram of the first variable and the two-dimensional histogram of the second variable, where the first variable is the product of the first ratio and the first correction coefficient R_map, and the second variable is the product of the second ratio and the second correction coefficient B_map;
[0171] Step 6.5, determine the entropy of the two-dimensional histogram corresponding to each of the eight light sources, and determine eight entropies.
[0172] Step 6.6, sort the eight entropies, determine the three entropies at the end with the minimum value in the sorting, and determine that the three light sources corresponding to these three entropies are D65, A, and F11 respectively.
[0173] Step 6.7, perform parabola fitting according to the sorting, determine the parabola, and determine the first weight of the light source corresponding to each of the M entropies according to the parabola. Exemplarily:
[0174] Determine the weight of D65 as D65_ratio;
[0175] Determine the weight of A as A_ratio;
[0176] Determine the weight of F11 as F11_ratio.
[0177] Step 7, for light source A in the fourth interval, select the light sources with the same light source attributes as light source A from light sources D65, A, and F11. For example: light source D65 has an infrared light component, light source A has an infrared light component, and light source F11 does not have an infrared light component. Thus, 2 light sources are selected: D65 and A. Take the sum of the first weights corresponding to each of these two light sources as the second weight of light source A. Then: ratio_A = D65_ratio + A_ratio.
[0178] Since the sum of the second weights of all light sources corresponding to each reference color temperature interval is 1, determine the second weight of light source F12 in the fourth interval as 1 - ratio_A.
[0179] For light source F2 in the fifth interval, select the light sources with the same light source attributes as light source F2 from light sources D65, A, and F11. For example: light source D65 corresponds to a continuous spectrum, light source A corresponds to a continuous spectrum, and light source F11 corresponds to a narrow-band spectrum. Since F2 corresponds to a standard broadband spectrum, generally, continuous spectra and standard bandwidth spectra are classified into the same category, called non-narrow-band spectra. Thus, 2 light sources with the same light source attributes as F2 are selected from light sources D65, A, and F11: D65 and A. Take the sum of the first weights corresponding to each of these two light sources as the second weight of light source F2. Then: ratio_F2 = D65_ratio + A_ratio.
[0180] Since the sum of the second weights of all light sources corresponding to each reference color temperature interval is 1, determine the second weight of light source F11 in the fifth interval as 1 - ratio_F11.
[0181] Step 8, determine the CCM corresponding to the color temperature interval of a light source as the CCM of the corresponding light source. That is:
[0182] CCM_1 = CCM_D75;
[0183] CCM_2 = CCM_D65;
[0184] CCM_3 = CCM_D50;
[0185] CCM_6 = CCM_H.
[0186] Step 9, perform weighted processing on the color correction matrices of the light sources corresponding to the reference color temperature interval to obtain the CCM of the reference color temperature interval. For example:
[0187] The CCM of the fourth interval, i.e., CCM_4 = CCM_A * ratio_A + CCM_F12 * (1 - ratio_A)
[0188] The CCM of the fifth interval, i.e., CCM_5 = CCM_F2 * ratio_A + CCM_F11 * (1 - ratio_A)
[0189] Step 10: Perform linear interpolation based on the CCMs of each color temperature interval in the 6 color temperature intervals to obtain the final CCM, i.e., f_CCM. For example: Use CCM_1, CCM_2, CCM_3, CCM_4, CCM_5, and CCM_6 for linear interpolation to obtain a CCM, i.e., f_CCM.
[0190] Step 11: Use f_CCM for color correction.
[0191] An embodiment of the present disclosure provides a color correction device. Refer to Figure 3 , Figure 3 which is a structural diagram of a color correction device shown according to an exemplary embodiment. As Figure 3 shown, this device may include:
[0192] The first determination module 31 is configured to determine K color temperature intervals according to the color temperature of each light source among N light sources; wherein, the difference between the color temperatures of any two light sources in the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are positive integers greater than zero;
[0193] The second determination module 32 is configured to determine the CCM of each color temperature interval according to the color correction matrix CCM of the light source;
[0194] The interpolation module 33 is configured to perform linear interpolation based on the CCMs of each color temperature interval in the K color temperature intervals to obtain a final CCM;
[0195] The correction module 34 is configured to perform color correction using the final CCM.
[0196] An embodiment of the present disclosure provides a color correction device, including Figure 2 the modules shown, and:
[0197] The device further includes:
[0198] The third determination module is configured to determine T reference color temperature intervals from the K color temperature intervals; wherein, each reference color temperature interval in the T reference color temperature intervals corresponds to at least two light sources; wherein, T is less than or equal to N, and T is a positive integer greater than zero;
[0199] The second determination module is further configured to determine the CCM of each reference color temperature interval according to the CCM of the light source.
[0200] In one embodiment, the second determination module includes:
[0201] A selection unit, configured to determine, according to a light source estimation algorithm, M light sources among the N light sources that best match the current environment, and determine the first weight of each light source among the M light sources; where M is less than N, and M is a positive integer;
[0202] A calculation unit, configured to determine the second weight of each light source in each reference color temperature interval according to the first weight of each light source among the M light sources and the light source attributes;
[0203] A weighting unit, configured to use the second weight of each light source in each reference color temperature interval to perform a weighting process on the color correction matrix of each light source corresponding to the reference color temperature interval to obtain the CCM of the reference color temperature interval.
[0204] In one embodiment, the selection unit, configured to determine, according to a light source estimation algorithm, M light sources among the N light sources that best match the current environment, and determine the first weight of each light source among the M light sources, includes:
[0205] A first determination subunit, configured to determine an original image;
[0206] A second determination subunit, configured to determine a first ratio of a first color component to a third color component, and a second ratio of a second color component to the third color component in each set area of the original image;
[0207] A generation subunit, configured to generate a two-dimensional histogram corresponding to a first variable and a second variable according to a first correction coefficient of the first color component and a second correction coefficient of the second color component corresponding to each light source among the N light sources; where the first variable is a first function with the product of the first ratio and the first correction coefficient as an input parameter, and the second variable is a first function with the product of the second ratio and the second correction coefficient as an input parameter;
[0208] A third determination subunit, configured to determine the entropy of the two-dimensional histogram corresponding to each light source among the N light sources;
[0209] A fourth determination subunit, configured to determine M light sources that best match the current environment among the N light sources according to the N entropies, and the first weight of each light source among the M light sources.
[0210] In one embodiment, the fourth determination subunit is further configured to use the following method to determine M light sources that best match the current environment among the N light sources according to the N entropies, and the first weight of each light source among the M light sources:
[0211] Determine the sorting of the N entropies, and determine M entropies at the end with the minimum value in the sorting;
[0212] Perform a quadratic curve fitting according to the sorting, determine the quadratic curve, and determine the first weight of the light source corresponding to each of the M entropies according to the quadratic curve.
[0213] In one embodiment, the first weight of the light source corresponding to each of the M entropies is inversely proportional to the projection distance corresponding to the entropy, and the projection distance is the projection distance of the vector between the entropy and the vertex of the quadratic curve on the set coordinate axis.
[0214] An embodiment of the present disclosure provides a color correction device, including Figure 2 the modules shown, and:
[0215] The calculation unit is further configured to use the following method to determine the second weight of each light source in each reference color temperature interval according to the first weight of each light source among the M light sources and the light source attributes;
[0216] For a light source to be weighted in each reference color temperature interval, determine at least one light source among the M light sources that has the same light source attribute as the light source to be weighted, and use the sum of the first weights corresponding to each light source among the at least one light source as the second weight of the light source to be weighted;
[0217] Wherein, the sum of the second weights of all light sources corresponding to each reference color temperature interval is 1.
[0218] An embodiment of the present disclosure provides a color correction device, including Figure 2 the modules shown, and:
[0219] The second determination module 32 is further configured to use the following method to determine the CCM of each color temperature interval according to the color correction matrix CCM of the light source:
[0220] For the K-T color temperature intervals among the K color temperature intervals other than the T reference color temperature intervals, determine the CCM of each color temperature interval among the K-T color temperature intervals as the CCM of the light source corresponding to the color temperature interval.
[0221] An embodiment of the present disclosure provides a color correction device, including Figure 2 the modules shown, and:
[0222] The light source attributes include at least one of the following:
[0223] The light source has an infrared light component, and the spectrum of the light source corresponds to a narrowband spectrum.
[0224] An embodiment of the present disclosure provides a color correction device, applied to a terminal, including:
[0225] A processor;
[0226] A memory for storing processor-executable instructions;
[0227] Wherein, the processor is configured to execute the executable instructions in the memory to implement the steps of the color correction method.
[0228] An embodiment of the present disclosure provides a non-transitory computer-readable storage medium having executable instructions stored thereon, and when the executable instructions are executed by a processor, the steps of the color correction method are implemented.
[0229] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0230] Figure 4 It is a block diagram of a color correction device 400 shown according to an exemplary embodiment. For example, the device 400 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0231] Referring to Figure 4 , the device 400 may include one or more of the following components: a processing component 402, a memory 404, a power supply component 406, a multimedia component 408, an audio component 410, an input / output (I / O) interface 412, a sensor component 414, and a communication component 416.
[0232] The processing component 402 generally controls the overall operation of the device 400, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.
[0233] The memory 404 is configured to store various types of data to support the operation of the device 400. Examples of these data include instructions for any application or method operating on the device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.
[0234] The power supply component 406 provides power for various components of the device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 400.
[0235] The multimedia component 408 includes a screen that provides an output interface between the device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of the touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0236] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC) that is configured to receive external audio signals when the device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 404 or transmitted via the communication component 416. In some embodiments, the audio component 410 further includes a speaker for outputting audio signals.
[0237] The I / O interface 412 provides an interface between the processing component 402 and the peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a power button, and a lock button.
[0238] The sensor assembly 414 includes one or more sensors for providing an assessment of various aspects of the status of the device 400. For example, the sensor assembly 414 can detect the on / off state of the device 400, the relative positioning of components, such as the display and keypad of the device 400. The sensor assembly 414 can also detect a change in the position of the device 400 or a component of the device 400, the presence or absence of user contact with the device 400, the orientation or acceleration / deceleration of the device 400, and the temperature change of the device 400. The sensor assembly 414 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0239] The communication component 416 is configured to facilitate communication between the device 400 and other devices in a wired or wireless manner. The device 400 can access a wireless network based on communication standards, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0240] In an exemplary embodiment, the device 400 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described method.
[0241] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 404 including instructions, is also provided. The above instructions can be executed by the processor 420 of the device 400 to complete the above-described method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0242] Other embodiments of the examples in this disclosure will be readily contemplated by those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the examples in this disclosure, which follow the general principles of the examples in this disclosure and include known common knowledge or conventional technical means in this technical field not disclosed in the examples. The specification and examples are only to be considered exemplary, and the true scope and spirit of the examples of this disclosure are pointed out by the following claims.
[0243] It should be understood that the embodiments in this disclosure are not limited to the exact structures already described and shown in the drawings, and various combinations, substitutions, modifications, and changes can be made to the method steps or terminal components disclosed in this application without departing from its scope, and these combinations, substitutions, modifications, and changes are all considered to be included within the scope described in this disclosure. The scope of protection required by this disclosure is limited by the appended claims.
[0244] It should be noted that in this disclosure, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
Claims
1. A method for color correction, characterized in that, Including: Determine K color temperature intervals according to the color temperature of each of the N light sources; wherein, the color temperature interval is an interval range containing multiple color temperature values, and the difference between the color temperatures of any two light sources in the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are integers greater than zero; Determine the CCM corresponding to the color temperature interval according to the color correction matrices CCM of the respective light sources corresponding to each color temperature interval; wherein, the CCM of each color temperature interval is a CCM determined according to the CCMs of at least one light source corresponding to the color temperature interval; Perform linear interpolation according to the CCMs of the respective color temperature intervals in the K color temperature intervals to obtain a final CCM; Use the final CCM for color correction.
2. The method according to claim 1, characterized in that: The method further includes: Determine T reference color temperature intervals from the K color temperature intervals; wherein, each reference color temperature interval in the T reference color temperature intervals corresponds to at least two light sources; wherein, T is less than or equal to N, and T is an integer greater than zero; The determining the CCM corresponding to the color temperature interval according to the CCMs of the respective light sources corresponding to each color temperature interval includes: determining the CCM of each reference color temperature interval according to the CCMs of the light sources.
3. The method according to claim 2, characterized in that: The determining the CCM of each reference color temperature interval according to the CCMs of the light sources includes: Determine M light sources among the N light sources that are most matched to the current environment according to a light source estimation algorithm, and determine the first weights of the respective light sources among the M light sources; wherein, M is less than N, and M is an integer greater than zero; Determine the second weights of the respective light sources in each reference color temperature interval according to the first weights of the respective light sources among the M light sources and the light source attributes; Use the second weights of the respective light sources in each reference color temperature interval to perform weighted processing on the CCMs of the respective light sources corresponding to the reference color temperature interval to obtain the CCM of the reference color temperature interval.
4. The method according to claim 3, characterized in that: The determining M light sources among the N light sources that are most matched to the current environment according to a light source estimation algorithm and determining the first weights of the respective light sources among the M light sources includes: Determine an original image; Determine a first ratio of a first color component to a third color component and a second ratio of a second color component to a third color component in each set area in the original image; Generate a two-dimensional histogram corresponding to a first variable and a second variable according to a first correction coefficient of the first color component and a second correction coefficient of the second color component corresponding to each of the N light sources; wherein, the first variable is a first function with the product of the first ratio and the first correction coefficient as an input parameter, and the second variable is a first function with the product of the second ratio and the second correction coefficient as an input parameter; Determine the entropy of the two-dimensional histogram corresponding to each of the N light sources; Determine M light sources that are most matched to the current environment according to the N entropies, and the first weights of each of the M light sources.
5. The method according to claim 4, wherein: determining the M light sources that best match the current environment according to N entropies, and the first weight of each light source among the M light sources includes: determining the sorting of the N entropies according to the N entropies, and determining the M entropies at the end with the minimum value in the sorting; performing quadratic curve fitting according to the sorting to determine a quadratic curve, and determining the first weight of the light source corresponding to each entropy among the M entropies according to the quadratic curve.
6. The method according to claim 5, wherein: the first weight of the light source corresponding to each entropy among the M entropies is inversely proportional to the corresponding projection distance, and the projection distance is the projection distance of the vector between the entropy and the vertex of the quadratic curve on a set coordinate axis.
7. The method according to claim 3, wherein including: determining the second weight of each light source in each reference color temperature interval according to the first weight of each light source among the M light sources and the light source attributes, including: for a light source to be weighted in each reference color temperature interval, determining at least one light source among the M light sources that has the same light source attribute as the light source to be weighted, and taking the sum of the first weights corresponding to each light source among the at least one light source as the second weight of the light source to be weighted; wherein, the sum of the second weights of all light sources corresponding to each reference color temperature interval is 1.
8. The method according to claim 2, wherein including: determining the CCM corresponding to the color temperature interval according to the color correction matrix CCM of each light source corresponding to each color temperature interval, including: for the K - T color temperature intervals other than the T reference color temperature intervals among the K color temperature intervals, determining the CCM of each color temperature interval among the K - T color temperature intervals as the CCM of the light source corresponding to the color temperature interval.
9. The method according to claim 3, characterized in that including: the light source attributes include at least one of the following: the light source has an infrared light component, and the spectrum of the light source corresponds to a narrow - band spectrum.
10. A color correction device, characterized in that, including: a first determination module, configured to determine K color temperature intervals according to the color temperature of each light source among N light sources; wherein, the color temperature interval is an interval range containing multiple color temperature values, the difference between the color temperatures of any two light sources among the K color temperature intervals is less than a first threshold, and each color temperature interval corresponds to at least one light source; wherein, K is less than N, and both K and N are positive integers; a second determination module, configured to determine the CCM corresponding to the color temperature interval according to the color correction matrix CCM of each light source corresponding to each color temperature interval; wherein, the CCM of each color temperature interval is a CCM determined according to the CCM of at least one light source corresponding to the color temperature interval; an interpolation module, configured to perform linear interpolation according to the CCMs of each color temperature interval among the K color temperature intervals to obtain a final CCM; a correction module, configured to perform color correction using the final CCM.
11. The apparatus according to claim 10, wherein: the apparatus further includes: a third determination module, configured to determine T reference color temperature intervals from the K color temperature intervals; wherein, each reference color temperature interval among the T reference color temperature intervals corresponds to at least two light sources; wherein, T is less than or equal to N, and T is a positive integer; The second determination module is further configured to determine the CCM of each reference color temperature interval according to the CCM of the light source.
12. The apparatus according to claim 11, wherein the second determination module comprises: a selection unit, configured to determine, according to a light source estimation algorithm, M light sources among the N light sources that are most matched with the current environment, and determine first weights of the light sources among the M light sources; wherein M is less than N, and M is an integer greater than zero; a calculation unit, configured to determine second weights of the light sources in each reference color temperature interval according to the first weights of the light sources among the M light sources and the light source attributes; a weighting unit, configured to perform a weighting process on the color correction matrix of each light source corresponding to the reference color temperature interval by using the second weights of the light sources in each reference color temperature interval to obtain the CCM of the reference color temperature interval.
13. The apparatus according to claim 12, wherein the selection unit, configured to determine, according to a light source estimation algorithm, M light sources among the N light sources that are most matched with the current environment, and determine first weights of the light sources among the M light sources, comprises: a first determination subunit, configured to determine an original image; a second determination subunit, configured to determine a first ratio of a first color component to a third color component and a second ratio of a second color component to the third color component in each set region in the original image; a generation subunit, configured to generate a two-dimensional histogram corresponding to a first variable and a second variable according to a first correction coefficient of the first color component and a second correction coefficient of the second color component corresponding to each of the N light sources; wherein the first variable is a first function with a product of the first ratio and the first correction coefficient as an input parameter, and the second variable is a first function with a product of the second ratio and the second correction coefficient as an input parameter; a third determination subunit, configured to determine the entropy of the two-dimensional histogram corresponding to each of the N light sources; a fourth determination subunit, configured to determine M light sources that are most matched with the current environment among the N light sources according to the N entropies, and first weights of each of the M light sources.
14. The apparatus according to claim 13, wherein the fourth determination subunit is further configured to use the following method to determine M light sources that are most matched with the current environment among the N light sources according to the N entropies, and first weights of each of the M light sources: determine the sorting of the N entropies according to the N entropies, and determine M entropies at one end of the minimum value in the sorting; perform a quadratic curve fitting according to the sorting to determine a quadratic curve, and determine the first weights of the light sources corresponding to each of the M entropies according to the quadratic curve.
15. The apparatus according to claim 14, wherein the first weight of the light source corresponding to each of the M entropies is inversely proportional to the projection distance corresponding to the entropy, and the projection distance is the projection distance of the vector between the entropy and the vertex of the quadratic curve on a set coordinate axis.
16. The device according to claim 12, wherein comprises: the calculation unit is further configured to use the following method to determine the second weights of the light sources in each reference color temperature interval according to the first weights of the light sources among the M light sources and the light source attributes; For a light source to be weighted in each reference color temperature range, determine at least one light source among the M light sources that has the same light source attributes as the light source to be weighted, and use the sum of the first weights corresponding to each light source in the at least one light source as the second weight of the light source to be weighted; wherein, the sum of the second weights of all light sources corresponding to each reference color temperature range is 1.
17. The device according to claim 11, characterized in that, Including: A second determination module, further configured to use the following method to determine the CCM corresponding to each color temperature range according to the color correction matrix CCM of each light source corresponding to each color temperature range: For the K-T color temperature ranges among the K color temperature ranges other than the T reference color temperature ranges, determine the CCM of each color temperature range in the K-T color temperature ranges as the CCM of the corresponding light source of the color temperature range.
18. The device according to claim 12, characterized in that, Including: The light source attributes include at least one of the following: The light source has an infrared light component, and the spectrum of the light source corresponds to a narrowband spectrum.
19. A color correction device, applied to a terminal, characterized in that, Including: A processor; A memory for storing processor-executable instructions; wherein, the processor is configured to execute the executable instructions in the memory to implement the steps of the color correction method according to any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium having executable instructions stored thereon, characterized in that, When the executable instructions are executed by the processor, the steps of the color correction method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Color temperature detection method, color temperature detection device, computer readable storage medium and computer equipment
CN107959851A
Image adjustment method and device, electronic equipment and storage medium
CN112752023A