CN111641819A - Method, device, system and computer device for white balance gain correction - Google Patents

Method, device, system and computer device for white balance gain correction Download PDF

Info

Publication number
CN111641819A
CN111641819A CN202010424880.0A CN202010424880A CN111641819A CN 111641819 A CN111641819 A CN 111641819A CN 202010424880 A CN202010424880 A CN 202010424880A CN 111641819 A CN111641819 A CN 111641819A
Authority
CN
China
Prior art keywords
gain
correction
target image
coefficient
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.)
Granted
Application number
CN202010424880.0A
Other languages
Chinese (zh)
Other versions
CN111641819B (en
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 Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology 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 Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202010424880.0A priority Critical patent/CN111641819B/en
Publication of CN111641819A publication Critical patent/CN111641819A/en
Application granted granted Critical
Publication of CN111641819B publication Critical patent/CN111641819B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control

Landscapes

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

Abstract

The application relates to a method, a device, a system and a computer device for correcting white balance gain, wherein the method for correcting the white balance gain comprises the following steps: the method comprises the steps of dividing a target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, selecting the color temperature region with the white block number reaching a preset condition as a correction reference region, obtaining the white block number in the correction reference region, obtaining a gain confidence coefficient according to the white block number and the white block total number, obtaining a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm, and performing white balance gain correction on the target image according to a reference gain coefficient, the preset gain coefficient and the gain confidence coefficient under the condition that the gain confidence coefficient and the weight meet the correction condition.

Description

Method, device, system and computer device for white balance gain correction
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, a system, and a computer apparatus for white balance gain correction.
Background
Due to different spectral characteristics of different illumination, under illumination with different color temperatures, the object has different color tones, the higher the color temperature of the light source is, the more blue the object is, and the lower the color temperature of the light source is, the more yellow the object is. Therefore, white balance correction is required for images taken by a camera under light sources of different color temperatures. The white scene has the same reflection to the red, green and blue channels, so the red, green and blue channels in the white scene have the same value, and the color cast caused by the light sources with different color temperatures can be corrected by taking white as a reference. For example, first, find the white image block in the image, calculate the average value of all white image blocks in the red, green, blue three channels, respectively, correct the red, blue channel in the image with the green channel as the reference, and make all white image blocks in the image equal in the red, green, blue three channels through correction, wherein the white image block is referred to as the white block for short.
In the related art, white balance adjustment is performed on the entire image by calculating a white balance weight for each white block, however, in a scene of a mixed light source, the result accuracy of the white balance adjustment is low due to a difference in color temperature of the light source.
At present, no effective solution is provided for the problem of low accuracy of the result of white balance adjustment of the whole image by calculating the white balance weight of each white block in the scene of a mixed light source in the related art.
Disclosure of Invention
The embodiment of the application provides a method, equipment, a system, computer equipment and a computer readable storage medium for correcting white balance gain, so as to at least solve the problem that in the related art, in the scene of a mixed light source, the accuracy of the result of performing white balance adjustment on the whole image is low by calculating the white balance weight of each white block.
In a first aspect, an embodiment of the present application provides a method for correcting a white balance gain, where the method includes:
dividing a target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, and selecting the color temperature region with the white block quantity reaching a preset condition as a correction reference region;
acquiring the number of white blocks in the correction reference region, acquiring a gain confidence coefficient according to the number of white blocks and the total number of white blocks in the target image, and acquiring a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm;
and under the condition that the gain confidence coefficient and the weight meet the correction condition, carrying out white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region.
In some of these embodiments, the correction condition comprises:
obtaining a gain coefficient deviation according to the preset gain coefficient and the reference gain coefficient under the condition that the gain confidence coefficient is greater than or equal to a confidence coefficient threshold value and the weight of the correction reference region is greater than or equal to a weight threshold value;
and under the condition that the gain coefficient deviation is greater than or equal to a deviation threshold value, carrying out white balance gain correction on the target image according to the preset gain coefficient, the gain confidence coefficient and the reference gain coefficient.
In some embodiments, the performing white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence in the correction reference region includes:
generating a first weight of the preset gain coefficient and a second weight of the reference gain coefficient according to the gain confidence coefficient;
obtaining a correction gain coefficient of the target image according to the first weight, the preset gain coefficient, the second weight and the reference gain coefficient;
and carrying out white balance gain correction on the target image according to the correction gain coefficient.
In some of these embodiments, the gain confidence is a ratio of the number of white blocks to the total number of white blocks.
In some embodiments, the obtaining the preset gain factor according to the preset white balance algorithm includes:
and generating a preset gain coefficient of the target image through a preset white balance algorithm according to the actual scene of the target image.
In some embodiments, before the dividing the target image into a plurality of color temperature regions, the method further comprises:
and adjusting white balance configuration parameters in the target image through the preset white balance algorithm.
In a second aspect, an embodiment of the present application provides an apparatus for white balance gain correction, where the apparatus includes: the device comprises a region division module, a parameter calculation module and an image correction module:
the region dividing module is used for dividing the target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, and selecting the color temperature region with the white block quantity reaching the preset condition as a correction reference region;
the parameter calculation module is configured to obtain the number of white blocks in the correction reference region, obtain a gain confidence according to the number of white blocks and the total number of white blocks in the target image, and obtain a preset gain coefficient and a weight of the correction reference region according to a preset white balance algorithm;
the image correction module is configured to, when the gain confidence and the weight satisfy a correction condition, perform white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient, and the gain confidence in the correction reference region.
In some embodiments, the image correction module further comprises a determination unit:
the judging unit is configured to obtain a gain coefficient deviation according to the preset gain coefficient and the reference gain coefficient under the condition that the gain confidence is smaller than a confidence threshold or the weight of the correction reference region is smaller than a weight threshold, and perform white balance gain correction on the target image according to the preset gain coefficient, the gain confidence and the reference gain coefficient under the condition that the gain coefficient deviation is greater than or equal to a deviation threshold.
In some of these embodiments, the image correction module further comprises a generation unit:
the generating unit is configured to generate a first weight of the preset gain coefficient and a second weight of the reference gain coefficient according to the gain confidence, and generate a correction gain coefficient of the target image according to the first weight, the preset gain coefficient, the second weight, and the reference gain coefficient.
In a third aspect, an embodiment of the present application provides a system for white balance gain correction, including an image pickup device and a processor;
the method comprises the steps that a target image is obtained through a camera device, the target image is divided into a plurality of color temperature areas through a processor according to the color temperature of each pixel point in the target image, and the color temperature areas with the white block quantity reaching a preset condition are selected as correction reference areas;
the processor obtains the number of white blocks in the correction reference region, obtains a gain confidence coefficient according to the number of white blocks and the total number of white blocks in the target image, and obtains a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm;
and the processor performs white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region under the condition that the gain confidence coefficient and the weight meet the correction condition.
In a fourth aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements any one of the above methods when executing the computer program.
In a fifth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement any of the above methods.
Compared with the related art, the method for correcting white balance gain provided in the embodiment of the application divides a target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, selects the color temperature region with the white block number reaching a preset condition as a correction reference region, obtains the white block number in the correction reference region, obtains a gain confidence coefficient according to the white block number and the total white block number in the target image, obtains a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm, performs white balance gain correction on the target image according to a reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region under the condition that the gain confidence coefficient and the weight meet the correction condition, and solves the problem that in the related art, in the scene of a mixed light source, by calculating the white balance weight of each white block, the accuracy of the result of white balance adjustment of the whole image is low, and the accuracy and the reliability of white balance gain correction are improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic diagram of an application environment of a method of white balance gain correction according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of white balance gain correction according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for determining whether a target image requires white balance gain correction according to an embodiment of the present application;
FIG. 4 is a flow chart of a method of generating a correction gain factor according to an embodiment of the present application;
FIG. 5 is a preferred flow chart of a method of white balance gain correction according to an embodiment of the present application;
fig. 6 is a block diagram of a configuration of an apparatus for white balance gain correction according to an embodiment of the present application;
fig. 7 is an internal structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The method for correcting white balance gain provided by the present application can be applied to the application environment shown in fig. 1, and fig. 1 is a schematic view of the application environment of the method for correcting white balance gain according to the embodiment of the present application, as shown in fig. 1. The electronic device 102 includes a chip 104. The electronic device 102 obtains a target picture, the chip 104 divides the target picture into a plurality of color temperature regions according to the color temperature of each pixel point in the target picture, and selects the color temperature region where the number of white blocks reaches a preset condition as a correction reference region. The chip 104 obtains the number of white blocks in the calibration reference region, obtains a gain confidence according to the number of white blocks and the total number of white blocks in the target image, and obtains a preset gain coefficient and a weight of the calibration reference region according to a preset white balance algorithm. Under the condition that the gain confidence coefficient and the weight meet the correction condition, the chip 104 performs white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region. The electronic device 102 includes a mobile phone, a tablet computer, or a monitoring camera.
The present embodiment provides a method for correcting white balance gain, and fig. 2 is a flowchart of a method for correcting white balance gain according to an embodiment of the present application, and as shown in fig. 2, the method includes the following steps:
step S201, dividing the target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, and selecting the color temperature region where the number of white blocks reaches a preset condition as a calibration reference region.
The target image can be acquired through the camera shooting equipment, and the camera shooting equipment comprises a monitoring camera or camera shooting modules of intelligent terminal equipment such as a mobile phone and a tablet. The color temperature is used to indicate the color components contained in the light, and if the light emitted from a light source has the same spectral components as the light emitted from a black body at the temperature of the black body, which is the color temperature of the light source, for example, the color of the light emitted from a bulb with 100W power is the same as the color of the black body at 2527 ℃, then the color temperature of the light emitted from the bulb is (2527+273) K2800K. Under the condition of shooting by using natural light, the colors of the shot pictures are different due to different color temperatures of light rays in different time periods, the color temperature of blue light is higher, and the color temperature of yellow light is lower. The color temperature range of each pixel point in the target image can be judged according to the channel value of each pixel point, under the condition that the target image is in a Red-Green-Blue (Red, Green, Blue, RGB) color mode, the color temperature range of each pixel point can be judged by calculating the G/R, G/B value of each pixel point, the target image is divided into a plurality of color temperature areas according to the color temperature range of each pixel point, and R, G, B respectively represents the channel values of the Red channel, the Green channel and the Blue channel.
In the target image, there are usually a large number of white image blocks, in this application, a white image block is simply referred to as a white block, and the white block in this embodiment may also be a white pixel point in the target image, and statistics of the number and the position distribution of the white block in the target image are performed, where the position distribution may be obtained by calculating a value of G/R, G/B of the white block. The preset condition may be that the number of the white blocks reaches a preset value, and in this embodiment, the preset condition is that the number of the white blocks is the largest.
Step S202, acquiring the number of white blocks in the correction reference region, acquiring a gain confidence coefficient according to the number of white blocks and the total number of white blocks in the target image, and acquiring a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm.
The gain confidence is one of the judgment conditions for judging whether to perform white balance gain correction on the target image, and the preset white balance algorithm can preset white balance configuration parameters of the target image through color temperatures in different brightness scenes and the weight of each color temperature area, wherein the white balance configuration parameters comprise preset gain coefficients. According to different scenes, the main distribution range of the color temperature is different, for example, in an outdoor sunny scene, the color temperature of the scene is mainly distributed at 3700-. The weight of the correction reference region may be set according to the actual scene of the target image.
Step S203, performing white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence in the correction reference region when the gain confidence and the weight satisfy the correction condition.
In this embodiment, whether the weight and the gain confidence of the correction reference region satisfy the correction condition may be determined according to whether the weight and the gain confidence of the correction reference region respectively satisfy corresponding preset thresholds, and when the correction condition is satisfied, the white balance gain coefficient may be adaptively corrected to generate a new white balance gain coefficient, and when the correction condition is not satisfied, no processing is performed. The reference gain coefficient may be obtained by correcting RGB channel values of each pixel in the reference region in the target image.
Through the steps S201 to S203, after the correction reference region of the target image is determined, whether the target image needs to be corrected by the white balance gain coefficient is determined according to the relationship between the weight of the correction reference region and the confidence of the target image and the corresponding preset threshold, and under the condition that the target image needs to be corrected by the white balance gain coefficient, a new white balance gain correction coefficient is generated according to the reference gain coefficient, the preset gain coefficient and the gain confidence, and the white balance gain correction is performed on the target image.
In some embodiments, fig. 3 is a flowchart of a method for determining whether a target image needs to be subjected to white balance gain correction according to an embodiment of the present application, and as shown in fig. 3, the method includes the following steps:
step S301, under the condition that the gain confidence is greater than or equal to the confidence threshold and the weight of the correction reference region is greater than or equal to the weight threshold, obtaining a gain coefficient deviation according to a preset gain coefficient and a reference gain coefficient.
Since different scenes have different color temperature distributions, the weights of the color temperature regions are set according to the main distribution of the color temperatures in the different scenes, so that the white balance correction in the scene can be more accurate, and the confidence threshold and the weight threshold of the target image are set based on the actual scene of the target image, and the weight threshold in the embodiment can be set to 1. Therefore, the calculation of the gain coefficient deviation is started under the condition that the gain confidence is greater than or equal to the confidence threshold and the weight of the correction reference region is greater than or equal to 1.
In this embodiment, the gain coefficient deviation includes a gain coefficient deviation of a red component and a gain coefficient deviation of a blue component, where the gain coefficient deviation of the red component is obtained by the following formula 1:
Rs=|Rg1-rgequation 1
In formula 1, RsDeviation of gain coefficient for red component, Rg1A predetermined gain factor, r, for the red componentgReference gain factor for the red component.
The gain coefficient deviation of the blue component is obtained by the following equation 2:
Bs=|Bg1-bgequation 2
In the formula 2, BsDeviation of gain factor for blue component, Bg1A predetermined gain factor for the blue component, bgIs the reference gain factor for the blue component.
Step S302, if the gain coefficient deviation is greater than or equal to the deviation threshold, performing white balance gain correction on the target image according to the preset gain coefficient, the gain confidence and the reference gain coefficient.
Wherein the deviation threshold comprises a deviation threshold Th of the red componentrsAnd a deviation threshold value Th of the blue componentbsAt RsGreater than or equal to ThrsIn the case of (2), for Rg1Making a correction at BsGreater than or equal to ThbsIn case of (B)g1And (6) carrying out correction. The reference gain coefficients also include a reference gain coefficient for the red component and a reference gain coefficient for the blue component.
In other embodiments, at RsLess than ThrsUnder the condition of (1), the preset gain coefficient of the red component is considered to meet the white balance processing requirement, and the white balance gain coefficient is not corrected in a self-adaptive mode; or, in BsLess than ThbsIn the case of (2), the preset gain coefficient of the blue component is considered to have met the white balance processing requirement, and the white balance gain coefficient is not adaptively corrected for the blue component.
Through the above steps S301 and S302, it is determined whether to perform white balance gain correction on the target image according to the comparison result between the gain confidence and the confidence threshold, and by combining the comparison result between the weight of the correction reference region and the weight threshold, so as to improve the accuracy of performing white balance gain correction on the target image.
In some embodiments, fig. 4 is a flow chart of a method of generating a correction gain factor according to an embodiment of the present application, the method comprising the steps of:
step S401, according to the gain confidence, generating a first weight of the preset gain coefficient and a second weight of the reference gain coefficient.
In this embodiment, the first weight is 1-k, where k is a gain confidence, and the second weight is k, and in other embodiments, the first weight or the second weight may further add a correction coefficient before 1-k or k, so as to better implement white balance gain correction on the target image.
Step S402, obtaining a correction gain coefficient of the target image according to the first weight, the preset gain coefficient, the second weight and the reference gain coefficient.
The correction gain coefficient in the present embodiment includes a correction gain coefficient for the red component and a correction gain coefficient for the blue component. Wherein, the correction gain coefficient of the red component can be obtained by the following formula 3:
Rg1'=Rg1*(1-k)+rgk formula 3
In formula 3, Rg1Is the correction gain coefficient for the red component.
The correction gain coefficient for the blue color component can be obtained by the following equation 4:
Bg1'=Bg1*(1-k)+bgk formula 4
In the formula 4, Bg1Is the correction gain coefficient for the blue component.
In step S403, white balance gain correction is performed on the target image according to the correction gain coefficient.
In this embodiment, according to Rg1' and Bg1Determining a white balance gain coefficient of the final target image, and performing white balance correction on the target image.
Through the above steps S401 to S403, the preset gain coefficient is adjusted and corrected by the gain confidence and the reference gain coefficient of the color temperature range of the correction reference region, so as to achieve the optimal white balance image processing effect.
In some embodiments, the gain confidence is a ratio of the number of white blocks to the total number of white blocks. For example, the gain factor can be obtained from the following equation 5:
k is n/m formula 5
In equation 5, k is the gain confidence, n is the number of white blocks in the correction reference region, and m is the total number of white blocks in the target image. By the gain confidence coefficient in the embodiment, the weight of the white block number in the correction reference region in the total white block amount in the target image can be determined, whether the target image needs to be subjected to white balance gain correction or not can be judged more accurately, and the accuracy of the white balance gain correction is improved.
In some embodiments, obtaining the preset gain factor according to the preset white balance algorithm comprises: and generating a preset gain coefficient of the target image through a preset white balance algorithm according to the actual scene of the target image. Since the color temperatures of different actual scenes are different, for example, the color temperature of outdoor sunny days is mainly distributed between 3700K and 6500K, and the color temperature of sunlight at sunrise or sunset is about 2000K, a preset gain coefficient, including a preset gain coefficient R of a red component, needs to be set for a target image according to different actual scenesg1And a preset gain factor B of the blue componentg1Therefore, the target image after white balance processing is closer to the real color, and the user experience is improved.
In some embodiments, the method of white balance gain correction further comprises, before dividing the target image into a plurality of color temperature regions: and adjusting the white balance configuration parameters in the target image through a preset white balance algorithm. And adjusting white balance configuration parameters under different brightness scenes according to the preset white balance algorithm, so that the white balance gain coefficient calculated by the preset white balance algorithm is more accurate.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
Fig. 5 is a preferred flowchart of a method of white balance gain correction according to an embodiment of the present application, as shown in fig. 5, the method comprising the steps of:
step S501, a target image is obtained, and white balance gain calculation is carried out through a preset white balance algorithm to obtainTo a predetermined gain factor Rg1And Bg1Wherein R isg1Preset gain factor for red component, Bg1A preset gain factor for the blue component.
Step S502, dividing the target image into a plurality of color temperature regions according to the color temperatures of pixels in the target image, obtaining the number of white blocks in each color temperature region, taking the color temperature region with the largest number of white blocks as a correction reference region, and obtaining a gain confidence k according to the number n of white blocks in the correction reference region and the total number m of white blocks in the target image, where k is n/m.
In step S503, the value of k is greater than or equal to the confidence threshold ThkAnd acquiring a reference gain coefficient r of the correction reference region under the condition that the weight of the correction reference region is greater than or equal to 1gAnd bgWherein r isgReference gain coefficient for red component, bgIs the reference gain factor for the blue component. And under the condition that the value of k is smaller than the confidence coefficient threshold value or the weight of the correction reference region is smaller than 1, not correcting the preset gain coefficient.
In step S504, the gain coefficient deviation of the red component is calculated according to formula 1, and the gain coefficient deviation of the blue component is calculated according to formula 2.
Step S505 is to calculate the correction gain coefficient of the red component according to equation 3 when the gain coefficient deviation of the red component is greater than or equal to the deviation threshold of the red component, not to correct the preset gain coefficient of the red component when the gain coefficient deviation of the red component is less than the deviation threshold of the red component, to calculate the correction gain coefficient of the blue component according to equation 4 when the gain coefficient deviation of the blue component is greater than or equal to the deviation threshold of the blue component, and not to correct the preset gain coefficient of the blue component when the gain coefficient deviation of the blue component is less than the deviation threshold of the blue component.
Through the steps S501 to S505, in the method for correcting white balance gain provided in this embodiment, the gain confidence and the gain coefficient deviation in the color temperature range of the correction reference region are determined as the determination conditions for determining whether to correct the preset gain coefficient, and then the preset gain coefficient is adjusted and corrected through the gain confidence and the reference gain coefficient of the correction reference region, so as to achieve the optimal white balance image processing effect.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
This embodiment further provides a device for correcting white balance gain, which is used to implement the foregoing embodiments and preferred embodiments, and the description of the device that has been already made is omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
In some embodiments, fig. 6 is a block diagram of a device for white balance gain correction according to an embodiment of the present application, and as shown in fig. 6, the apparatus includes: region division module 61, parameter calculation module 62, and image correction module 63:
the region dividing module 61 is configured to divide the target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, and select the color temperature region where the number of white blocks reaches a preset condition as a calibration reference region.
And a parameter calculating module 62, configured to obtain the number of white blocks in the calibration reference region, obtain a gain confidence according to the number of white blocks and the total number of white blocks in the target image, and obtain a preset gain coefficient and a weight of the calibration reference region according to a preset white balance algorithm.
And an image correction module 63, configured to, when the gain confidence and the weight meet a correction condition, perform white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient, and the gain confidence in the correction reference region.
In the white balance gain correction apparatus in this embodiment, after the region dividing module 61 determines the correction reference region of the target image, the parameter calculating module 62 calculates the gain confidence and the weight of the correction reference region, the image correcting module 63 determines whether the target image needs to be corrected by the white balance gain coefficient according to the relationship between the weight of the correction reference region and the confidence of the target image and the corresponding preset threshold, generates a new white balance gain correction coefficient according to the reference gain coefficient, the preset gain coefficient and the gain confidence under the condition that the target image needs to be corrected by the white balance gain coefficient, and performs white balance gain correction on the target image. In a mixed light source scene, the related art presents a white block color cast problem on a sensor for some objects, and the number of the color cast white blocks is more in the color temperature range of the correction reference area, so that the normal overall color and visual effect of the image are affected.
In some embodiments, the image correction module 63 further comprises a determination unit: the judging unit is used for obtaining a gain coefficient deviation according to the preset gain coefficient and the reference gain coefficient under the condition that the gain confidence is smaller than a confidence threshold or the weight of the correction reference area is smaller than a weight threshold, and performing white balance gain correction on the target image according to the preset gain coefficient, the gain confidence and the reference gain coefficient under the condition that the gain coefficient deviation is larger than or equal to a deviation threshold. The judging unit judges whether to perform white balance gain correction on the target image according to the comparison result of the gain confidence coefficient and the confidence coefficient threshold value and by combining the comparison result of the weight of the correction reference area and the weight threshold value so as to improve the accuracy of performing white balance gain correction on the target image.
In some embodiments, the image correction module 63 further comprises a generation unit: the generating unit is configured to generate a first weight of the preset gain coefficient and a second weight of the reference gain coefficient according to the gain confidence, and generate a correction gain coefficient of the target image according to the first weight, the preset gain coefficient, the second weight, and the reference gain coefficient. The generating unit adjusts and corrects the preset gain coefficient through the gain confidence coefficient and the reference gain coefficient of the color temperature range of the correction reference region to achieve the best white balance image processing effect.
In some embodiments, the present application further provides a system for white balance gain correction, the system comprising an imaging device and a processor: the camera device is used for acquiring a target image, the processor divides the target image into a plurality of color temperature areas according to the color temperature of each pixel point in the target image, and the color temperature area with the white block quantity reaching a preset condition is selected as a correction reference area; the processor acquires the number of white blocks in the correction reference region, acquires a gain confidence coefficient according to the number of white blocks and the total number of white blocks in the target image, and acquires a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm; and the processor performs white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region under the condition that the gain confidence coefficient and the weight meet the correction condition. In the system in this embodiment, after determining the correction reference region of the target image, the processor determines whether the target image needs to be corrected by the white balance gain coefficient according to the relationship between the weight of the correction reference region and the confidence of the target image and the corresponding preset threshold, and under the condition that the target image needs to be corrected by the white balance gain coefficient, the processor generates a new white balance gain correction coefficient according to the reference gain coefficient, the preset gain coefficient and the gain confidence, and performs white balance gain correction on the target image.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of white balance gain correction. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
In one embodiment, fig. 7 is a schematic diagram of an internal structure of an electronic device according to an embodiment of the present application, and as shown in fig. 7, there is provided an electronic device, which may be a server, and an internal structure diagram of which may be as shown in fig. 7. The electronic device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the electronic device is used for storing data. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a method of white balance gain correction.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is a block diagram of only a portion of the architecture associated with the subject application, and does not constitute a limitation on the electronic devices to which the subject application may be applied, and that a particular electronic device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the method for white balance gain correction provided by the above embodiments when executing the computer program.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the steps in the method of white balance gain correction provided by the various embodiments described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of white balance gain correction, the method comprising:
dividing a target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, and selecting the color temperature region with the white block quantity reaching a preset condition as a correction reference region;
acquiring the number of white blocks in the correction reference region, acquiring a gain confidence coefficient according to the number of white blocks and the total number of white blocks in the target image, and acquiring a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm;
and under the condition that the gain confidence coefficient and the weight meet the correction condition, carrying out white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region.
2. The method of claim 1, wherein the correction condition comprises:
obtaining a gain coefficient deviation according to the preset gain coefficient and the reference gain coefficient under the condition that the gain confidence coefficient is greater than or equal to a confidence coefficient threshold value and the weight of the correction reference region is greater than or equal to a weight threshold value;
and under the condition that the gain coefficient deviation is greater than or equal to a deviation threshold value, carrying out white balance gain correction on the target image according to the preset gain coefficient, the gain confidence coefficient and the reference gain coefficient.
3. The method according to claim 1, wherein the performing white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence in the correction reference region comprises:
generating a first weight of the preset gain coefficient and a second weight of the reference gain coefficient according to the gain confidence coefficient;
obtaining a correction gain coefficient of the target image according to the first weight, the preset gain coefficient, the second weight and the reference gain coefficient;
and carrying out white balance gain correction on the target image according to the correction gain coefficient.
4. The method of claim 1, wherein the gain confidence is a ratio of the number of white blocks to the total number of white blocks.
5. The method according to claim 1, wherein the obtaining the preset gain factor according to the preset white balance algorithm comprises:
and generating a preset gain coefficient of the target image through a preset white balance algorithm according to the actual scene of the target image.
6. The method of claim 1, wherein prior to said dividing the target image into a plurality of color temperature regions, the method further comprises:
and adjusting white balance configuration parameters in the target image through the preset white balance algorithm.
7. An apparatus for white balance gain correction, the apparatus comprising: the device comprises a region division module, a parameter calculation module and an image correction module:
the region dividing module is used for dividing the target image into a plurality of color temperature regions according to the color temperature of each pixel point in the target image, and selecting the color temperature region with the white block quantity reaching the preset condition as a correction reference region;
the parameter calculation module is configured to obtain the number of white blocks in the correction reference region, obtain a gain confidence according to the number of white blocks and the total number of white blocks in the target image, and obtain a preset gain coefficient and a weight of the correction reference region according to a preset white balance algorithm;
the image correction module is configured to, when the gain confidence and the weight satisfy a correction condition, perform white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient, and the gain confidence in the correction reference region.
8. A system for white balance gain correction, the system comprising an imaging device and a processor;
the method comprises the steps that a target image is obtained through a camera device, the target image is divided into a plurality of color temperature areas through a processor according to the color temperature of each pixel point in the target image, and the color temperature areas with the white block quantity reaching a preset condition are selected as correction reference areas;
the processor obtains the number of white blocks in the correction reference region, obtains a gain confidence coefficient according to the number of white blocks and the total number of white blocks in the target image, and obtains a preset gain coefficient and the weight of the correction reference region according to a preset white balance algorithm;
and the processor performs white balance gain correction on the target image according to the reference gain coefficient, the preset gain coefficient and the gain confidence coefficient in the correction reference region under the condition that the gain confidence coefficient and the weight meet the correction condition.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202010424880.0A 2020-05-19 2020-05-19 Method, device, system and computer device for white balance gain correction Active CN111641819B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010424880.0A CN111641819B (en) 2020-05-19 2020-05-19 Method, device, system and computer device for white balance gain correction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010424880.0A CN111641819B (en) 2020-05-19 2020-05-19 Method, device, system and computer device for white balance gain correction

Publications (2)

Publication Number Publication Date
CN111641819A true CN111641819A (en) 2020-09-08
CN111641819B CN111641819B (en) 2022-03-01

Family

ID=72332079

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010424880.0A Active CN111641819B (en) 2020-05-19 2020-05-19 Method, device, system and computer device for white balance gain correction

Country Status (1)

Country Link
CN (1) CN111641819B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256487A (en) * 2021-06-10 2021-08-13 珠海市杰理科技股份有限公司 Image processing method, device, equipment and storage medium
CN113301318A (en) * 2021-05-24 2021-08-24 展讯半导体(南京)有限公司 Image white balance processing method and device, storage medium and terminal
CN113411555A (en) * 2021-06-08 2021-09-17 珠海市杰理科技股份有限公司 White balance processing method and device, storage medium and image capturing device
CN113596427A (en) * 2021-09-13 2021-11-02 厦门亿联网络技术股份有限公司 Image white balance improving method and device, electronic equipment and storage medium
CN114143447A (en) * 2021-11-08 2022-03-04 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114202468A (en) * 2020-09-18 2022-03-18 北京小米移动软件有限公司 Method and apparatus for stabilizing white point information, computer program product and storage medium
CN114286072A (en) * 2020-09-27 2022-04-05 北京小米移动软件有限公司 Color restoration device and method, image processor
CN114866755A (en) * 2022-05-17 2022-08-05 北京奕斯伟计算技术有限公司 Automatic white balance method and device, computer storage medium and electronic equipment
CN114926364A (en) * 2022-05-31 2022-08-19 影石创新科技股份有限公司 Image correction method, image correction device, computer equipment and storage medium
CN114928732A (en) * 2022-04-14 2022-08-19 深圳创维-Rgb电子有限公司 Image color calibration method and device, electronic equipment and readable storage medium
CN115002437A (en) * 2021-03-02 2022-09-02 北京小米移动软件有限公司 White balance processing method and device, and storage medium
CN115334295A (en) * 2022-08-10 2022-11-11 杭州联吉技术有限公司 Image white balance processing method and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0530738A2 (en) * 1991-09-02 1993-03-10 Matsushita Electric Industrial Co., Ltd. Automatic white balance device
EP0530793A2 (en) * 1991-09-05 1993-03-10 Canon Kabushiki Kaisha White balance control circuit in an image pickup apparatus
JPH08307882A (en) * 1995-05-11 1996-11-22 Sharp Corp Image pickup device
CN1519768A (en) * 2003-01-30 2004-08-11 ���ǵ�����ʽ���� Method and device for correcting image askew
CN107360410A (en) * 2017-07-10 2017-11-17 广东欧珀移动通信有限公司 Method for controlling white balance, device and terminal device
CN110602473A (en) * 2019-10-24 2019-12-20 维沃移动通信有限公司 White balance calibration method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0530738A2 (en) * 1991-09-02 1993-03-10 Matsushita Electric Industrial Co., Ltd. Automatic white balance device
EP0530793A2 (en) * 1991-09-05 1993-03-10 Canon Kabushiki Kaisha White balance control circuit in an image pickup apparatus
JPH08307882A (en) * 1995-05-11 1996-11-22 Sharp Corp Image pickup device
CN1519768A (en) * 2003-01-30 2004-08-11 ���ǵ�����ʽ���� Method and device for correcting image askew
CN107360410A (en) * 2017-07-10 2017-11-17 广东欧珀移动通信有限公司 Method for controlling white balance, device and terminal device
CN110602473A (en) * 2019-10-24 2019-12-20 维沃移动通信有限公司 White balance calibration method and device

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114202468A (en) * 2020-09-18 2022-03-18 北京小米移动软件有限公司 Method and apparatus for stabilizing white point information, computer program product and storage medium
CN114286072A (en) * 2020-09-27 2022-04-05 北京小米移动软件有限公司 Color restoration device and method, image processor
CN115002437A (en) * 2021-03-02 2022-09-02 北京小米移动软件有限公司 White balance processing method and device, and storage medium
CN113301318A (en) * 2021-05-24 2021-08-24 展讯半导体(南京)有限公司 Image white balance processing method and device, storage medium and terminal
CN113411555A (en) * 2021-06-08 2021-09-17 珠海市杰理科技股份有限公司 White balance processing method and device, storage medium and image capturing device
CN113411555B (en) * 2021-06-08 2022-07-22 珠海市杰理科技股份有限公司 White balance processing method and device, storage medium and image capturing equipment
CN113256487B (en) * 2021-06-10 2021-11-12 珠海市杰理科技股份有限公司 Image processing method, device, equipment and storage medium
CN113256487A (en) * 2021-06-10 2021-08-13 珠海市杰理科技股份有限公司 Image processing method, device, equipment and storage medium
CN113596427A (en) * 2021-09-13 2021-11-02 厦门亿联网络技术股份有限公司 Image white balance improving method and device, electronic equipment and storage medium
CN113596427B (en) * 2021-09-13 2024-03-15 厦门亿联网络技术股份有限公司 Image white balance improving method and device, electronic equipment and storage medium
CN114143447A (en) * 2021-11-08 2022-03-04 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114143447B (en) * 2021-11-08 2024-03-05 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114928732B (en) * 2022-04-14 2024-01-23 深圳创维-Rgb电子有限公司 Image color quasi correction method, device, electronic equipment and readable storage medium
CN114928732A (en) * 2022-04-14 2022-08-19 深圳创维-Rgb电子有限公司 Image color calibration method and device, electronic equipment and readable storage medium
CN114866755B (en) * 2022-05-17 2023-12-19 北京奕斯伟计算技术股份有限公司 Automatic white balance method and device, computer storage medium and electronic equipment
CN114866755A (en) * 2022-05-17 2022-08-05 北京奕斯伟计算技术有限公司 Automatic white balance method and device, computer storage medium and electronic equipment
CN114926364A (en) * 2022-05-31 2022-08-19 影石创新科技股份有限公司 Image correction method, image correction device, computer equipment and storage medium
CN114926364B (en) * 2022-05-31 2024-08-20 影石创新科技股份有限公司 Image correction method, apparatus, computer device, and storage medium
CN115334295A (en) * 2022-08-10 2022-11-11 杭州联吉技术有限公司 Image white balance processing method and electronic equipment
CN115334295B (en) * 2022-08-10 2024-05-03 杭州联吉技术有限公司 Image white balance processing method and electronic equipment

Also Published As

Publication number Publication date
CN111641819B (en) 2022-03-01

Similar Documents

Publication Publication Date Title
CN111641819B (en) Method, device, system and computer device for white balance gain correction
CN112752023B (en) Image adjusting method and device, electronic equipment and storage medium
US11431915B2 (en) Image acquisition method, electronic device, and non-transitory computer readable storage medium
US10757386B2 (en) White balance calibration method based on skin color data and image processing apparatus using the same
US20180191933A1 (en) Image capture apparatus and method executed by image capture apparatus
CN104796683B (en) A kind of method and system of calibration image color
US10074165B2 (en) Image composition device, image composition method, and recording medium
CN110830778B (en) Imaging device color correction method, imaging device color correction device, electronic device and storage medium
CN107948539B (en) Flash lamp control method and terminal
CN105407296B (en) Real-time video enhancement method and device
CN111861922A (en) Method and device for adjusting color correction matrix and storage medium
CN110381303B (en) Portrait automatic exposure white balance correction method and system based on skin color statistics
CN105898263B (en) A kind of image white balance method, device and computing device
US11962917B2 (en) Color adjustment method, color adjustment device, electronic device and computer-readable storage medium
CN111587573B (en) Image processing method and device and computer storage medium
CN113177886B (en) Image processing method, device, computer equipment and readable storage medium
CN110751607A (en) Skin color correction method and device, storage medium and electronic device
CN113590071A (en) Image processing method, apparatus, computer device and medium based on dithering
CN110046573B (en) Face image recognition method and device, computer equipment and storage medium
US7965322B2 (en) Color correction on an image
EP4181510A1 (en) Chromaticity information determination method and related electronic device
CN110619611A (en) Image correction calibration method and device, computer equipment and storage medium
WO2022257574A1 (en) Fusion algorithm of ai automatic white balance and automatic white balance, and electronic device
CN113271450B (en) White balance adjusting method, image processing device and image processing system
CN110458768B (en) Image processing method, computer 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
GR01 Patent grant
GR01 Patent grant