White balance correction method under uneven lighting conditions

By performing illumination correction in the HSV color space, and combining the R/G-B/G feature function and white color temperature curve at different color temperatures, efficient white balance correction for uneven light images is achieved, solving the problem of color casting of images under uneven light in the prior art.

CN115767059BActive Publication Date: 2025-04-22HEFEI CITY UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211377560.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-04
Publication Date
2025-04-22
Estimated Expiration
2042-11-04

AI Technical Summary

Technical Problem

The existing white balance algorithm based on color temperature estimation is difficult to accurately correct the color cast of the image under uneven lighting conditions, resulting in the still color cast of the brightness area and the shadow area.

Method used

By converting the original image to the HSV color space, performing illumination correction, and then using the R/G-B/G characteristic function and white color temperature curve at different color temperatures to perform white balance correction. Specific steps include lighting correction, obtaining R/G-B/G feature function, estimating the image color temperature value, obtaining the white color temperature curve, calculating the white balance adjustment gain coefficient, and finally performing image white balance correction.

Benefits of technology

This method can more accurately correct the color cast of uneven light images, improve the accuracy of white balance correction, make the overall brightness of the image more uniform, and significantly improve the color casting situation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115767059B_ABST
    Figure CN115767059B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of image white balance correction, and specifically relates to a white balance correction method under uneven illumination. It includes: taking an original image A, converting the original image A from an RGB color space to an HSV color space; performing illumination correction on the V component of the HSV color space, converting the HSV color space to an RGB color space after illumination correction, and obtaining an image AC after illumination correction; obtaining R / G‑B / G characteristic functions under different color temperatures; estimating the color temperature value of image AC; obtaining a white color temperature curve; obtaining white balance adjustment gain coefficients Rgain and Bgain according to the R / G and B / G values ​​of the white color temperature curve; and performing white balance correction on image AC. When the present invention is used, for images with uneven illumination, a method of first performing illumination correction to make the overall brightness of the image more uniform, and then performing white balance correction is adopted, which can better achieve the purpose of color cast correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image white balance correction, and in particular relates to a white balance correction method under uneven illumination conditions. Background Art

[0002] The currently used white balance algorithm based on color temperature estimation is based on the fact that under the same light source, the R / G and B / G values ​​of gray tones are fixed within a certain range, and the R / G and B / G of the same color temperature are basically concentrated in a relatively certain range. The image pixels are statistically analyzed based on the R / G and B / G values ​​of the pixels in the image to determine the color temperature of the image light source, and the corresponding gain value is calculated based on the color temperature to achieve image white balance processing.

[0003] In this method, the construction of the R / GB / G characteristic function is for a commonly used specific light environment and cannot reflect more color temperature conditions. In addition, the construction of the R / GB / G characteristic function adopts a function to perform curve fitting, and the fitting error is large, which leads to an increase in the color temperature estimation error.

[0004] The above errors may also occur due to natural factors such as lighting conditions and weather factors, especially the influence of uneven lighting caused by light factors and light blocking. The collected images may have insufficient contrast in local areas, uneven grayscale values, shadow areas, local reflections and highlight areas. Such image pixels are directly involved in color temperature estimation, and white balance correction is inaccurate. After white balance correction, the brightness area and shadow area are still "color cast". Summary of the invention

[0005] In view of the deficiencies in the prior art, the technical problem to be solved by the present invention is to provide a white balance correction method under uneven illumination conditions, which can better correct the "color cast" of images with uneven illumination.

[0006] The present invention provides a method for correcting white balance under uneven illumination, including the following methods:

[0007] Take the original image A and convert it from RGB color space to HSV color space;

[0008] Perform illumination correction on the V component of the HSV color space, and after illumination correction, convert the HSV color space into the RGB color space to obtain an illumination-corrected image AC;

[0009] The acquisition of the characteristic function of R / GB / G under different color temperatures is specifically as follows: colorchecker images under different color temperature values ​​are collected, wherein the color temperature values ​​are n, and n is at least 5, and the characteristic function of R / GB / G is divided into n segments based on the R / G value, and the R / G and B / G values ​​of the color blocks of the image in the RGB color space under different color temperatures are calculated respectively, and the relationship between R / G and B / G of each segment is piecewise curve fitted using a quadratic function to obtain the R / GB / G characteristic function Y under different color temperatures. n (X);

[0010] Estimate the color temperature value of image AC, specifically: calculate the average value of R, G, B of image AC, then calculate the R / G and B / G values ​​in image AC, and according to the R / G and B / G values ​​of image AC, calculate the R / GB / G characteristic function Y under different color temperatures n (X), through the interpolation method, the color temperature value of image AC is obtained, assuming that the color temperature value is K;

[0011] The acquisition of the white color temperature curve is as follows: take the standard white card image under different color temperature values, and according to the R / G and B / G values, use different quadratic functions to segmentally fit the white color temperature curve to obtain the white color temperature curve: F m (X);

[0012] According to the R / G and B / G values ​​on the white color temperature curve, the white balance adjustment gain coefficients Rgain and Bgain are obtained. Specifically, according to the white color temperature curve F m (X), perform white balance correction on the standard white card image at different color temperatures, and calculate the white balance adjustment gain coefficients Rgain and Bgain at the R / G and B / G values;

[0013] Image AC is subjected to white balance correction processing, specifically: image AC is mapped to a white background, assuming that the corresponding R / G and B / G values ​​when the color temperature value is K in the white color temperature curve are R' / G' and B' / G' respectively, and the white balance gain coefficients Rgain and Bgain are adjusted according to the R' / G' and B' / G' values. The Ri value in the color data of image AC is multiplied by Rgain to obtain the corrected Ro value, and the Bi value in the pixel value of image AC is multiplied by Bgain to obtain the corrected Bo value. Image AC is corrected by correcting the Ro value and the Bo value, and the processing of the original image is completed.

[0014] Furthermore, the following method is used when performing illumination correction on the V component of the HSV color space:

[0015] Take two brightness values ​​a and b, divide the brightness level of the image V component into 3 segments, and use different correction coefficients for each segment. The correction coefficients are shown in formula 1:

[0016]

[0017] in, is the average value of the image brightness component;

[0018] Then the exponential correction function is used as V' = V 1 / γ(v) The V component is corrected, where V' is the value of the V component after correction.

[0019] In the illumination correction part, the brightness level of the image V component is divided into three segments. According to the brightness, each segment uses a different correction function to correct it, reducing the area with too high brightness and improving the area with too low brightness; making the overall brightness of the image more uniform, which is convenient for accurately estimating the image color temperature. In addition, this algorithm is simple, easy to implement, and adaptive.

[0020] Furthermore, when calculating the R / GB / G characteristic functions at different color temperatures, five color temperature values ​​are collected, namely 2400K, 3200K, 4500K, 5800K and 7500K.

[0021] Furthermore, the white color temperature curve is used to calculate white balance adjustment gain coefficients Rgain and Bgain at different color temperatures. The white color temperature curve is generated by piecewise fitting to improve the accuracy of calculation of the adjustment gain coefficients Rgain and Bgain.

[0022] Furthermore, the white balance adjustment gain coefficients Rgain and Bgain are processed according to the white color temperature curve F m (X), perform white balance correction on the standard white card image at different color temperatures, and calculate the white balance adjustment gain coefficients Rgain=G / R and Bgain=G / B at the R / G and B / G values. By analogy, the adjustment gain coefficients Rgain and Bgain corresponding to different R / G and B / G values ​​can be obtained, and a lookup table corresponding to the R / G and B / G values ​​and the adjustment gain coefficients Rgain and Bgain can be established.

[0023] Compared with the prior art, the present invention has the following beneficial effects:

[0024] When the present invention is used, for images with uneven illumination, different correction coefficients are used for illumination correction for different image brightness ranges, so that the overall brightness of the image is more uniform, and then the method for white balance correction is performed, which can better achieve the purpose of color cast correction. In addition, the construction of the R / GB / G characteristic function adopts quadratic function piecewise fitting, and the color temperature estimation is obtained by interpolation, which improves the accuracy of color temperature estimation and makes white balance correction more accurate. The problem of "color cast" of images with uneven illumination is better solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a flowchart of the method of the present invention;

[0026] Figure 2 is the R / GB / G characteristic function curve;

[0027] Figure 3 This is the white color temperature curve. DETAILED DESCRIPTION

[0028] The present invention is further described below through specific embodiments in conjunction with the accompanying drawings, but the present invention is not limited thereto. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0029] Example

[0030] The quality evaluation method after image processing adopted in this embodiment is as follows:

[0031] Use the hue mean C awb Objectively evaluate the effect of white balance. The lower the average color value, the better the white balance effect.

[0032]

[0033] In the formula, C ar is pixel C in the figure r The average value, C br is pixel C in the figure b The average value of .

[0034] in,

[0035] m,n are the C r , C b The number of ri ,C bi is its corresponding value.

[0036] In addition, the information entropy H(X) is selected for comparison. The larger the information entropy, the more information the image contains; the stronger the contrast, the clearer the details of the object.

[0037]

[0038] where p i (x) is the probability of each gray level appearing.

[0039] This embodiment uses the captured road image and lake surface image to perform white balance correction processing respectively.

[0040] 1. Before processing, the evaluation indicators of road images and lake images are as follows:

[0041] The mean hue of the road image is 10.624, and the information entropy is 7.283;

[0042] The mean hue of the lake image is 22.279 and the information entropy is 7.299.

[0043] The color temperature of the original road image is 2800K. The image has color cast and the overall color is yellowish. Due to the obstruction of tree branches and leaves, there are shadow areas in the original image and uneven lighting.

[0044] The color temperature of the original image of the lake surface is 5900K, the overall image is blue, and the light is blocked by tree branches, resulting in uneven lighting on the lake surface and the plants on the shore.

[0045] Second, use the general existing known method to process the image, the specific method is as follows:

[0046] The R / G and B / G of the same color temperature are basically concentrated in a relatively certain range. The image pixels are statistically analyzed based on the R / G and B / G values ​​of the pixels in the image, and a curve is used to fit the R / G-B / G function to obtain the distribution relationship of R / G and B / G under different color temperatures. The color temperature of the image light source is determined by a lookup table, and the number of pixels under each color temperature of the image to be corrected is calculated. The color temperature with the largest number of pixels is the color temperature of the light source. According to the average values ​​of R, G, B and the mean value of the gray points in the image, the adjustment gain coefficient is calculated to achieve image white balance processing.

[0047] The evaluation indicators of road images and lake images processed by the above general method are as follows:

[0048] The mean hue of the road image is 7.319, and the information entropy is 7.476;

[0049] The mean hue of the lake image is 12.133 and the information entropy is 7.524.

[0050] After using the above general method, the color cast of the road has been improved to a certain extent, but the sky and the grass and road surface whose light is blocked by tree branches are still cast in color, which appears to be over-corrected and the color tone is unnatural.

[0051] The color cast of the lake surface has been improved to a certain extent by using the general method mentioned above, but the plants on the shore and the lake surface near the shore are still cast in color, indicating an over-correction.

[0052] 3. The new method is used to process the road image and lake image, as follows:

[0053] 1. Convert the original image A from RGB color space to HSV color space using the formula:

[0054] R'=R / 255

[0055] G'=G / 255

[0056] B'=B / 255

[0057] Cmax=max(R',G',B')

[0058] Cmin=min(R',G',B')

[0059] Δ=Cmax-Cmin

[0060]

[0061]

[0062] V=Cmax.

[0063] 2. Perform illumination correction for the V brightness component of the HSV color space,

[0064] Take two brightness values ​​a and b, divide the brightness level of the image V component into 3 segments, and use different correction coefficients for each segment. The correction coefficients are shown in formula 1:

[0065]

[0066] in, is the average value of the image brightness component;

[0067] Then the exponential correction function is used as V' = V 1 / γ(v) The V component is corrected, where V' is the value of the V component after correction.

[0068] After illumination correction, the HSV color space is converted to the RGB color space to obtain the illumination-corrected image AC using the following formula:

[0069] C=V×S

[0070] X=C×(1-|(H / 60°)mod2-1|)

[0071] m=VC

[0072]

[0073] (R,G,B)=((R'+m)×255,(G'+m)×255,(B'+m)×255)

[0074] 3. Obtaining the R / GB / G characteristic functions at different color temperatures, specifically:

[0075] (1) collecting colorchecker images at different color temperature values, wherein the color temperature values ​​are 5, namely 2400K, 3200K, 4600K, 5800K, and 7500K;

[0076] (2) Collect the 13th to 24th color block images of the colorchecker image at different color temperatures, and calculate the R / G and B / G values ​​of each color block at the same color temperature, for a total of 12;

[0077] (3) Since the R / G and B / G of the same color temperature are basically concentrated in a relatively certain range, R / G is the horizontal axis and B / G is the vertical axis. A quadratic function Y is used to calculate the relationship between R / G and B / G at each color temperature. i (x) = a i x i 2 +b i x i +c i Perform curve fitting;

[0078] (4) R / G value: When selecting the color temperature value, the continuity of the R / GB / G curve must be ensured;

[0079] (5) Based on the R / G value, the R / GB / G characteristic function can be divided into 5 segments to obtain the R / GB / G characteristic function Y under different color temperatures. n (x) = a n x n 2 +b n x n +c n , n=1,2,3…5.

[0080] In actual operation, the color temperature value can also use 5 or more color temperature values. When the number of color temperature values ​​used is more, the R / GB / G characteristic function is more accurate.

[0081] The obtained R / GB / G feature functions are as follows: Figure 2 shown.

[0082] 4. Estimate the color temperature value of image AC, specifically:

[0083] (1) Calculate the average values ​​of R, G, and B of image AC;

[0084] (2) Then calculate the R / G and B / G values ​​in image AC, x = R / G, y = B / G;

[0085] (3) Substitute x=R / G into the segmented R / GB / G feature function Y in the corresponding range according to the value of R / G n (x) = an x n 2 +b n x n +c n , assuming that the characteristic function Y corresponding to the i-th segment i (x), n ranges from 1 to 5;

[0086] (4) Corresponding to x = R / G, in the characteristic function Y i (x) The color temperature value of image AC is calculated by interpolation method, assuming that the color temperature value is K.

[0087] 5. Obtaining the white color temperature curve, specifically:

[0088] (1) Collect standard white card images at different color temperature values;

[0089] (2) Calculate the R / G and B / G values ​​of the standard white card image at different color temperature values;

[0090] (3) The color temperature curve is divided into m segments according to the value range of R / G, and each segment uses the quadratic function F m (X) = a m x m 2 +b m x n +c m Segmented fitting;

[0091] Among them, the R / G value and color temperature value should be selected to ensure the continuity of the R / GB / G curve;

[0092] (4) Get the white color temperature curve: F m (X); R / G is the horizontal axis, B / G is the vertical axis. Figure 3 shown.

[0093] 6. According to the R / G and B / G values ​​on the white color temperature curve, the calculation of the white balance adjustment gain coefficients Rgain and Bgain is obtained, specifically:

[0094] (1) According to the white color temperature curve F m At the (R / G, B / G) point on (X), for the color cast image of the standard white card at different color temperatures, white balance correction is performed by adjusting the gain coefficients Rgain and Bgain;

[0095] (2) Calculate the white balance adjustment gain coefficients Rgain = G / R and Bgain = G / B corresponding to the (R / G, B / G) point on the white color temperature curve. Similarly, the adjustment gain coefficients Rgain and Bgain corresponding to different (R / G, B / G) points on the white color temperature curve can be obtained.

[0096] 7. Image AC is subjected to white balance correction processing, specifically:

[0097] (1) For the illumination-corrected image AC, calculate the average values ​​of R, G, and B;

[0098] (2) Calculate the ratios of R / G and B / G in image AC, x = R / G, y = B / G;

[0099] (3) Map the (R / G, B / G) point of image AC at color temperature K to the white color temperature curve F m (X) at the (R' / G', B' / G') point at color temperature K;

[0100] (4) Calculate the white balance adjustment gain coefficients Rgain and Bgain corresponding to the point (R' / G', B' / G') on the white color temperature curve at color temperature K;

[0101] (5) The pixel values ​​Ri, Gi and Bi of the image AC after illumination correction are multiplied by the adjustment gain value. Assuming that the pixel values ​​of the image AC after illumination correction are Ri, Gi and Bi, and the pixel values ​​after white balance correction are Ro, Go and Bo, the calculation formula is as follows.

[0102] Ro=Ri*Rgain

[0103] Go=Gi*1

[0104] Bo=Bi*Bgain

[0105] Image AC is corrected using Ro, Go and Bo values.

[0106] The evaluation indicators of road images and lake images processed by the above new method are as follows:

[0107] The mean hue of the road image is 4.647, and the information entropy is 7.681;

[0108] The mean hue of the lake image is 10.154 and the information entropy is 7.649.

[0109] After using this method, the overall brightness of the road and lake images is more uniform, the color cast is greatly improved, and the overall effect is good.

[0110] In order to facilitate intuitive comparison, the evaluation indicators after the above general method and the new method are summarized as follows:

[0111]

[0112] From the above table, we can intuitively see that the new method is better than the existing general method in processing images and can better correct the "color cast" of the image.

[0113] In the above method, in order to facilitate the search of the white balance adjustment gain coefficient, the white balance adjustment gain coefficients Rgain and Bgain are processed according to the white color temperature curve F m (X), perform white balance correction on the standard white card image at different color temperatures, and find the white balance adjustment gain coefficients Rgain = G / R and Bgain = G / B at the R / G and B / G values. By analogy, the adjustment gain coefficients Rgain and Bgain corresponding to different R / G and B / G values ​​can be obtained, and a lookup table corresponding to the R / G and B / G values ​​and the adjustment gain coefficients Rgain and Bgain can be established. See the following table.

[0114] Color Temperature R / G B / G 2000K 1.0661 0.7497 2400K 1.0627 0.7372 2800K 1.0543 0.7160 3200K 1.0530 0.7140 3600K 1.0513 0.7119 4000K 1.0509 0.7115 4400K 1.0466 0.7091 4800K 1.0448 0.7092 5200K 1.0433 0.7097 5600K 1.0406 0.7118 6000K 1.0302 0.7337 6400K 1.0247 0.7539 6800K 1.0180 0.7868 7200K 1.0022 0.8998 7600K 0.9921 0.9982 8000K 0.9722 1.2515

Claims

1. A white balance correction method under uneven illumination, characterized in that: The following methods are included: Take the original image A and convert it from RGB color space to HSV color space; Perform illumination correction on the V component of the HSV color space, and after illumination correction, convert the HSV color space into the RGB color space to obtain an illumination-corrected image AC; The acquisition of R / GB / G characteristic functions under different color temperatures is specifically as follows: colorchecker images under different color temperature values ​​are collected, wherein the color temperature values ​​are n, and n is at least 5, and the R / G value is used as a segmentation basis, and the R / GB / G characteristic function is divided into n segments, and the R / G and B / G values ​​of the color blocks of the image in the RGB color space under different color temperatures are calculated respectively, and the relationship between R / G and B / G of each segment is subjected to segmented curve fitting using a quadratic function to obtain the R / GB / G characteristic function Y under different color temperatures. n (X); Estimate the color temperature value of image AC, specifically: calculate the average value of R, G, and B of image AC, then calculate the R / G and B / G values ​​in image AC, and according to the R / G and B / G values ​​of image AC, calculate the R / GB / G characteristic function Y under different color temperatures n (X), through the interpolation method, the color temperature value of image AC is obtained, assuming that the color temperature value is K; The acquisition of the white color temperature curve is as follows: take the standard white card image under different color temperature values, and according to the R / G and B / G values, use different quadratic functions to segmentally fit the white color temperature curve to obtain the white color temperature curve: F m (X); According to the R / G and B / G values ​​on the white color temperature curve, the white balance adjustment gain coefficients Rgain and Bgain are obtained. Specifically, according to the white color temperature curve F m (X), perform white balance correction on the standard white card image at different color temperatures, and calculate the white balance adjustment gain coefficients Rgain and Bgain at the R / G and B / G values; Image AC is subjected to white balance correction processing, specifically: image AC is mapped to a white background, assuming that the R / G and B / G values ​​corresponding to the color temperature value K in the white color temperature curve are R' / G' and B' / G' respectively, according to the white balance adjustment gain coefficients Rgain and Bgain at the R' / G' and B' / G' values, the Ri value in the pixel value of image AC is multiplied by Rgain to obtain the correction Ro value, the Bi value in the pixel value of image AC is multiplied by Bgain to obtain the correction Bo value, the image AC is corrected by the correction Ro value and the correction Bo value, and the original image processing is completed; The following method is used to perform illumination correction on the V component of the HSV color space: Take two brightness values ​​a and b, divide the brightness level of the image V component into 3 segments, and use different correction coefficients for each segment. The correction coefficients are shown in formula 1: in, is the average value of the image brightness component; Then the exponential correction function is V, = V 1 / γ(v) The V component is corrected, where V' is the value of the V component after correction.

2. The method for correcting white balance under uneven illumination according to claim 1, characterized in that: When calculating the R / GB / G characteristic functions at different color temperatures, five color temperature values ​​are collected, namely 2400K, 3200K, 4500K, 5800K and 7500K.

3. The white balance correction method under uneven illumination according to claim 1, characterized in that: The white balance adjustment gain coefficients Rgain and Bgain are processed according to the white color temperature curve F m (X), perform white balance correction on the standard white card image at different color temperatures, and calculate the white balance adjustment gain coefficients Rgain=G / R and Bgain=G / B at different R / G and B / G values. By analogy, the adjustment gain coefficients Rgain and Bgain corresponding to different R / G and B / G values ​​can be obtained, and a lookup table corresponding to the R / G and B / G values ​​and the adjustment gain coefficients Rgain and Bgain can be established.

Citation Information

Patent Citations

  • Enhancement method for low-illumination image

    CN105654437A

  • Image processing method, mobile terminal and computer readable storage medium

    CN108184106A

  • Image processing method and device, terminal and computer readable storage medium

    CN110691226A