A color correction method, device, electronic equipment and storage medium

By acquiring image exposure information to calculate white balance gain and color temperature, and combining it with a preset color matrix for color correction, the problem of inaccurate image color reproduction under changes in light source and environment in existing technologies is solved, achieving highly accurate and fast adaptive color correction.

CN116233381BActive Publication Date: 2025-11-28ZHEJIANG UNIVIEW TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111452215.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-01
Publication Date
2025-11-28
Estimated Expiration
2041-12-01

AI Technical Summary

Technical Problem

Existing white balance correction methods have low accuracy in color reproduction under low ambient light or special light sources, making it difficult to adapt to color correction under different light sources and environments.

Method used

By acquiring the exposure information of the image, the target white balance gain, color temperature, and color rendering index are calculated. Combined with a preset color matrix list, color matrix selection and correction are performed. Different white balance strategies are adopted for different exposure information. Color rendering index and color temperature are introduced to perform color matrix directional selection to reduce color differences between light sources.

Benefits of technology

It improves the accuracy and adaptability of image color correction, ensures image color reproduction under different light sources and environments, reduces color differences between light sources, and improves the response efficiency and correction effect of the device during rapid startup.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116233381B_ABST
    Figure CN116233381B_ABST
Patent Text Reader

Abstract

The present disclosure provides a color correction method, device, electronic equipment and storage medium, wherein the method comprises: obtaining exposure information of a current frame image, and calculating target white balance gain, color temperature and color rendering index according to a white balance strategy corresponding to the exposure information; determining a target color matrix from a preset color matrix list according to the color temperature and the color rendering index; wherein the color matrix list records color matrices corresponding to different color temperatures and color rendering indexes; and performing color correction on the current frame image according to the target white balance gain and the target color matrix. In the present disclosure, different white balance gains are calculated by using different white balance strategies for images with different exposure information, which can ensure the accuracy of subsequent white balance; based on the calculated color temperature and color rendering index, color matrix directionality selection can be realized for light sources with the same color temperature and different spectra, color differences between light sources are reduced, and the accuracy of color correction can be further ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of security monitoring, and in particular, to a color correction method and device, an electronic device, and a storage medium. BACKGROUND

[0002] The color of the same object under different light sources is different, which is affected by the color temperature of the light source. Under a low color temperature light source, a white object is reddish, and under a high color temperature light source, a white object is bluish. The human eye can judge and identify the true color of the object according to the memory of the brain, so that the white object can still be white under outdoor sunny or cloudy days, morning or evening, indoor light or mixed light. However, the image sensor does not have the ability to correct the light as the human eye does, so it is necessary to do white balance to reduce the influence of external light sources on the true color of the object.

[0003] At present, the commonly used white balance correction method is the color temperature estimation method. However, the color restoration of the image collected under this correction method will be distorted under low ambient illumination or special light sources, resulting in low accuracy of color restoration. SUMMARY

[0004] The present disclosure provides a color correction method, device, electronic device, and storage medium to achieve the purpose of improving the accuracy of color restoration.

[0005] According to an aspect of the present disclosure, a color correction method is provided, comprising:

[0006] obtaining exposure information of a current frame image, and calculating a target white balance gain, a color temperature, and a color rendering index according to a white balance strategy corresponding to the exposure information;

[0007] determining a target color matrix from a preset color matrix list according to the color temperature and the color rendering index, wherein the color matrix list records color matrices corresponding to different color temperatures and color rendering indices;

[0008] performing color correction on the current frame image according to the target white balance gain and the target color matrix.

[0009] According to another aspect of the present disclosure, a color correction device is provided, comprising:

[0010] a calculation module configured to obtain exposure information of a current frame image, and calculate a target white balance gain, a color temperature, and a color rendering index according to a white balance strategy corresponding to the exposure information;

[0011] The color matrix selection module is configured to determine a target color matrix from a preset color matrix list according to the color temperature and the color rendering index, wherein the preset color matrix list records color matrices corresponding to different color temperatures and color rendering indices.

[0012] The correction module is configured to perform color correction on the current frame image according to the target white balance gain and the target color matrix.

[0013] According to another aspect of the present disclosure, an electronic device is provided, comprising:

[0014] at least one processor; and

[0015] a memory connected with the at least one processor in communication; wherein,

[0016] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the color correction method of any embodiment of the present disclosure.

[0017] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, the computer instructions being used to make a computer perform the color correction method of any embodiment of the present disclosure.

[0018] According to the technology of the present disclosure, different white balance strategies are adopted to calculate white balance gains for images with different exposure information, which can ensure the accuracy of subsequent white balance; based on the calculated color temperature and color rendering index, color matrix directional selection can be realized for light sources with the same color temperature and different spectra, color differences between light sources are reduced, and the accuracy of color correction can be further ensured.

[0019] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:

[0021] Figure 1 is a flowchart of a color correction method provided by an embodiment of the present disclosure;

[0022] Figure 2 is a flowchart of another color correction method provided by an embodiment of the present disclosure;

[0023] Figure 3 is a flowchart of another color correction method provided by an embodiment of the present disclosure;

[0024] Figure 4 is a logic flowchart of still another color correction method provided by an embodiment of the present disclosure;

[0025] Figure 5 is a structural schematic diagram of a color correction device provided by an embodiment of the present disclosure;

[0026] Figure 6 is a block diagram of an electronic device for implementing the color correction method of an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are provided to assist in a comprehensive understanding of the present disclosure, and should be considered as merely exemplary. Accordingly, those skilled in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, in the following description, descriptions of well-known functions and constructions are omitted for clarity and conciseness.

[0028] In an embodiment of the present disclosure, terms used in the present disclosure are explained for the convenience of understanding.

[0029] AWB is the English abbreviation of Automatic White Balance, i.e., automatic white balance. AWB is a very important concept in television photography technology, which produces with electronic image reproduction of true colors. The image presented by the image acquisition device is determined by factors such as environmental color temperature, lens, and properties of the components themselves, resulting in a color presented by the image that is inconsistent with the true color observed by the human eye. AWB processes the image presented by the image acquisition device, and restores the originally white object to white.

[0030] White area: the area range used to count the white point position in white balance.

[0031] Standard light source: refers to the standard light source specified by the International Commission on Illumination for the purpose of unifying color measurement. The standard light source is an artificial light source whose radiation is approximately the CIE standard illuminant. The standard illuminant refers to an illuminant that has the same or approximately the same relative spectral power distribution as that of daylight at a certain time.

[0032] Color temperature: the temperature of an absolute black body when the chrominance of a certain light source is the same as that of an absolute black body at a certain temperature, with the unit being K (Kelvin). Low color temperature light sources have a higher content of red radiation, and are referred to as "warm light sources". High color temperature light sources have a higher content of blue radiation, and are referred to as "cool light sources".

[0033] Correlated color temperature: the locus of color coordinates of the colors emitted by a black body at different temperatures is called the black body locus or Planckian locus. The spectral power distribution of many light sources differs considerably from that of a black body, and the color coordinates fall outside the black body locus. In this case, the temperature of the black body whose radiation most closely resembles the color of the light source at a certain temperature is chosen as the correlated color temperature of the light source.

[0034] Color rendering index: the degree to which a light source renders the true colors of an object is called the color rendering of the light source, and is determined by comparing the appearance of the object under the light source with that under a reference or standard light source of the same color temperature. When the light spectrum of the light source lacks or has very little of the dominant wave reflected by the object under the standard light source, the color difference will be obvious. The greater the color difference, the worse the color rendering of the light source for the color.

[0035] In the embodiments of the present disclosure, the inventor found that it is difficult to adapt to all scenes and environments in a white region of white balance in actual applications. When the actual environment is dark, the white points are relatively scattered, and the probability and accuracy of falling into the white region will greatly decrease, resulting in color deviation of white balance. The brightness of outdoor environment is often higher than that of indoor environment, and when the outdoor brightness is high, the color temperature is concentrated in the range of 4500K to 6500K. If the calculated color temperature is not in this range, color deviation is likely to occur. Based on this, a color correction method is proposed, which introduces exposure information and color rendering index into the calculation of white balance to ensure the accuracy of color correction. The overall flowchart of color correction is shown in the following embodiments.

[0036] Figure 1 A flowchart of a color correction method according to an embodiment of the present disclosure is shown in the following embodiment. The embodiment can be applied to the case where an image acquisition device (such as a network camera) performs color correction on a video frame image acquired by the device. The method can be performed by a color correction device, which is implemented in software and / or hardware and integrated on an electronic device, such as an image acquisition device.

[0037] Specifically, referring to Figure 1 , the flow of the color correction method is as follows:

[0038] S101, obtain the exposure information of the current frame image, and calculate the target white balance gain, color temperature and color rendering index according to the white balance strategy corresponding to the exposure information.

[0039] In the embodiments of the present disclosure, the current frame image can be any frame image acquired by the image acquisition device. The exposure information of the current frame image includes the exposure amount, which is used to represent the average brightness of the ambient light. The exposure information can be determined according to the hardware attribute information of the image acquisition device, wherein the hardware attribute information at least includes the aperture size, shutter speed and the sensitivity of the image acquisition device. For example, the exposure information can be determined according to the following formula: v +T v =Sv +E v , wherein A v represents the aperture size, T v represents the shutter speed, S v represents the sensitivity of the image acquisition device, E v represents the exposure amount. It should be noted that the above-mentioned manner of determining the image exposure information is only an example, and the image exposure information can also be determined by other manners, which is not limited here.

[0040] In the embodiments of the present disclosure, different exposure information corresponds to different white balance strategies, wherein different white balance strategies include different calculation methods of white balance gain, so that the white balance gain can be calculated according to the appropriate white balance strategy selected according to the exposure information, and the accuracy when color correction is performed based on the calculated white balance gain is ensured, so that the device applying the correction method can adapt to different scenes.

[0041] After obtaining the white balance gain, it can be converted into a color coordinate through a preset formula, and then the color temperature is obtained based on a color temperature calculation formula. For example, the color coordinate obtained through conversion is (x, y), and the formula of the color temperature is: CCT = -437*A 3 +3601*A 2 -6831*A+5517, wherein CCT is the relative color temperature, and A = (x-0.3320) / (y-0.1858).

[0042] The calculation method of the color rendering index of the light source is as follows: first, the color difference of different colors of the light source is calculated, and then a preset number of color differences are selected to calculate the color rendering index. To calculate the color difference, the chrominance data of the current video frame is converted into the 1964 uniform space coordinates, that is, RGB is converted into YUV and then converted into WUV. Optionally, the following formula is used:

[0043]

[0044] Further, assuming that the color rendering index of the reference light source is 100, the color difference of the same color block when illuminated by the current light source and the reference light source can be calculated according to the following formula:

[0045]

[0046] , wherein W0, U0, V0 are the reference values of the standard light source (black body for 5000K and below, typical daylight for 5000K and above) with the same or close color temperature, and Wi, Ui, Vi are the data converted from RGB to YUV and then to WUV.

[0047] Further, the color differences of the color blocks are sorted in descending order, and the first 8 color differences are selected to calculate the color rendering index, and the specific calculation formula is as follows: wherein i represents the color block sequence number of different colors.

[0048] S102, determining a target color matrix from a preset color matrix list according to the color temperature and the color rendering index.

[0049] wherein the preset color matrix list records the color matrix corresponding to different color temperatures and color rendering indexes. The construction process of the preset color matrix is exemplarily as follows: a plurality of image data (for example, RAW data) of a 24-color card under different light sources are collected, and each image data is compared with standard data to determine the corresponding color matrix. It should be noted that other ways can also be used for construction, which are not specifically limited here. Then, the preset color matrix list is constructed based on the color temperature, color rendering index and corresponding color matrix of each light source. Exemplarily, see Table 1, wherein R represents the color rendering index, ct represents the color temperature, and the value of each CCM (color matrix) in the table is different.

[0050] Table 1. Preset color matrix list

[0051]

[0052] After obtaining the color temperature and the color rendering index through S101, matching retrieval can be performed with Table 1, so as to find out the target color matrix matched therewith. If direct matching cannot be performed, the target color matrix can be determined according to the following implementation manner: after obtaining the color temperature and the color rendering index through S101, the target color temperature and the target display index similar to the color temperature and the color rendering index are found out from Table 1, that is, at least two combinations of the target color temperature and the target color rendering index are determined from the preset color matrix list, wherein the difference between the target color temperature and the calculated color temperature is less than a preset threshold, and the difference between the calculated color rendering index and the target color rendering index is less than a preset threshold. According to the combination of the target color temperature and the target color rendering index, at least two initial color matrices are selected from the preset color matrix list; the selected initial color matrices are subjected to interpolation operation to obtain the target color matrix. It should be noted that any interpolation manner can be used for calculation, which is not specifically limited here; and the target color matrix obtained through interpolation calculation can ensure the accuracy of the target color matrix, and further ensure the accuracy of subsequent color correction.

[0053] S103, performing color correction on the current frame image according to the target white balance gain and the target color matrix.

[0054] Optionally, the three primary color data of the current frame image are subjected to white balance processing based on the target white balance gain, and then the processed three primary color data are subjected to color correction by using the target color matrix.

[0055] In the scheme of the present disclosure, different white balance strategies are adopted to calculate the white balance gain for images with different exposure information, which can ensure the accuracy of subsequent white balance; based on the calculated color temperature and color rendering index, color matrix direction selection can be realized for light sources with the same color temperature and different spectra, which can reduce the color difference between light sources and further ensure the accuracy of color correction.

[0056] Figure 2 is a flowchart of another color correction method according to an embodiment of the present disclosure. The present embodiment refines the process of calculating the white balance gain based on the above-mentioned embodiments. Referring to Figure 2 , the specific process of the color correction method is as follows:

[0057] S201, divide the current frame image into a preset number of image blocks, and take each image block as a statistical point.

[0058] Optionally, the current frame image is uniformly divided into m*n image blocks, and the number of pixel points in each image block is equal, where m and n are preset values. It should be noted that the current frame image is divided into a plurality of image blocks according to the preset value, and each image block is taken as a statistical point, which avoids calculating the white balance gain of each pixel point in the subsequent process, thereby reducing the calculation amount and improving the processing efficiency.

[0059] S202, based on the white region distribution of different color temperature light sources and the white region distribution of different light sources with the same color temperature, determine the number of white points in the statistical point and the white point landing position.

[0060] In the present embodiment of the present disclosure, the preset white region distribution of different color temperature light sources is drawn in a coordinate system with R / G and B / G as axes. The specific drawing process is as follows: collect image data under multiple different color temperatures, and calculate the mean value of color data R, G and B of each image, and then calculate the corresponding R / G and B / G of each image according to the mean value of R, G and B of each image. In this way, each color temperature corresponds to a set of R / G and B / G. Further, the blackbody curve is obtained through fitting operation, and then the white region distribution is drawn based on the blackbody curve.

[0061] When determining the white point (i.e., the point corresponding to the actual color of the object being white) in each statistical point (i.e., image block) based on the white region distribution of different color temperature light sources, the mean value of R, G and B data in the image block is calculated, and then R / G and B / G are calculated. Then, it is judged whether the coordinates (R / G, B / G) fall within the white region. If yes, the image block is a white point, and the white point landing position is the gain coordinates (R / G, B / G) of the color block.

[0062] The preset white region distribution of the same color temperature and different light sources is plotted in a coordinate system with color temperature x and display index y as axes. When determining the white point (i.e., a point corresponding to an actual color of an object being white) in a statistical point (i.e., an image block) based on the white region distribution of the same color temperature and different light sources, the color temperature and the color rendering index of the image block are calculated, and it is determined whether the color block is located in the white region.

[0063] In the embodiments of the present disclosure, the white points included in the current frame image are determined by using the white region distributions of the two coordinate systems respectively, and then the final number of white points and the falling positions of the white points are obtained by means of intersection, so as to ensure the accuracy of the obtained white points.

[0064] S203, exposure information of the current frame image is obtained.

[0065] In the embodiments of the present disclosure, two exposure thresholds (i.e., a first threshold Ev_low and a second threshold Ev_high, and the first threshold is smaller than the second threshold) are set, and then the target white balance gain is calculated according to S204, S205, or S206 according to the relationship between the exposure amount included in the exposure information and the threshold.

[0066] S204, if the exposure amount included in the exposure information is smaller than the first threshold, the mean value of the white balance gains of all statistical points is taken as the target white balance gain.

[0067] In the embodiments of the present disclosure, if the exposure amount Ev is smaller than the first threshold, it indicates that the ambient illuminance is low, and at this time, the target white balance gain can be determined by means of averaging to ensure the accuracy of the calculated gain.

[0068] For example, the target white balance gain can be calculated according to the following formula:

[0069] Wherein, m and n are values set when the current frame image is divided, WBGain ij WBGain represents the white balance gain of the image block in the i-th row and the j-th column, that is, the falling position of the image block in the coordinate system with R / G and B / G as axes. WBGain is the target white balance gain obtained.

[0070] S205, if the exposure amount included in the exposure information is greater than the second threshold, the target white balance gain is calculated according to the white balance gain of each white point, the number of white points, the weight of the color temperature influence factor of the white point, the weight of the ambient brightness influence factor of the white point, the distance influence factor weight of the white point and the black body curve, and the distance influence factor weight of the white point and the standard light source point.

[0071] The white balance gain of the white point can be determined according to the white point position, and the number of white points can be determined through S202. When the exposure amount is greater than the threshold value Ev_high, the weight of the intermediate color temperature is given to be high, which affects the final white balance result. In the specific implementation, a color temperature influence factor weight is introduced. It should be noted that, in order to ensure the accuracy of the calculation of the target white balance gain, an environmental brightness influence factor weight of the white point, a distance influence factor weight of the white point and the blackbody curve, and a distance influence factor weight of the white point and the standard light source point are also introduced.

[0072] Exemplarily, the following formula can be used for calculation:

[0073]

[0074] wherein WBGain ij represents the white balance gain of each white point, p and q represent the positions of the image blocks of the white points, and num is the number of white points; Pct k is the color temperature influence factor weight of the white point; PEv ij is the environmental brightness influence factor weight of the white point, and the higher the brightness, the greater the weight; Pdis ij is the distance influence factor weight of the white point and the blackbody curve, and the farther the distance from the blackbody curve, the smaller the weight; Pcr ij is the distance influence factor weight of the white point and the standard light source point, and the farther the distance, the smaller the weight.

[0075] S206, if the exposure amount included in the exposure information is between the first threshold value and the second threshold value, the target white balance gain is calculated according to the white balance gain of each white point, the number of white points, the environmental brightness influence factor weight of the white point, the distance influence factor weight of the white point and the blackbody curve, and the distance influence factor weight of the white point and the standard light source point.

[0076] Exemplarily, the following formula can be used for calculation:

[0077]

[0078] wherein WBGain ij represents the white balance gain of each white point, p and q represent the positions of the image blocks of the white points, and num is the number of white points; PEv ij is the environmental brightness influence factor weight of the white point, and the higher the brightness, the greater the weight; Pdis ij is the distance influence factor weight of the white point and the blackbody curve, and the farther the distance from the blackbody curve, the smaller the weight; Pcr ij is the distance influence factor weight of the white point and the standard light source point, and the farther the distance, the smaller the weight.

[0079] S207, the color temperature is calculated according to the target white balance gain, and the color rendering index is calculated.

[0080] S208. Determine the target color matrix from the preset color matrix list based on the color temperature and color rendering index. The preset color matrix list records the color matrices corresponding to different color temperatures and color rendering indices.

[0081] S209. Perform color correction on the current frame image based on the target white balance gain and the target color matrix.

[0082] In this embodiment of the disclosure, white balance gain is calculated according to different strategies for different exposure levels, making the method adaptable to various scenarios; moreover, various influencing factor weights are introduced in the process of calculating the target white balance gain to ensure the accuracy of the target white balance gain.

[0083] With technological advancements, the demands for image quality and startup time in the initial state of a camera are gradually increasing. This is especially true for low-power battery-operated products requiring rapid image output; once the device is operational, it needs to quickly deliver stable image quality. Based on this, a color correction method according to an embodiment of this disclosure is proposed, see [link to relevant documentation]. Figure 3 The specific process of color correction is as follows:

[0084] S301. If the current frame image is the first frame image acquired, then select the preset white balance gain and preset color matrix corresponding to the exposure information from the preset gain table according to the exposure information of the current frame.

[0085] S302. Perform color correction on the first frame image according to the preset white balance gain and preset color matrix.

[0086] When the device starts up at high speed, it also needs to respond quickly to white balance information. At this time, prior information (i.e., preset gain table) is used to select the closest white balance gain and color matrix for correction based on exposure information and statistical information (i.e. image color data), so that the effect of the first frame is more accurate.

[0087] The construction process of the preset gain table is as follows: Step 1: Assuming the exposure is Ev, the color rendering index is Ra, the color temperature is CCT, the white balance gain is RGain, BGain, and the type of light source (e.g., lamp) is represented by i, build a sealed and stable environment so that the camera is pointed at the 24-color chart. Step 2: Collect RAW data under the following conditions: in a dark environment with an ambient brightness of Ev_low, under commonly used indoor lighting with an ambient brightness of Ev_mid, and outdoors on a sunny midday with an ambient brightness of Ev_high. The RAW data must meet the requirement that the 19 color patches are 0.8*2 kk is RAW data bit depth. Step 3: Calculate the average of RGain and BGain of 19-23 color blocks on three groups of statistics RAW as the initial white balance gain, and calculate the ambient brightness and white balance gain information corresponding table. Wherein, the light source can be commonly used light source, such as sodium lamp, incandescent lamp, warm light lamp, etc. Step 4: according to the parameters obtained in step 3, the preset gain table of exposure information, light source and white balance parameter is constructed, as follows:

[0088] Ambient light White balance gain Color correction matrix EV_low Rgain i1, Bgain i1 CCM1 Ev_mid Rgain i2, Bgain i2 CCM2 Ev_high Rgain i3, Bgain i3 CCM3

[0089] S303, obtain the exposure information of the current frame image, and calculate the target white balance gain, color temperature and color rendering index according to the white balance strategy corresponding to the exposure information.

[0090] In the embodiment of the present disclosure, the current frame image is any video frame except the first frame.

[0091] S304, determining the target color matrix from the preset color matrix list according to the color temperature and color rendering index.

[0092] The preset color matrix list records the color matrix corresponding to different color temperatures and color rendering indexes.

[0093] S305, color correcting the current frame image according to the target white balance gain and the target color matrix.

[0094] In the embodiment of the present disclosure, by constructing the preset gain table in advance, when the device starts at a high speed, the first frame is quickly corrected by using the corresponding white balance gain and color matrix in the gain table, reducing the calculation process of the color matrix and the white balance gain required for the first frame, ensuring the response efficiency, and ensuring that the correction effect of the first frame meets the demand without large deviation.

[0095] Figure 4 is a flowchart of another color correction method according to the embodiment of the present disclosure, which is optimized on the basis of the above-mentioned embodiment. Referring to Figure 4 , the specific process of the color correction method is as follows:

[0096] S401, obtaining the exposure information of the current frame image, and calculating the target white balance gain, color temperature and color rendering index according to the white balance strategy corresponding to the exposure information.

[0097] S402, determining the target color matrix from the preset color matrix list according to the color temperature and color rendering index.

[0098] The preset color matrix list records the color matrix corresponding to different color temperatures and color rendering indexes.

[0099] In the embodiments of the present disclosure, in order to ensure that the device performs color correction quickly and stably and avoid color mutation between adjacent video frames, the target white balance gain needs to be adjusted according to the steps S403-S405 before color correction.

[0100] S403, calculate a color temperature difference value and a color rendering index difference value between the previous frame image and the current frame image.

[0101] S404, determine a gain adjustment coefficient according to the color temperature difference value and the color rendering index difference value.

[0102] The calculation process of the color temperature and the color rendering index of each frame image can refer to the above embodiments, which will not be described here. After the color temperature difference value and the color rendering index difference value between the previous frame image and the current frame image are obtained, if the difference value is greater than a preset threshold, a large gain adjustment coefficient needs to be adjusted, for example; otherwise, if the difference value is less than another preset threshold, a small gain adjustment coefficient can be adjusted.

[0103] S405, adjust the target white balance gain according to the gain adjustment coefficient and the white balance gain of the previous frame image.

[0104] In an optional implementation, the adjustment can be performed according to the following formula:

[0105] WBgain 新 =(1-DampFactor)*WBgain i-1 +DamFactor*WBgain i ;

[0106] Wherein, DampFactor is the determined gain adjustment coefficient, WBgain i is the calculated target white balance gain of the current frame; WBgain i-1 is the calculated white balance gain of the previous frame; and WBgain 新 is the adjusted white balance gain.

[0107] S406, perform color correction on the current frame image according to the adjusted target white balance gain and the target color matrix.

[0108] In the embodiments of the present disclosure, by adjusting the target white balance gain, the situation that the image style difference is large due to color mutation between adjacent frames can be avoided, and the color correction effect is ensured.

[0109] Figure 5 is a structural schematic diagram of a color correction device according to the embodiments of the present disclosure. The present embodiment can be applicable to the case that an image acquisition device (for example, a network camera) performs color correction on the collected video frame image. As shown in FIG. 1, the color correction device includes a color temperature calculation unit 101, a color rendering index calculation unit 102, a color temperature difference calculation unit 103, a color rendering index difference calculation unit 104, a gain adjustment coefficient determination unit 105, a target white balance gain adjustment unit 106, and a color correction unit 107. Figure 5As shown, the device specifically includes:

[0110] The computing module 501 is configured to acquire exposure information of a current frame image, and calculate target white balance gain, color temperature and color rendering index according to a white balance strategy corresponding to the exposure information;

[0111] The color matrix selection module 502 is configured to determine a target color matrix from a preset color matrix list according to the color temperature and the color rendering index, wherein the color matrix list records color matrices corresponding to different color temperatures and color rendering indexes;

[0112] The correction module 503 is configured to perform color correction on the current frame image according to the target white balance gain and the target color matrix.

[0113] On the basis of the above-mentioned embodiments, the device further includes:

[0114] The segmentation module is configured to segment the current frame image into a preset number of image blocks, and take each image block as a statistical point;

[0115] The white point determination module is configured to determine the number of white points and the white point position in the statistical points based on preset white region distributions of different color temperature light sources and white region distributions of different light sources with the same color temperature.

[0116] On the basis of the above-mentioned embodiments, the computing module includes:

[0117] The first calculation unit is configured to, if the exposure amount included in the exposure information is less than a first threshold value, take the mean value of the white balance gains of all statistical points as the target white balance gain; or,

[0118] The second calculation unit is configured to, if the exposure amount included in the exposure information is greater than a second threshold value, calculate the target white balance gain according to the white balance gain of each white point, the number of white points, the influence factor weight of color temperature on white points, the influence factor weight of environmental brightness on white points, the distance influence factor weight of white points and blackbody curve, and the distance influence factor weight of white points and standard light source points; or,

[0119] The third calculation unit is configured to, if the exposure amount included in the exposure information is between the first threshold value and the second threshold value, calculate the target white balance gain according to the white balance gain of each white point, the number of white points, the influence factor weight of environmental brightness on white points, the distance influence factor weight of white points and blackbody curve, and the distance influence factor weight of white points and standard light source points.

[0120] On the basis of the above-mentioned embodiments, the color matrix selection module is specifically configured to:

[0121] Based on the color temperature and color rendering index, determine at least two combinations of target color temperature and target color rendering index from the preset color matrix list;

[0122] Based on the combination of the target color temperature and the target color rendering index, at least two initial color matrices are selected from the preset color matrix list;

[0123] The target color matrix is ​​obtained by performing interpolation on the initial color matrix.

[0124] In addition to the above embodiments, optionally, the following further includes:

[0125] The acquisition module is used to select the preset white balance gain and preset color matrix corresponding to the exposure information from the preset gain table if the current frame image is the first frame image acquired.

[0126] The first frame correction module is used to perform color correction on the first frame image based on the preset white balance gain and the preset color matrix.

[0127] In addition to the above embodiments, optionally, the following further includes:

[0128] The difference calculation module is used to calculate the color temperature difference and color rendering index difference between the previous frame image and the current frame image;

[0129] The coefficient determination module is used to determine the gain adjustment coefficient based on the color temperature difference and the color rendering index difference.

[0130] The adjustment module is used to adjust the target white balance gain according to the gain adjustment coefficient and the white balance gain of the previous frame image.

[0131] The apparatus provided in this disclosure can execute the color correction method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the color correction method. Content not described in detail in this embodiment can be referred to the description in any method embodiment of this disclosure.

[0132] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. In this embodiment, the electronic device is exemplarily a network camera. Figure 6 The structure shown in this embodiment of the electronic device includes: one or more processors 602 and a memory 601; the processors 602 in the electronic device may be one or more. Figure 6 Taking a processor 602 as an example; memory 601 is used to store one or more programs; one or more programs are executed by one or more processors 602, causing one or more processors 602 to implement the color correction method as described in any of the embodiments of this disclosure.

[0133] The electronic device can further include an input device 603 and an output device 604.

[0134] The processor 602, the memory 601, the input device 603, and the output device 604 in the electronic device can be connected by a bus or other means, Figure 6 For example, by a bus connection.

[0135] The memory 601 in the electronic device, as a kind of computer readable storage medium, can be used to store one or more programs, which can be software programs, computer executable programs and modules. The processor 602 executes various functions of the electronic device and data processing by running the software programs, instructions and modules stored in the memory 601, that is, realizes the color correction method in the above method embodiment.

[0136] The memory 601 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function; the data storage area can store data created according to the use of the electronic device, etc. In addition, the memory 601 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state memory device. In some examples, the memory 601 can further include a memory remotely arranged with respect to the processor 602, which can be connected to the device through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0137] The input device 603 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device. The output device 604 can include a display device such as a display screen.

[0138] And when the above electronic device includes one or more programs executed by one or more processors 602, the program performs the following operations:

[0139] Obtain the exposure information of the current frame image, and calculate the target white balance gain, color temperature and color rendering index according to the white balance strategy corresponding to the exposure information;

[0140] According to the color temperature and the color rendering index, determine the target color matrix from the preset color matrix list; wherein the preset color matrix list records the color matrix corresponding to different color temperature and color rendering index;

[0141] According to the target white balance gain and the target color matrix, the current frame image is color corrected.

[0142] Of course, those skilled in the art can understand that when one or more programs included in the above electronic device are executed by one or more processors, the programs can also perform the related operations in the color correction method provided in any embodiment of the present disclosure.

[0143] In one embodiment of the present disclosure, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to perform a color correction method, and the method comprises:

[0144] Exposure information of a current frame image is acquired, and target white balance gain, color temperature and color rendering index are calculated according to a white balance strategy corresponding to the exposure information;

[0145] A target color matrix is determined from a preset color matrix list according to the color temperature and the color rendering index, wherein the color matrix list records color matrices corresponding to different color temperatures and color rendering indexes;

[0146] The current frame image is color corrected according to the target white balance gain and the target color matrix.

[0147] The computer storage medium of the embodiment of the present disclosure can adopt any combination of one or more computer readable media. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may, for example, be but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples (non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read only memory (ROM), an erasable programmable read only memory (EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component.

[0148] A computer readable signal medium can include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal can take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium can be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport program code there within for use by or in connection with an instruction execution system, apparatus, or device.

[0149] Program code embodied on a computer readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0150] Computer program code for carrying out operations for aspects of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0151] Note that the foregoing are merely preferred embodiments of the present disclosure and the principles of the technology applied. It will be understood by those skilled in the art that the present disclosure is not limited to the specific embodiments described herein, and that various obvious changes, reconfigurations and substitutions can be made by those skilled in the art without departing from the scope of the present disclosure. Therefore, although the present disclosure has been described in detail through the above embodiments, the present disclosure is not limited to the above embodiments only, and can include more other equivalent embodiments without departing from the concept of the present disclosure, and the scope of the present disclosure is determined by the scope of the claims.

Claims

1. A color correction method, characterized in that, include: Obtain the exposure information of the current frame image, and calculate the target white balance gain, color temperature, and color rendering index according to the white balance strategy corresponding to the exposure information; Based on the color temperature and color rendering index, a target color matrix is ​​determined from a preset color matrix list; wherein, the preset color matrix list records color matrices corresponding to different color temperatures and color rendering indices; The current frame image is color corrected based on the target white balance gain and the target color matrix; The method further includes: dividing the current frame image into a preset number of image blocks, and taking each image block as a statistical point; determining the number of white points and the location of white points in the statistical points based on the preset white area distribution of different color temperature light sources and the white area distribution of different light sources with the same color temperature; The step of calculating the target white balance gain based on the white balance strategy corresponding to the exposure information includes: If the exposure amount included in the exposure information is less than the first threshold, then the average white balance gain of all statistical points is taken as the target white balance gain. If the exposure information includes an exposure amount greater than the second threshold, the target white balance gain is calculated based on the white balance gain of each white point, the number of white points, the influence factor weight of color temperature on white points, the influence factor weight of ambient brightness on white points, the influence factor weight of the distance between white points and the blackbody curve, and the influence factor weight of the distance between white points and the standard light source point. If the exposure information includes an exposure amount between the first threshold and the second threshold, the target white balance gain is calculated based on the white balance gain of each white point, the number of white points, the influence factor weight of ambient brightness on the white points, the influence factor weight of the distance between the white points and the blackbody curve, and the influence factor weight of the distance between the white points and the standard light source point.

2. The method according to claim 1, characterized in that, Based on the color temperature and color rendering index, the target color matrix is ​​determined from the preset color matrix list, including: Based on the color temperature and color rendering index, determine at least two combinations of target color temperature and target color rendering index from the preset color matrix list; Based on the combination of the target color temperature and the target color rendering index, at least two initial color matrices are selected from the preset color matrix list; The target color matrix is ​​obtained by performing interpolation on the initial color matrix.

3. The method according to claim 1, characterized in that, Also includes: If the current frame image is the first frame image acquired, then the preset white balance gain and preset color matrix corresponding to the exposure information are selected from the preset gain table according to the exposure information of the current frame; The first frame image is color corrected based on the preset white balance gain and preset color matrix.

4. The method according to claim 1, characterized in that, Before performing color correction on the current frame image based on the white balance gain and the target color matrix, the method further includes: Calculate the color temperature difference and color rendering index difference between the previous frame and the current frame; The gain adjustment coefficient is determined based on the color temperature difference and the color rendering index difference. The target white balance gain is adjusted based on the gain adjustment coefficient and the white balance gain of the previous frame image.

5. A color correction device, characterized in that, include: The calculation module is used to obtain the exposure information of the current frame image and calculate the target white balance gain, color temperature and color rendering index according to the white balance strategy corresponding to the exposure information. The color matrix selection module is used to determine the target color matrix from a preset color matrix list based on the color temperature and color rendering index; wherein, the preset color matrix list records the color matrices corresponding to different color temperatures and color rendering indices; The correction module is used to perform color correction on the current frame image based on the target white balance gain and the target color matrix; The device further includes: The segmentation module is used to segment the current frame image into a preset number of image blocks, and to treat each image block as a statistical point; The white point determination module is used to determine the number of white points and the location of white points in the statistical points based on the white area distribution of preset light sources with different color temperatures and the white area distribution of light sources with the same color temperature but different color temperatures. The computing module includes: The first calculation unit is used to take the average of the white balance gains of all statistical points as the target white balance gain if the exposure amount included in the exposure information is less than the first threshold. The second calculation unit is used to calculate the target white balance gain based on the white balance gain of each white point, the number of white points, the influence factor weight of color temperature on white points, the influence factor weight of ambient brightness on white points, the influence factor weight of the distance between white points and the blackbody curve, and the influence factor weight of the distance between white points and the standard light source point if the exposure amount included in the exposure information is greater than the second threshold. The third calculation unit is used to calculate the target white balance gain based on the white balance gain of each white point, the number of white points, the influence factor weight of ambient brightness on the white points, the influence factor weight of the distance between the white points and the blackbody curve, and the influence factor weight of the distance between the white points and the standard light source point if the exposure amount included in the exposure information is between the first threshold and the second threshold.

6. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.

7. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Image sensor apparatus and method for color correction with an illuminant-dependent color correction matrix

    CN101939997A

  • White balance processing method and device, mobile terminal, and storage medium

    CN108024055A