Automatic white balance correction method, device and computer storage medium

By determining the white pixel statistical area and calculating the white balance gain based on the chromaticity distribution characteristics of the white pixels under the light source, combined with the fine color shift correction in the YUV space, the existing white balance algorithm solves the problem when the prerequisites are not met. It solves the failure problem and realizes automatic white balance correction under different light source conditions, simplifying the algorithm implementation and improving the correction effect.

CN112492286BActive Publication Date: 2024-10-18ARKMICRO TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910857313.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-11
Publication Date
2024-10-18
Estimated Expiration
2039-09-11

AI Technical Summary

Technical Problem

Existing white balance algorithms are prone to failure when the prerequisites are not met, and the algorithm implementation process based on a large amount of prior knowledge is complex and resource-intensive, making it difficult to effectively correct the true color of white objects in all situations.

Method used

By determining the white pixel statistical area according to the chromaticity distribution characteristics of the white pixels under the light source, calculating the white balance gain to roughly correct the image, and selecting the white pixels in the YUV space, calculating the average chromaticity and color deviation error. If the color If the offset error is greater than the preset value, the fine color offset correction gain obtained through step-by-step recursion is used for fine correction.

Benefits of technology

It realizes automatic white balance correction under different light source conditions, simplifies the construction of prior knowledge, the algorithm is simple and easy to implement on hardware, and the correction effect is good.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112492286B_ABST
    Figure CN112492286B_ABST
Patent Text Reader

Abstract

The present invention provides an automatic white balance correction method and device. The method comprises: determining a white pixel statistical area according to the chromaticity distribution characteristics of white pixel points under a light source; counting the pixel points of the image to be corrected that fall into the white pixel statistical area, and calculating the white balance gain; roughly correcting the image to be corrected according to the white balance gain; converting the corrected image from the RGB color space to the YUV space, and selecting white pixel points in the YUV space; calculating the average chromaticity and color deviation error of the white pixel points in the YUV space; when the color deviation error is greater than a preset value, using the fine color deviation correction gain to finely correct the roughly corrected image. The prior knowledge required by the present invention is easy to construct, the algorithm is simple and easy to implement in hardware, and the correction effect is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image and video processing technology, and in particular to an automatic white balance correction method, device and computer storage medium. Background Art

[0002] The human visual system has the ability to perceive color almost independently of the lighting conditions, and can ensure that the color of the observed object will not change due to different light sources. However, when a digital imaging device is imaging, the energy stored in its photosensitive components depends not only on the surface color of the object being photographed, but also on many factors such as the external lighting conditions at the time and the physical properties of the photosensitive components. Generally, in images taken under a high color temperature light source, white objects are blue, while in images taken under a low color temperature light source, white objects are red. Correcting the color shift caused by different color temperatures so that white objects appear truly white is called white balance processing. Existing white balance algorithms are mainly divided into two categories: white balance algorithms based on certain assumptions and white balance algorithms based on a large amount of prior knowledge. Among them, white balance algorithms based on certain assumptions only use the information of the image itself and do not rely on prior knowledge. Such classic algorithms include gray world algorithms, white block algorithms, etc. Such algorithms are simple in principle, convenient for hardware implementation, and are widely used. However, when the assumption premise does not hold, such algorithms are prone to failure. Another type of white balance algorithm is based on a large amount of prior knowledge: by learning the distribution of image chromaticity under known light sources, and then inferring the light source of the current scene based on the chromaticity distribution of images under unknown light sources. For example, color correlation algorithms, color gamut mapping algorithms, neural network algorithms, etc. This type of algorithm has relatively good results and is suitable for occasions with higher requirements. However, a large number of samples are required to build prior knowledge, and the implementation process is complex and resource-intensive. Summary of the invention

[0003] In view of this, the present invention provides an automatic white balance correction method, device and computer storage medium to solve the deficiencies of the prior art.

[0004] In order to achieve the above object, the present invention adopts the following technical scheme:

[0005] An embodiment of the present invention provides an automatic white balance correction method, comprising:

[0006] Determine the white pixel statistical area according to the chromaticity distribution characteristics of the white pixel points under the light source;

[0007] Counting the pixel points of the image to be corrected that fall into the white pixel statistical area, and calculating the white balance gain;

[0008] Performing a rough correction on the image to be corrected according to the white balance gain;

[0009] Convert the calibrated image from RGB color space to YUV space, and select white pixels in YUV space;

[0010] Calculate the average chromaticity and color deviation error of white pixels in YUV space;

[0011] When the color cast error is greater than a preset value, a fine color cast correction gain is used to perform fine correction on the roughly corrected image.

[0012] Furthermore, the “counting the pixel points of the image to be corrected that fall into the white pixel counting area and calculating the white balance gain” specifically includes:

[0013] Determine whether the RGB components of each pixel of the image to be corrected satisfy the formula

[0014] L1<R<L2, L1<G<L2, L1<B<L2, where L1 and L2 are the minimum threshold and maximum threshold of white pixels respectively;

[0015] If the pixel satisfies the above formula, the R / G ratio and the B / G ratio of the pixel are calculated, and it is determined whether it falls in the white pixel statistical area; if it falls in the white pixel statistical area, the pixel is determined to be a white pixel;

[0016] The RGB components of all pixels judged as white pixels are accumulated and recorded as SumR, SumG, and SumB respectively. The white balance gain calculation expression is as follows:

[0017] Among them, R gain is the white balance gain of the R component, B gain is the B component white balance gain.

[0018] Furthermore, the corrected image is converted from the RGB color space to the YUV space, and in the YUV space, pixels satisfying the formula |U|+|V|+θ<Y×T are selected as white pixels; wherein θ is a bias control parameter and T is a slope control parameter.

[0019] Furthermore, the corrected image is converted from RGB color space to YUV space using the following formula:

[0020] Furthermore, the fine color deviation correction gain is obtained recursively step by step, and the fine color deviation correction gain of a certain level is equal to the sum of the fine color deviation correction gain of the previous level and the revised value corresponding to the average chromaticity of the level.

[0021] Furthermore, the fine color shift correction gain adopts the following formula:

[0022]

[0023] Where, μ is the fixed adjustment step size, μ>0; F(x) is the adaptive adjustment step size function, R gain (0)=1,Bf gain (0) = 1; is the average chromaticity of the V component and the U component.

[0024] Further, the image to be corrected is roughly corrected according to the white balance gain using the following formula R os =R gain ×R i ,B os =B gain ×B i , where R os ,R gain ,R i are the R component of the pixel after coarse correction, the R component white balance gain, and the R component of the pixel before coarse correction; B os ,B gain ,B i They are respectively the B component of the pixel after coarse correction, the B component white balance gain and the B component of the pixel before coarse correction; the fine color deviation correction gain is used to perform fine correction on the coarsely corrected image using the following formula R of =Rf gain ×R os ,B of =Bf gain ×B os , where R of ,Rf gain ,R os are the R component of the pixel after fine color deviation correction, the R component fine color deviation correction gain, and the R component of the pixel before fine color deviation correction; B of ,Bf gain ,B os They are respectively the B component of the pixel after fine color deviation correction, the B component fine color deviation correction gain, and the B component of the pixel before fine color deviation correction.

[0025] Furthermore, the average chromaticity of white pixels in YUV space is calculated using the following formula:

[0026] in Represent the average chromaticity of U component and V component respectively; Ω represents the coordinate set of all pixels marked as white, and N represents the total number of all pixels marked as white;

[0027] The color deviation error is calculated using the following formula:

[0028] An embodiment of the present invention provides an automatic white balance correction device, comprising:

[0029] An area determination module is used to determine a white pixel statistical area according to the chromaticity distribution characteristics of white pixels under the light source;

[0030] A statistical calculation module, used for counting the pixel points of the image to be corrected that fall into the white pixel statistical area, and calculating the white balance gain;

[0031] A coarse correction module, used for performing coarse correction on the image to be corrected according to the white balance gain;

[0032] The conversion selection module is used to convert the correction image from the RGB color space to the YUV space and select the white pixel points in the YUV space;

[0033] Color deviation calculation module, used to calculate the average chromaticity and color deviation error of white pixels in YUV space;

[0034] A judgment module, used to judge whether the color deviation error is greater than a preset value;

[0035] The fine correction module is used to perform fine correction on the roughly corrected image using the fine color deviation correction gain when the determination module determines that the result is true.

[0036] Furthermore, the statistical calculation module is specifically applied to

[0037] Determine whether the RGB components of each pixel of the image to be corrected satisfy the formula

[0038] L1<R<L2, L1<G<L2, L1<B<L2, where L1 and L2 are the minimum threshold and maximum threshold of white pixels respectively;

[0039] If the pixel satisfies the above formula, the R / G ratio and the B / G ratio of the pixel are calculated, and it is determined whether it falls in the white pixel statistical area; if it falls in the white pixel statistical area, the pixel is determined to be a white pixel;

[0040] The RGB components of all pixels judged as white pixels are accumulated and recorded as SumR, SumG, and SumB respectively. The white balance gain calculation expression is as follows:

[0041] Among them, R gain is the white balance gain of the R component, B gain is the B component white balance gain.

[0042] Furthermore, the conversion selection module converts the corrected image from the RGB color space to the YUV space, and selects the pixel points satisfying the formula |U|+|V|+θ<Y×T as white pixel points in the YUV space; wherein θ is a bias control parameter and T is a slope control parameter.

[0043] Furthermore, the conversion selection module converts the corrected image from the RGB color space to the YUV space using the following formula:

[0044] Furthermore, the fine color deviation correction gain used by the fine correction module is obtained recursively step by step, and the fine color deviation correction gain of a certain level is equal to the sum of the fine color deviation correction gain of the previous level and the revised value corresponding to the average chromaticity of the level.

[0045] Furthermore, the fine color shift correction gain used by the fine correction module adopts the following formula:

[0046]

[0047] Where, μ is the fixed adjustment step size, μ>0; F(x) is the adaptive adjustment step size function, R gain (0)=1,Bf gain (0) = 1; is the average chromaticity of the V component and the U component.

[0048] An embodiment of the present invention further provides a computer device, comprising: a memory and a processor;

[0049] The memory is used to store computer programs;

[0050] The processor is used to execute the steps of the above automatic white balance correction method when running the computer program.

[0051] An embodiment of the present invention further provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above automatic white balance correction method are implemented.

[0052] The prior knowledge required for the automatic white balance correction method provided by the present invention is easy to construct, the algorithm is simple and easy to implement by hardware, and the correction effect is good. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0054] Figure 1 A schematic diagram of a flow chart of an automatic white balance correction method provided by an embodiment of the present invention;

[0055] Figure 2 Schematic diagram of a white pixel statistical area in a color ratio space in Embodiment 1 of the present invention;

[0056] Figure 3 A schematic flow chart of an automatic white balance correction method provided by another embodiment of the present invention;

[0057] Figure 4 A schematic structural diagram of an automatic white balance correction device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] Figure 1 The figure is a flow chart of an automatic white balance correction method provided by an embodiment of the present invention. The method comprises the following steps:

[0060] S101, determining a white pixel statistical area according to chromaticity distribution characteristics of white pixel points under a light source.

[0061] Select a set of light sources and divide the white pixel statistical area by learning the distribution of image chromaticity under known light sources. Generally, the choice of light source can be different according to the application scenario of the image processor. Common light sources and as many types as possible should be selected.

[0062] Multiple frames of standard color card images are taken at different color temperatures, and the multiple frames taken at the same color temperature are averaged to obtain an average frame. The R / G and B / G average values ​​of all grayscale blocks of the standard color card in the average frame are calculated, where R / G represents the ratio of the red component value of a pixel to its green component value, and B / G represents the ratio of the blue component value of a pixel to its green component value. The white pixel statistical area in the color ratio space is marked according to the calculated average values ​​of each group (R / G, B / G).

[0063] Among them, Figure 2As shown in the figure, the black triangles represent the points corresponding to the average values ​​of each group (R / G, B / G) in the color ratio space, and the white pixel statistical area can be divided into a curve area A and a rectangular frame area B (B1, B2, ...). Among them, the average values ​​of R / G and B / G of the grayscale blocks corresponding to most light sources will fall in the curve area A, while a few light sources will deviate from the curve area, so these light sources are divided into areas separately and form a rectangular frame area B.

[0064] S102 , counting the pixel points of the image to be corrected that fall into the white pixel counting area, and calculating the white balance gain.

[0065] Counting the pixel points of the image to be corrected that fall into the white pixel statistical area and calculating the white balance gain specifically include:

[0066] Determine whether the RGB components of each pixel of the image to be corrected satisfy formula (1)

[0067] L1<R<L2,L1<G<L2,L1<B<L2 (1)

[0068] Wherein, L1 and L2 are the minimum threshold and maximum threshold of white pixels respectively; if the pixel satisfies the above formula (1), calculate the R / G ratio and B / G ratio of the pixel, and judge whether it falls in the white pixel statistical area (area A or area B); if it falls in the white pixel statistical area, judge the pixel to be a white pixel; add up the RGB components of all pixels judged to be white pixels, respectively recorded as SumR, SumG, SumB, and the white balance gain calculation expression is shown in formula (2):

[0069]

[0070] Among them, R gain is the white balance gain of the R component, B gain is the B component white balance gain.

[0071] S103 , roughly correcting the image to be corrected according to the white balance gain.

[0072] The white balance gain is roughly corrected for the image to be corrected using the following formula (3):

[0073] R os =R gain ×R i ,B os =B gain ×B i (3)

[0074] Among them, R os ,R gain ,R iare the R component of the pixel after coarse correction, the R component white balance gain, and the R component of the pixel before coarse correction; B os ,B gain ,B i They are respectively the B component of the pixel after coarse correction, the B component white balance gain, and the B component of the pixel before coarse correction.

[0075] The white pixel statistical area determined in S101 can select white pixels under different color temperatures, but at the same time, some non-white pixels may also fall into the white pixel statistical area and be judged as white pixels, and participate in the calculation of white balance gain. When the proportion of non-white points is large and obviously biased to a certain color, the calculated white balance correction gain at this time makes the corrected image still have a certain color cast. Therefore, the image after rough correction may still have a slight color cast, and further fine correction is required.

[0076] S104, converting the corrected image from the RGB color space to the YUV space, and selecting white pixels in the YUV space.

[0077] Specifically, the coarse correction image can be converted from the RGB color space to the YUV color space according to formula (4).

[0078]

[0079] In an image without color cast, white pixels satisfy Y=R=G=B, U=V=0. The degree of color cast of images taken under different light sources is unknown, and may be severe or slight. However, after the image is roughly corrected, the degree of color cast is corrected to a smaller range, so white pixels can be selected more accurately. In the YUV space, pixels that satisfy formula (5) are selected as white pixels.

[0080] |U|+|V|+θ<Y×T (5);

[0081] Among them, || represents the absolute value, θ is the bias control parameter, and T is the slope control parameter. The parameters of θ and T can be set in advance according to user needs.

[0082] S105, calculating the average chromaticity and color deviation error of white pixels in the YUV space.

[0083] As shown in formula (6), the average chromaticity of all pixels marked as white is calculated.

[0084]

[0085] in, They represent the average chromaticity of the U component and the V component respectively; Ω represents the coordinate set of all pixels marked as white, and N represents the total number of pixels marked as white.

[0086] As shown in formula (7), the color shift error value is calculated.

[0087]

[0088] The larger the color cast error value is, the more color cast the current image has.

[0089] S106 : When the color cast error is greater than a preset value, use a fine color cast correction gain to perform fine correction on the roughly corrected image.

[0090] like Figure 3 As shown, when the color deviation error is less than or equal to the preset value ε, that is, E≤ε, ε is a small value, the image does not need to be fine-calibrated again, and the image can be directly output S107. When the color deviation error is greater than the preset value ε, that is, E>ε, ε is a small value, the image needs to be fine-calibrated again. After the fine calibration is completed, the white pixel point is selected after the RGB color space is converted to the YUV space, and the average chromaticity and color deviation error of the white pixel point are calculated until the color deviation error is less than or equal to the preset value ε. The specific steps are as follows:

[0091] S1061, determining whether the color deviation error is greater than a preset value.

[0092] S1062: When the determination result is true, a preset formula is used to calculate a fine color cast correction gain.

[0093] The fine color deviation correction gain is obtained by recursion step by step, and the fine color deviation correction gain of a certain level is equal to the sum of the fine color deviation correction gain of the previous level and the revised value corresponding to the average chromaticity of the level. The use of step-by-step recursion can ensure that the determination of the fine color deviation correction gain is more accurate and convenient to calculate.

[0094] The fine color cast correction gain uses formula (8):

[0095]

[0096] Where, μ is the fixed adjustment step size, μ>0; F(x) is the adaptive adjustment step size function, R gain (0)=1,Bf gain (0) = 1; The average chromaticity of the V component and the U component. The parameter μ can be set in advance according to user needs. The fine color correction gain used for the first fine color correction of the R component in The average chromaticity of the V component of the white pixel after the first spatial conversion. The fine color correction gain used for the second fine color correction of the R component in is the average chromaticity of the V component of the white pixel after the second spatial conversion. And so on. The same is true for the B component.

[0097] S1063: Use the fine color cast correction gain to perform fine correction on the image.

[0098] Use the fine color cast correction gain to fine-tune the corrected image using formula (9):

[0099] R of =Rf gain ×R os ,B of =Bf gain ×B os (9)

[0100] Among them, R of ,Rf gain ,R os are the R component of the pixel after fine color deviation correction, the R component fine color deviation correction gain, and the R component of the pixel before fine color deviation correction; B of ,Bf gain ,B os They are respectively the B component of the pixel after fine color deviation correction, the B component fine color deviation correction gain, and the B component of the pixel before fine color deviation correction.

[0101] After each fine correction, the corrected data returns to S104 to repeatedly perform fine correction processing until the color deviation error is less than or equal to the preset value ε.

[0102] Figure 4 FIG. 1 is a schematic diagram of the structure of an automatic white balance correction device provided by an embodiment of the present invention, comprising:

[0103] The area determination module is used to determine the white pixel statistical area according to the chromaticity distribution characteristics of the white pixel points under the light source.

[0104] The statistical calculation module is used to count the pixel points of the image to be corrected that fall into the white pixel statistical area and calculate the white balance gain.

[0105] The coarse correction module is used to perform coarse correction on the image to be corrected according to the white balance gain.

[0106] The conversion selection module is used to convert the calibrated image from the RGB color space to the YUV space and select white pixels in the YUV space.

[0107] The color deviation calculation module is used to calculate the average chromaticity and color deviation error of white pixels in the YUV space.

[0108] The judgment module is used to judge whether the color deviation error is greater than a preset value.

[0109] The fine correction module is used to perform fine correction on the roughly corrected image using the fine color deviation correction gain when the determination module determines that the result is true.

[0110] The statistical calculation module is specifically used for

[0111] Determine whether the RGB components of each pixel of the image to be corrected satisfy the formula

[0112] L1<R<L2, L1<G<L2, L1<B<L2, where L1 and L2 are the minimum threshold and maximum threshold of white pixels respectively.

[0113] If the pixel satisfies the above formula, the R / G ratio and B / G ratio of the pixel are calculated, and it is determined whether it falls in the white pixel statistical area; if it falls in the white pixel statistical area, the pixel is determined to be a white pixel.

[0114] The RGB components of all pixels judged as white pixels are accumulated and recorded as SumR, SumG, and SumB respectively. The white balance gain calculation expression is as follows:

[0115] Among them, R gain is the white balance gain of the R component, B gain is the B component white balance gain.

[0116] The conversion module converts the corrected image from RGB color space to YUV space using the following formula: In the YUV space, the pixel points that satisfy the formula |U|+|V|+θ<Y×T are selected as white pixel points; wherein θ is the bias control parameter and T is the slope control parameter.

[0117] The fine color cast correction gain used by the fine correction module adopts the following formula:

[0118]

[0119] Where, μ is the fixed adjustment step size, μ>0; F(x) is the adaptive adjustment step size function, R gain (0)=1,Bf gain (0) = 1; is the average chromaticity of the V component and the U component.

[0120] It should be noted that: when the automatic white balance correction device provided in the above embodiment performs correction, only the division of the above program modules is used as an example. In actual application, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the above-described processing. In addition, the automatic white balance correction device provided in the above embodiment and the automatic white balance correction method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment. The beneficial effects are the same as those in the method embodiment, and will not be repeated here.

[0121] The embodiment of the present invention further provides a computer device, comprising: a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the steps of the automatic white balance correction method of the present invention when running the computer program.

[0122] The embodiment of the present invention further provides a computer storage medium, which is a computer-readable storage medium, on which a computer program is stored, and the computer program can be executed by a processor of a computer device to complete the steps of the above-mentioned automatic white balance correction method. The computer-readable storage medium can be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM).

[0123] In the several embodiments provided by the present invention, it should be understood that the disclosed methods and intelligent devices can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0124] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0125] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. An automatic white balance correction method, characterized in that: include: Determine the white pixel statistical area according to the chromaticity distribution characteristics of the white pixel points under the light source; Counting the pixel points of the image to be corrected that fall into the white pixel statistical area, and calculating the white balance gain; Performing a rough correction on the image to be corrected according to the white balance gain; Convert the calibrated image from RGB color space to YUV space, and select white pixels in YUV space; Calculate the average chromaticity and color deviation error of white pixels in YUV space; When the color deviation error is greater than a preset value, a fine color deviation correction gain is used to perform fine correction on the roughly corrected image; The fine color deviation correction gain is obtained recursively step by step, and the fine color deviation correction gain of a certain level is equal to the sum of the fine color deviation correction gain of the previous level and the revised value corresponding to the average chromaticity of the level.

2. The method according to claim 1, characterized in that The "counting the pixel points of the image to be corrected that fall into the white pixel counting area and calculating the white balance gain" specifically includes: Determine whether the RGB components of each pixel of the image to be corrected satisfy the formula L1<R<L2, L1<G<L2, L1<B<L2, where L1 and L2 are the minimum threshold and maximum threshold of white pixels respectively; If the pixel satisfies the above formula, the R / G ratio and the B / G ratio of the pixel are calculated, and it is determined whether it falls in the white pixel statistical area; if it falls in the white pixel statistical area, the pixel is determined to be a white pixel; The RGB components of all pixels judged as white pixels are accumulated and recorded as SumR, SumG, and SumB respectively. The white balance gain calculation expression is as follows: Among them, R gain is the white balance gain of the R component, B gain is the B component white balance gain.

3. The method according to claim 1, characterized in that The corrected image is converted from the RGB color space to the YUV space, and in the YUV space, the pixels that satisfy the formula |U|+|V|+θ<Y×T are selected as white pixels; where θ is the bias control parameter and T is the slope control parameter.

4. The method according to claim 1, characterized in that: The fine color shift correction gain adopts the following formula: Where, μ is the fixed adjustment step size, μ>0; F(x) is the adaptive adjustment step size function, R gain (0)=1,Bf gain (0) = 1; is the average chromaticity of the V component and the U component.

5. The method according to claim 1, characterized in that According to the white balance gain, the image to be corrected is roughly corrected using the following formula R os =R gain ×R i ,B os =B gain ×B i , where R os ,R gain ,R i are the R component of the pixel after coarse correction, the R component white balance gain, and the R component of the pixel before coarse correction; B os ,B gain ,B i They are respectively the B component of the pixel after coarse correction, the B component white balance gain and the B component of the pixel before coarse correction; the fine color deviation correction gain is used to perform fine correction on the coarsely corrected image using the following formula R of =Rf gain ×R os ,B of =Bf gain ×B os , where R of ,Rf gain ,R os are the R component of the pixel after fine color deviation correction, the R component fine color deviation correction gain, and the R component of the pixel before fine color deviation correction; B of ,Bf gain ,B os They are respectively the B component of the pixel after fine color deviation correction, the B component fine color deviation correction gain, and the B component of the pixel before fine color deviation correction.

6. An automatic white balance correction device, characterized in that: include: An area determination module is used to determine a white pixel statistical area according to the chromaticity distribution characteristics of white pixels under the light source; A statistical calculation module, used for counting the pixel points of the image to be corrected that fall into the white pixel statistical area, and calculating the white balance gain; A coarse correction module, used for performing coarse correction on the image to be corrected according to the white balance gain; The conversion selection module is used to convert the correction image from the RGB color space to the YUV space and select the white pixel points in the YUV space; Color deviation calculation module, used to calculate the average chromaticity and color deviation error of white pixels in YUV space; A judgment module, used to judge whether the color deviation error is greater than a preset value; A fine correction module, used for performing fine correction on the roughly corrected image using a fine color deviation correction gain when the judgment module judges that the image is true; The fine color deviation correction gain is obtained recursively step by step, and the fine color deviation correction gain of a certain level is equal to the sum of the fine color deviation correction gain of the previous level and the revised value corresponding to the average chromaticity of the level.

7. The device according to claim 6, characterized in that The statistical calculation module is specifically applied to Determine whether the RGB components of each pixel of the image to be corrected satisfy the formula L1<R<L2, L1<G<L2, L1<B<L2, where L1 and L2 are the minimum threshold and maximum threshold of white pixels respectively; If the pixel satisfies the above formula, the R / G ratio and the B / G ratio of the pixel are calculated, and it is determined whether it falls in the white pixel statistical area; if it falls in the white pixel statistical area, the pixel is determined to be a white pixel; The RGB components of all pixels judged as white pixels are accumulated and recorded as SumR, SumG, and SumB respectively. The white balance gain calculation expression is as follows: Among them, R gain is the white balance gain of the R component, B gain is the B component white balance gain.

8. The device according to claim 6, characterized in that The conversion selection module converts the corrected image from the RGB color space to the YUV space, and selects the pixel points satisfying the formula |U|+|V|+θ<Y×T as white pixel points in the YUV space; wherein θ is a bias control parameter and T is a slope control parameter.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Image processing apparatus and image processing method and imaging apparatus

    CN101389039A

  • Image white balancing processing method, device, storage medium and electronic equipment

    CN107911683A