CN116233381A - Color correction method and device, electronic equipment and storage medium - Google Patents

Color correction method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116233381A
CN116233381A CN202111452215.3A CN202111452215A CN116233381A CN 116233381 A CN116233381 A CN 116233381A CN 202111452215 A CN202111452215 A CN 202111452215A CN 116233381 A CN116233381 A CN 116233381A
Authority
CN
China
Prior art keywords
color
white balance
white
target
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111452215.3A
Other languages
Chinese (zh)
Inventor
王玉波
杨颖青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN202111452215.3A priority Critical patent/CN116233381A/en
Publication of CN116233381A publication Critical patent/CN116233381A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The present disclosure provides a color correction method, apparatus, electronic device, and storage medium, wherein the method includes: acquiring 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, color matrixes corresponding to different color temperatures and color rendering indexes are recorded in a preset color matrix list; and performing color correction on the current frame image according to the target white balance gain and the target color matrix. In the scheme, different white balance strategies are adopted to calculate the white balance gain aiming at images with different exposure information, so that the accuracy of the subsequent white balance can be ensured; based on the calculated color temperature and color rendering index, the color matrix directivity selection can be realized for the light sources with the same color temperature and different spectrums, the color difference between the light sources is reduced, and the color correction accuracy can be further ensured.

Description

Color correction method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the field of security monitoring, and in particular relates to a color correction method, a device, electronic equipment and a storage medium.
Background
The color of the same object under the irradiation of different light sources is different and is influenced by the color temperature of the light sources. Under the low-color temperature light source, the white object is reddish, under the high-color temperature light source, the white object is bluish, and the human eyes can recognize the true color of the object according to the memory judgment of the brain, so that the white object which can be seen by the human eyes is still white no matter under the outdoor clear day or cloudy day, early or evening or indoor lamplight or mixed light source. However, the image sensor has no means to have such a capability of self-correcting light as human eyes, so white balance is required to reduce the influence of external light sources on the true color of the object.
Currently, a common correction method for white balance is a color temperature estimation method. However, this correction method may distort color reproduction of the captured image at low ambient illuminance or under special light source, resulting in low accuracy of color reproduction.
Disclosure of Invention
The disclosure provides a color correction method, a device, an electronic device and a storage medium, so as to achieve the purpose of improving the accuracy of color restoration.
According to an aspect of the present disclosure, there is provided a color correction method including:
acquiring 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;
determining 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 matrixes 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.
According to another aspect of the present disclosure, there is provided a color correction apparatus including:
the computing module is used for acquiring exposure information of the current frame image and computing target white balance gain, color temperature and color rendering index according to a white balance strategy corresponding to the exposure information;
the color matrix selection module is used for determining 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 matrixes corresponding to different color temperatures and color rendering indexes;
and the correction module is used for carrying out color correction on the current frame image according to the target white balance gain and the target color matrix.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the color correction method of any of the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the color correction method of any embodiment of the present disclosure.
According to the technology disclosed by the invention, different white balance strategies are adopted to calculate the white balance gain aiming at images with different exposure information, so that the accuracy of the subsequent white balance can be ensured; based on the calculated color temperature and color rendering index, the color matrix directivity selection can be realized for the light sources with the same color temperature and different spectrums, the color difference between the light sources is reduced, and the color correction accuracy can be further ensured.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a flow chart of a color correction method provided by an embodiment of the present disclosure;
FIG. 2 is a flow chart of yet another color correction method provided by an embodiment of the present disclosure;
FIG. 3 is a flow chart of another color correction method provided by an embodiment of the present disclosure;
FIG. 4 is a logic flow diagram of yet another color correction method provided by an embodiment of the present disclosure;
fig. 5 is a schematic structural view of a color correction device according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device for implementing a color correction method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill 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, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the embodiments of the present disclosure, terms used in the present disclosure are explained for ease of understanding.
AWB is an english abbreviation for Automatic White Balance, automatic white balance. AWB is a very important concept in the tv photography technology, and is generated as an electronic image reproduces a real color. The image presented by the image acquisition equipment is determined by factors such as the ambient color temperature, the lens, the nature of components and parts, and the like, so that the color presented by the image is inconsistent with the true color observed by human eyes. The AWB processes the image presented by the image acquisition equipment and restores the originally white object to white.
White area: the white balance is used to count the range of the white point falling position.
Standard light source: the standard light source is defined by the international commission on illumination for uniform color measurement, and the standard light source is an artificial light source with radiation similar to that of a CIE standard illuminant. A standard illuminant refers to an illuminant having the same or approximately the same relative spectral power distribution as daylight at a certain moment.
Color temperature: the temperature of an absolute black body when the chromaticity of a certain light source is the same as the chromaticity of the absolute black body at a certain temperature is given in K (kelvin). The low color temperature light source has a high content of red radiation and is called a "warm color light source". The high color temperature light source has a high content of blue radiation and is called "cold color light source".
Correlated color temperature: the locus formed by the color coordinates of the color represented by the black body at different temperatures becomes the black body locus or the Planckian locus, and the spectrum distribution power of many light sources is far different from that of the black body, so that the color coordinates fall outside the black body locus, and in this case, the radiation temperature corresponding to the black body with the closest color to the light source at a certain temperature is selected to become the correlated color temperature of the light source.
Color rendering index: the degree to which a light source appears to the true color of an object is referred to as the color rendering of the light source by comparison with the apparent color of the object under a reference or baseline light source of the same color temperature. When there is little or no dominant light reflected by the object under the reference light source in the light source spectrum, significant color differences are created in the color. The greater the degree of chromatic aberration, the poorer the color rendering of the color by the light source.
In the embodiment of the disclosure, the inventor finds that a white area of white balance in actual application is difficult to adapt to all scenes and environments, when the actual environment is darker, white spots are scattered, the probability and accuracy of falling into the white area are greatly reduced, and white balance color cast is caused; the outdoor luminance tends to be brighter than the indoor environment, and when the outdoor luminance is large, the color temperature is concentrated in 4500K to 6500K, and if the calculated color temperature is not in this range, a color cast phenomenon is likely to occur. Based on this, a color correction method is proposed, in which exposure information and color rendering index are introduced into the calculation of white balance to ensure the accuracy of color correction. See the following examples for an overall flow chart of color correction.
Fig. 1 is a flowchart of a color correction method according to an embodiment of the present disclosure, where the embodiment is applicable to a case where an image capturing device (e.g., a webcam) performs color correction on a captured video frame image. The method may be performed by a color correction device implemented in software and/or hardware and integrated on an electronic device, for example on an image acquisition device.
Specifically, referring to fig. 1, the color correction method is as follows:
s101, acquiring 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.
In the embodiment of the disclosure, the current frame image is optionally any frame image acquired by the image acquisition device. The exposure information of the current frame image includes an exposure amount for representing the average brightness of the ambient light. The exposure information may be determined based on hardware attribute information of the image capturing apparatus, wherein the hardware attribute information includes at least a size of an aperture, a shutter speed, and a sensitivity of the image capturing apparatus. By way of example, exposure information may be determined according to the following formula: a is that v +T v =S v +E v Wherein A is v Represents the aperture size, T v Indicating the shutter speed, S v Representing the sensitivity of the image-capturing device, E v Indicating the exposure. The above-mentioned manner of determining the image exposure information is merely an example, and may be determined by other manners, which are not particularly limited herein.
In the embodiment of the disclosure, different exposure information corresponds to different white balance strategies, wherein the different white balance strategies comprise different white balance gain calculation methods, so that the white balance gain can be calculated by selecting a proper white balance strategy according to the exposure information, and further, the accuracy in the subsequent color correction based on the calculated white balance gain is ensured, so that equipment applying the correction method can adapt to different scenes.
After the white balance gain is obtained, the white balance gain can be converted into color coordinates through a preset formula, and then the color temperature is obtained based on a color temperature calculation formula. Illustratively, the color coordinates obtained by the conversion are (x, y), the formula of the color temperature: cct= -437 a 3 +3601*A 2 -6831 x a+5517, wherein CCT is the relative color temperature, a= (x-0.3320)/(y-0.1858).
The color rendering index calculation method of the light source is as follows: firstly, calculating the chromatic aberration of different colors of the light source, and then selecting a preset number of chromatic aberration to calculate the color rendering index. To calculate the color difference, the chrominance data of the current video frame is converted into 1964 the same spatial coordinates, that is, RGB is converted into YUV, and then converted WUV. Alternatively, the following formula is used:
Figure BDA0003386596540000061
further, assuming that the color rendering index of the reference light source is 100, the color difference of the same color block when the current light source and the reference light source are used for illumination can be calculated according to the following formula:
Figure BDA0003386596540000062
wherein, W0, U0, V0 is a reference value for searching a standard light source (5000K and below in black body, 5000K and above in typical sunlight) with the same or similar color temperature, wi, ui, vi is data after converting RGB into YUV and converting WUV.
Further, the color differences of the color blocks are sorted in the order from large to small, and the color rendering index is calculated by selecting the first 8 color differences, and the specific calculation formula is as follows:
Figure BDA0003386596540000063
where i represents the color patch numbers of the different colors.
S102, determining 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 matrixes corresponding to different color temperatures and color rendering indexes. The construction process of the preset color matrix is exemplified as follows: multiple image data (e.g., RAW data) of a 24 color chart are acquired under different light sources, and each image data is compared with standard data to determine a corresponding color matrix. It should be noted that the present invention may be constructed in other ways, and is not particularly limited herein. And further constructing a preset color matrix list based on the color temperature, the color rendering index and the corresponding color matrix of each light source. For example, see table 1, where R represents the color rendering index, ct represents the color temperature, and the values of each CCM (color matrix) in the table are different.
TABLE 1 preset color matrix list
Figure BDA0003386596540000071
After the color temperature and the color rendering index are obtained through S101, a matching search may be performed with table 1, thereby finding a target color matrix matching therewith. If a direct match is not possible, the target color matrix may be determined as follows: after the color temperature and the color rendering index obtained in S101, a target color temperature and a target display index close to the color temperature and the color rendering index are found out from table 1, that is, a combination of at least two groups of target color temperatures and target color rendering indexes is determined from a preset color matrix list, wherein the difference between the target color temperature and the calculated color temperature is smaller than a preset threshold value, and the difference between the calculated color rendering index and the target color rendering index is smaller than the preset threshold value. Selecting at least two initial color matrixes from a preset color matrix list according to the combination of the target color temperature and the target color rendering index; and performing interpolation operation on the selected initial color matrix to obtain the target color matrix. It should be noted that the calculation may be performed by any interpolation method, which is not specifically limited herein; the target color matrix is obtained through interpolation calculation, so that the accuracy of the target color matrix can be ensured, and the accuracy of subsequent color correction is further ensured.
S103, performing color correction on the current frame image according to the target white balance gain and the target color matrix.
Optionally, the white balance processing is performed on the three primary color data of the current frame image based on the target white balance gain, and then the color correction is performed on the processed three primary color data by using the target color matrix.
In the scheme, different white balance strategies are adopted to calculate the white balance gain aiming at images with different exposure information, so that the accuracy of the subsequent white balance can be ensured; based on the calculated color temperature and color rendering index, the color matrix directivity selection can be realized for the light sources with the same color temperature and different spectrums, the color difference between the light sources is reduced, and the color correction accuracy can be further ensured.
Fig. 2 is a flowchart of a further color correction method according to an embodiment of the present disclosure, in which the process of calculating the white balance gain is refined on the basis of the above embodiment, referring to fig. 2, the specific flow of the color correction method is as follows:
s201, dividing the current frame image into a preset number of image blocks, and taking each image block as a statistical point.
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, dividing the current frame image into a plurality of image blocks according to the preset value, each image block is used as a statistic point, so as to avoid the subsequent calculation of the white balance gain of each pixel point, reduce the calculation amount and improve the processing efficiency.
S202, determining the number of white points and white point falling positions in the statistical points based on preset white region distribution of light sources with different color temperatures and white region distribution of light sources with the same color temperature.
In the embodiment of the disclosure, white area distribution of preset light sources with different color temperatures is drawn in a coordinate system with R/G and B/G as axes, and the specific drawing process is as follows: image data under a plurality of different color temperatures are collected, the average value of the color data R, G, B of each image is calculated, and then R/G and B/G corresponding to each image are calculated according to the average value of R, G, B of each image, so that each color temperature corresponds to a group of R/G and B/G respectively. Further, a blackbody curve is obtained through fitting operation, and white region distribution is drawn based on the blackbody curve.
When white points (namely, points of white corresponding to the actual colors of the objects) in all statistical points (namely, image blocks) are determined based on white area distribution of light sources with different color temperatures, calculating the average value of R, G, B data in the image blocks, further calculating R/G, B/G, and then judging whether coordinates (R/G, B/G) fall in the white areas, if so, the image blocks are white points, and the white point falling positions are gain coordinates (R/G, B/G) of the color blocks.
The preset white area distribution of different light sources with the same color temperature is plotted in a coordinate system with the color temperature x and the display index y as axes. When white points (i.e., points where the corresponding actual color of the object is white) in a statistical point (i.e., image block) are determined based on white region distributions of different light sources of the same color temperature, the color temperature and color rendering index of the image block are calculated, and whether the color block is located in the white region is determined.
In the embodiment of the disclosure, white points included in the current frame image are respectively determined by using white area distribution of two coordinate systems, so that the final white point number and white point position are obtained by solving an intersection mode, and the accuracy of the obtained white points is ensured.
S203, acquiring exposure information of the current frame image.
In the embodiment of the 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, according to the relationship between the exposure amount included in the exposure information and the threshold, the target white balance gain is calculated according to S204, S205, or S206.
And S204, if the exposure amount included in the exposure information is smaller than a first threshold value, taking the average value of the white balance gains of all the statistical points as a target white balance gain.
In the embodiment of the disclosure, if the exposure Ev is smaller than the first threshold, it indicates that the ambient illuminance is lower, and at this time, the target white balance gain may be determined by means of averaging, so as to ensure the accuracy of the calculated gain.
By way of example, the calculation may be according to the following formula:
Figure BDA0003386596540000101
wherein m, n is a value set when dividing the current frame image, WBGain ij The white balance gain of the image block in the ith row and the jth column is represented, namely, the falling position of the image block in the coordinate system taking R/G and B/G as axes. WBGain is the calculated target white balance gain.
S205, if the exposure information comprises exposure amount larger than a second threshold value, calculating the target white balance gain according to white balance gain of each white point, the number of white points, influence factor weight of color temperature on the white point, influence factor weight of ambient brightness on the white point, distance influence factor weight of the white point and a blackbody curve and distance influence factor weight of the white point and a standard light source point.
Wherein the white balance gain of the white point may be determined according to the white point drop, and the number of white points may be determined by S202. When the exposure is greater than the threshold ev_high, the weight of the intermediate color temperature is given high, affecting the final white balance result. In a specific implementation, color temperature influencing factor weights are introduced. In order to ensure the accuracy of calculating the target white balance gain, the influence factor weight of the environment brightness on 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 are also introduced.
By way of example, the calculation may be according to the following formula:
Figure BDA0003386596540000102
wherein WBGain ij The white balance gain of each white point is represented, p and q represent the positions of image blocks of the white point, and num is the number of the white points; pct (Pct) k Weighting the influence factors of color temperature on white points; PEv ij The influence factor of the ambient brightness on the white point is weighted, and the higher the brightness is, the larger the weight is; pdis (Pdis) ij The distance between the white point and the blackbody curve is used as the influence factor weight, and the farther the distance is from the blackbody curve, the smaller the weight is; pcr (Pcr) ij The distance between the white point and the standard light source point is used for influencing the factor weight, and the farther the distance is, the smaller the weight is.
S206, if the exposure information comprises exposure quantity between the first threshold value and the second threshold value, calculating the target white balance gain according to white balance gain of each white point, the number of white points, influence factor weight of ambient brightness on the white point, distance influence factor weight of the white point and a blackbody curve and distance influence factor weight of the white point and a standard light source point.
By way of example, the calculation may be according to the following formula:
Figure BDA0003386596540000111
wherein WBGain ij The white balance gain of each white point is represented, p and q represent the positions of image blocks of the white point, and num is the number of the white points; PEv ij The influence factor of the ambient brightness on the white point is weighted, and the higher the brightness is, the larger the weight is; pdis (Pdis) ij The distance between the white point and the blackbody curve is used as the influence factor weight, and the farther the distance is from the blackbody curve, the smaller the weight is; pcr (Pcr) ij The distance between the white point and the standard light source point is used for influencing the factor weight, and the farther the distance is, the smaller the weight is.
S207, calculating color temperature according to the target white balance gain, and calculating a color rendering index.
S208, determining 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 matrixes corresponding to different color temperatures and color rendering indexes.
S209, performing color correction on the current frame image according to the target white balance gain and the target color matrix.
In the embodiment of the disclosure, different exposure amounts calculate the white balance gain according to different strategies, so that the method can be suitable for various scenes; and various influencing factor weights are introduced in the process of calculating the target white balance gain, so that the accuracy of the target white balance gain is ensured.
With the development of technology, the requirements of image effect and starting time of the camera in the starting initial state are gradually increased. Especially, products requiring quick drawing for low power consumption of battery are required to quickly present stable image effects once the device is in a working state. Based on this, a color correction method according to an embodiment of the present disclosure is provided, referring to fig. 3, a specific flow of the color correction method is as follows:
s301, if the current frame image is the acquired first frame image, selecting a preset white balance gain and a preset color matrix corresponding to the exposure information from a preset gain table according to the exposure information of the current frame.
S302, performing color correction on the first frame image according to the preset white balance gain and the preset color matrix.
When the device is started in a high-speed mode, the white balance information needs to be responded quickly, and prior information (namely a preset gain table) is used at the moment, and the closest white balance gain and color matrix are selected to correct according to exposure information and statistical information (namely color data of an image), so that the first frame effect is more accurate.
The construction process of the preset gain table is as follows: step 1: assuming that the exposure is Ev, the color rendering index is Ra, the color temperature is CCT, the white balance gains RGain and BGain are represented by i, and the type of a light source (for example, a lamp) is represented by i, a closed and stable environment is built, so that the camera faces the 24-color card. Step 2: when the environment is darker, the environment brightness is Ev_low, the environment brightness under the indoor common lamp source is Ev_mid, and the environment brightness in the outdoor noon is Ev_high, RAW data are collected, and the RAW data are required to meet that 19 color blocks are 0.8x2 k K is the RAW data bit depth. Step 3: and calculating the average value of RGain and BGain of 19-23 color blocks on the three groups of statistical RAWs as the initial white balance gain, and calculating to obtain an environment brightness and white balance gain information corresponding table. The light source may be a more commonly used light source, such as sodium lamp, incandescent lamp, warm light lamp, etc. Step 4: according to the parameters obtained in the step 3, a preset gain table of exposure information, a lamp source and white balance parameters is constructed as follows:
ambient illuminance 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
S303, acquiring exposure information of the 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.
In the disclosed embodiment, the current frame image is any video frame other than the first frame.
S304, determining 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 matrixes corresponding to different color temperatures and color rendering indexes.
S305, performing color correction on the current frame image according to the target white balance gain and the target color matrix.
In the embodiment of the disclosure, the preset gain table is constructed in advance, so that when the device is started in a high-speed mode, the first frame is quickly corrected by using the white balance gain and the color matrix corresponding to the white balance gain and the color matrix in the gain table, the calculation processes of the color matrix and the white balance gain required by the first frame are reduced, the response efficiency is ensured, the correction effect of the first frame is ensured to meet the requirement, and no larger deviation exists.
Fig. 4 is a schematic flow chart of a further color correction method according to an embodiment of the present disclosure, which is optimized based on the above embodiment, referring to fig. 4, the specific flow chart of the color correction method is as follows:
s401, acquiring 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.
S402, determining 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 matrixes corresponding to different color temperatures and color rendering indexes.
In the embodiment of the disclosure, in order to ensure that the device performs color correction quickly and stably, to avoid color mutation between adjacent video frames, the target white balance gain needs to be adjusted according to steps S403 to S405 before performing color correction.
S403, calculating a color temperature difference value and a color rendering index difference value between the previous frame image and the current frame image.
S404, determining a gain adjustment coefficient according to the color temperature difference value and the color rendering index difference value.
The calculation process of the color temperature and the color rendering index of each frame image can be referred to the above embodiments, and will not be described herein. After obtaining the color temperature difference value and the color rendering index difference value between the previous frame image and the current frame image, if the difference value is larger than a preset threshold value, quick adjustment is needed, for example, a larger gain adjustment coefficient is set; otherwise, if the difference is smaller than another preset threshold, a smaller gain adjustment coefficient can be set in a slow adjustment mode.
S405, adjusting the target white balance gain according to the gain adjustment coefficient and the white balance gain of the previous frame image.
In an alternative embodiment, the adjustment may be made according to the following formula:
WBgain new type =(1-DampFactor)*WBgain i-1 +DamFactor*WBgain i
Wherein, the DampFactor is the determined gain adjustment coefficient, WBgain i A target white balance gain for the calculated current frame; WBgain i-1 White balance gain for the last frame calculated; WBgain New type The gain is the white balance after the adjustment.
S406, performing color correction on the current frame image according to the adjusted target white balance gain and the target color matrix.
In the embodiment of the disclosure, by adjusting the target white balance gain, the situation that the adjacent frames have larger image style difference due to color mutation can be avoided, and the color correction effect is ensured.
Fig. 5 is a schematic structural diagram of a color correction device according to an embodiment of the present disclosure, which is applicable to a case where an image capturing apparatus (e.g., a web camera) performs color correction on a captured video frame image. As shown in fig. 5, the apparatus specifically includes:
the calculating module 501 is 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 policy corresponding to the exposure information;
a color matrix selection module 502, 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 matrixes corresponding to different color temperatures and color rendering indexes;
a correction module 503, configured to perform color correction on the current frame image according to the target white balance gain and the target color matrix.
On the basis of the above embodiment, optionally, the apparatus further includes:
the segmentation module is used for segmenting the current frame image into a preset number of image blocks, and taking each image block as a statistical point;
the white point determining module is used for determining the number of the white points and the white point falling positions in the statistical points based on the preset white region distribution of the light sources with different color temperatures and the white region distribution of the light sources with the same color temperature.
On the basis of the above embodiment, optionally, the calculation module includes:
the first calculation unit is used for taking the average value of the white balance gains of all the statistical points as the target white balance gain if the exposure information comprises exposure less than a first threshold value; or alternatively, the first and second heat exchangers may be,
the second calculating unit is used for calculating 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 the color temperature on the white point, the influence factor weight of the environment brightness on 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 if the exposure amount included in the exposure information is larger than a second threshold value; or alternatively, the first and second heat exchangers may be,
and a third calculation unit, configured to calculate, if the exposure information includes exposure amounts between the first threshold and the second threshold, the target white balance gain according to a white balance gain of each white point, the number of white points, an influence factor weight of ambient brightness on the white point, a distance influence factor weight of the white point and a blackbody curve, and a distance influence factor weight of the white point and a standard light source point.
On the basis of the above embodiment, optionally, the color matrix selection module is specifically configured to:
determining a combination of at least two groups of target color temperatures and target color rendering indexes from a preset color matrix list according to the color temperatures and the color rendering indexes;
selecting at least two initial color matrixes from a preset color matrix list according to the combination of the target color temperature and the target color rendering index;
and carrying out interpolation operation on the initial color matrix to obtain the target color matrix.
On the basis of the above embodiment, optionally, the method further includes:
the acquisition module is used for selecting a preset white balance gain and a preset color matrix corresponding to the exposure information from a preset gain table according to the exposure information of the current frame if the current frame image is the acquired first frame image;
and the first frame correction module is used for carrying out color correction on the first frame image according to the preset white balance gain and the preset color matrix.
On the basis of the above embodiment, optionally, the method further includes:
the difference value calculation module is used for calculating a color temperature difference value and a color rendering index difference value between the previous frame image and the current frame image;
the coefficient determining module is used for determining a gain adjustment coefficient according to the color temperature difference value and the color rendering index difference value;
and the adjusting module is used for adjusting the target white balance gain according to the gain adjusting coefficient and the white balance gain of the previous frame of image.
The device provided by the embodiment of the disclosure can execute the color correction method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of executing the color correction method. Reference is made to the description of any method embodiment of the disclosure for details not explicitly described in this embodiment.
Fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. In the embodiment of the disclosure, the electronic device is illustratively a webcam. As shown in fig. 6, an electronic device provided in an embodiment of the present disclosure includes: one or more processors 602 and a memory 601; the number of processors 602 in the electronic device may be one or more, one processor 602 being taken as an example in fig. 6; the memory 601 is used to store one or more programs; the one or more programs are executed by the one or more processors 602, causing the one or more processors 602 to implement the color correction method as in any of the embodiments of the present disclosure.
The electronic device may further include: an input device 603 and an output device 604.
The processor 602, the memory 601, the input means 603 and the output means 604 in the electronic device may be connected by a bus or by other means, in fig. 6 by way of example.
The memory 601 in the electronic device serves as a computer-readable storage medium for storing one or more programs, which may be software programs, computer-executable programs, and modules. The processor 602 executes various functional applications of the electronic device and data processing by running software programs, instructions and modules stored in the memory 601, i.e., implements the color correction method in the above-described method embodiments.
The memory 601 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for functions; the storage data area may store data created according to the use of the electronic device, etc. In addition, the memory 601 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 601 may further include memory located remotely from processor 602, which may be connected to the device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 603 may be used to receive entered numeric or character information and to generate key signal inputs related to user settings and function control of the electronic device. The output 604 may include a display device such as a display screen.
And, when one or more programs included in the above-described electronic device are executed by the one or more processors 602, the programs perform the following operations:
acquiring 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;
determining 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 matrixes 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.
Of course, those skilled in the art will appreciate that the program(s) may also perform the relevant operations of the color correction method provided in any of the embodiments of the present disclosure when the program(s) included in the electronic device described above are executed by one or more processors.
In one embodiment of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program for performing a color correction method when executed by a processor, the method comprising:
acquiring 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;
determining 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 matrixes 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.
The computer storage media of the embodiments of the present disclosure may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access Memory (Random Access Memory, RAM), a Read-Only Memory (ROM), an erasable programmable Read-Only Memory (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 foregoing. A computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to: electromagnetic signals, optical signals, or any suitable combination of the preceding. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, radio Frequency (RF), and the like, or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may 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 case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including, for example, a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer, for example, through the internet using an internet service provider.
Note that the above is only a preferred embodiment of the present disclosure and the technical principle applied. Those skilled in the art will appreciate that the present disclosure is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions can be made by those skilled in the art without departing from the scope of the disclosure. Therefore, while the present disclosure has been described in connection with the above embodiments, the present disclosure is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present disclosure, the scope of which is determined by the scope of the appended claims.

Claims (10)

1. A color correction method, comprising:
acquiring 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;
determining 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 matrixes 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.
2. The method according to claim 1, wherein the method further comprises:
dividing the current frame image into a preset number of image blocks, and taking each image block as a statistical point;
and determining the number of white points and white point falling positions in the statistical points based on the preset white region distribution of the light sources with different color temperatures and the white region distribution of the light sources with the same color temperature.
3. The method of claim 2, wherein calculating a target white balance gain according to a white balance policy corresponding to the exposure information comprises:
if the exposure information comprises exposure less than a first threshold, taking the average value of the white balance gains of all the statistical points as the target white balance gain; or alternatively, the first and second heat exchangers may be,
if the exposure information comprises exposure amount larger than a second threshold value, calculating the target white balance gain according to white balance gain of each white point, the number of white points, influence factor weight of color temperature on the white point, influence factor weight of ambient brightness on the white point, distance influence factor weight of the white point and a blackbody curve and distance influence factor weight of the white point and a standard light source point; or alternatively, the first and second heat exchangers may be,
if the exposure information comprises exposure quantity between the first threshold value and the second threshold value, calculating the target white balance gain according to white balance gain of each white point, the number of white points, influence factor weight of ambient brightness on the white point, distance influence factor weight of the white point and a blackbody curve and distance influence factor weight of the white point and a standard light source point.
4. The method of claim 1, wherein determining a target color matrix from a list of preset color matrices based on the color temperature and color rendering index, comprises:
determining a combination of at least two groups of target color temperatures and target color rendering indexes from a preset color matrix list according to the color temperatures and the color rendering indexes;
selecting at least two initial color matrixes from a preset color matrix list according to the combination of the target color temperature and the target color rendering index;
and carrying out interpolation operation on the initial color matrix to obtain the target color matrix.
5. The method as recited in claim 1, further comprising:
if the current frame image is the acquired first frame image, selecting a preset white balance gain and a preset color matrix corresponding to the exposure information from a preset gain table according to the exposure information of the current frame;
and performing color correction on the first frame image according to the preset white balance gain and the preset color matrix.
6. The method of claim 1, wherein prior to color correcting the current frame image based on the white balance gain and the target color matrix, the method further comprises:
calculating a color temperature difference value and a color rendering index difference value between the previous frame image and the current frame image;
determining a gain adjustment coefficient according to the color temperature difference value and the color rendering index difference value;
and adjusting the target white balance gain according to the gain adjustment coefficient and the white balance gain of the previous frame image.
7. A color correction device, comprising:
the computing module is used for acquiring exposure information of the current frame image and computing target white balance gain, color temperature and color rendering index according to a white balance strategy corresponding to the exposure information;
the color matrix selection module is used for determining 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 matrixes corresponding to different color temperatures and color rendering indexes;
and the correction module is used for carrying out color correction on the current frame image according to the target white balance gain and the target color matrix.
8. The apparatus as recited in claim 7, further comprising:
the segmentation module is used for segmenting the current frame image into a preset number of image blocks, and taking each image block as a statistical point;
the white point determining module is used for determining the number of the white points and the white point falling positions in the statistical points based on the preset white region distribution of the light sources with different color temperatures and the white region distribution of the light sources with the same color temperature.
9. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
10. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-6.
CN202111452215.3A 2021-12-01 2021-12-01 Color correction method and device, electronic equipment and storage medium Pending CN116233381A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111452215.3A CN116233381A (en) 2021-12-01 2021-12-01 Color correction method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111452215.3A CN116233381A (en) 2021-12-01 2021-12-01 Color correction method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116233381A true CN116233381A (en) 2023-06-06

Family

ID=86575440

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111452215.3A Pending CN116233381A (en) 2021-12-01 2021-12-01 Color correction method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116233381A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117316122A (en) * 2023-11-21 2023-12-29 荣耀终端有限公司 Color temperature calibration method, electronic equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117316122A (en) * 2023-11-21 2023-12-29 荣耀终端有限公司 Color temperature calibration method, electronic equipment and medium
CN117316122B (en) * 2023-11-21 2024-04-09 荣耀终端有限公司 Color temperature calibration method, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN104796683B (en) A kind of method and system of calibration image color
US7949185B2 (en) Method of performing robust auto white balance
US11277595B2 (en) White balance method for image and terminal device
EP3648459B1 (en) White balance adjustment method and apparatus, camera and medium
TWI660633B (en) White balance calibration method based on skin color data and image processing apparatus thereof
US10701329B2 (en) White balance parameter determination method and white balance adjustment method, device, and storage medium thereof
CN103227928B (en) White balance adjusting method and device
JP2008504751A (en) Automatic white balance method and apparatus
JP2010508729A (en) Automatic white balance statistics collection
JP2006211440A (en) Auto-white balancer and method for adjusting white balance
WO2022257396A1 (en) Method and apparatus for determining color fringe pixel point in image and computer device
CN112669758A (en) Display screen correction method, device, system and computer readable storage medium
CN107872663A (en) Image processing method and device, computer-readable recording medium and computer equipment
CN108063934B (en) Image processing method and device, computer readable storage medium and computer device
CN113329217B (en) Automatic white balance parameter processing method and device, and computer readable storage medium
CN116233381A (en) Color correction method and device, electronic equipment and storage medium
CN110570384A (en) method and device for carrying out illumination equalization processing on scene image, computer equipment and computer storage medium
WO2019137396A1 (en) Image processing method and device
WO2023015993A9 (en) Chromaticity information determination method and related electronic device
CN114286000B (en) Image color processing method and device and electronic equipment
WO2022032666A1 (en) Image processing method and related apparatus
CN113473101B (en) Color correction method, device, electronic equipment and storage medium
CN113793291A (en) Image fusion method and device, electronic equipment and storage medium
CN104869379A (en) White balance compensation method and electronic device
US20230388465A1 (en) Chroma adjustment method, electronic device and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination