patents.google.com

CN101227623B - White balance adjustment method, system and camera - Google Patents

  • ️Wed Jul 04 2012

CN101227623B - White balance adjustment method, system and camera - Google Patents

White balance adjustment method, system and camera Download PDF

Info

Publication number
CN101227623B
CN101227623B CN2008100262668A CN200810026266A CN101227623B CN 101227623 B CN101227623 B CN 101227623B CN 2008100262668 A CN2008100262668 A CN 2008100262668A CN 200810026266 A CN200810026266 A CN 200810026266A CN 101227623 B CN101227623 B CN 101227623B Authority
CN
China
Prior art keywords
reference white
white point
avg
pixel
threshold
Prior art date
2008-01-31
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.)
Expired - Fee Related
Application number
CN2008100262668A
Other languages
Chinese (zh)
Other versions
CN101227623A (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.)
Actions Technology Co Ltd
Original Assignee
Actions Semiconductor 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.)
2008-01-31
Filing date
2008-01-31
Publication date
2012-07-04
2008-01-31 Application filed by Actions Semiconductor Co Ltd filed Critical Actions Semiconductor Co Ltd
2008-01-31 Priority to CN2008100262668A priority Critical patent/CN101227623B/en
2008-07-23 Publication of CN101227623A publication Critical patent/CN101227623A/en
2012-07-04 Application granted granted Critical
2012-07-04 Publication of CN101227623B publication Critical patent/CN101227623B/en
Status Expired - Fee Related legal-status Critical Current
2028-01-31 Anticipated expiration legal-status Critical

Links

  • 238000000034 method Methods 0.000 title claims abstract description 23
  • 238000006243 chemical reaction Methods 0.000 claims description 9
  • 238000004364 calculation method Methods 0.000 claims description 8
  • 238000001514 detection method Methods 0.000 claims description 8
  • 238000001914 filtration Methods 0.000 claims description 6
  • 238000012545 processing Methods 0.000 abstract description 4
  • 238000011156 evaluation Methods 0.000 description 7
  • 230000000694 effects Effects 0.000 description 6
  • 238000010586 diagram Methods 0.000 description 5
  • 238000003384 imaging method Methods 0.000 description 5
  • 230000002411 adverse Effects 0.000 description 3
  • 230000008569 process Effects 0.000 description 3
  • NAWXUBYGYWOOIX-SFHVURJKSA-N (2s)-2-[[4-[2-(2,4-diaminoquinazolin-6-yl)ethyl]benzoyl]amino]-4-methylidenepentanedioic acid Chemical compound C1=CC2=NC(N)=NC(N)=C2C=C1CCC1=CC=C(C(=O)N[C@@H](CC(=C)C(O)=O)C(O)=O)C=C1 NAWXUBYGYWOOIX-SFHVURJKSA-N 0.000 description 1
  • 238000012937 correction Methods 0.000 description 1
  • 230000003247 decreasing effect Effects 0.000 description 1
  • 238000012986 modification Methods 0.000 description 1
  • 230000004048 modification Effects 0.000 description 1
  • 238000012360 testing method Methods 0.000 description 1

Images

Landscapes

  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

本发明适用于图像处理领域,提供了一种白平衡调整方法、系统及摄像装置,所述方法包括:将RGB格式的图像数据转为YCbCr格式的图像数据;对图像中参考白点的色温信息进行评估;根据有效的色温信息计算R、G、B通道的增益,利用所述R、G、B通道的增益调整图像中像素的R、G、B值。本发明在白平衡调整时,对参考白点色温信息的有效性进行评估,针对有效的色温信息进行白平衡调整,可以提高白平衡调整的效率和准确度。

Figure 200810026266

The present invention is applicable to the field of image processing, and provides a white balance adjustment method, system and camera device. The method includes: converting image data in RGB format into image data in YCbCr format; Evaluate; calculate the gains of the R, G, and B channels according to the effective color temperature information, and use the gains of the R, G, and B channels to adjust the R, G, and B values of the pixels in the image. The present invention evaluates the effectiveness of the reference white point color temperature information when adjusting the white balance, and adjusts the white balance based on the effective color temperature information, which can improve the efficiency and accuracy of the white balance adjustment.

Figure 200810026266

Description

一种白平衡调整方法、系统及摄像装置A white balance adjustment method, system and camera device

技术领域 technical field

本发明属于图像处理领域,尤其涉及一种白平衡调整方法、系统及摄像装置。The invention belongs to the field of image processing, and in particular relates to a white balance adjustment method, system and camera device.

背景技术 Background technique

白平衡是摄像机对白色的还原,即在不同的光线环境下摄像机输出的图像都能正确地重现出白色物体的白色,以还原出的白色为基础,还原出其它物体的颜色。目前,摄像机一般都具备有自动白平衡及手动白平衡功能。白平衡调整使得摄像机能够在一定色温范围内自动地进行白平衡校正,其能够自动校正的色温范围一般在2500K~7000K之间。White balance is the restoration of white by the camera, that is, the image output by the camera can correctly reproduce the white of the white object under different light environments, and restore the color of other objects based on the restored white. At present, cameras generally have automatic white balance and manual white balance functions. White balance adjustment enables the camera to automatically perform white balance correction within a certain color temperature range, and the color temperature range that can be automatically corrected is generally between 2500K and 7000K.

白平衡调整大多是建立在灰度世界假设算法上,该算法认为所拍摄图像的R(红)、G(绿)、B(蓝)三色分量的统计平均值应该相等。在该算法的基础上,现有的白平衡调整技术通常在图像中选取部分像素作为参考白点,以参考白点的色温信息作为整幅图像白平衡调整的依据,来调整图像中所有像素的R、G、B值。Most of the white balance adjustments are based on the grayscale world hypothesis algorithm, which believes that the statistical average values of the three color components of R (red), G (green), and B (blue) in the captured image should be equal. On the basis of this algorithm, the existing white balance adjustment technology usually selects some pixels in the image as the reference white point, and uses the color temperature information of the reference white point as the basis for adjusting the white balance of the entire image to adjust the color of all pixels in the image. R, G, B values.

在现有的一种方案中,根据YCbCr(一个亮度信号(Y)和两个色差信号(R-Y、B-Y))色度空间图像中各像素的亮度和色度确定图像中的参考白点,然后根据参考白点调整RGB色度空间图像中像素点的色度。该方案在白平衡调整时没有对图像中的参考白点的色温信息是否有效进行评估,当图像出现浅色区域较多或者较少等现象时,则选取的参考白点的数目可能会出现过多或者过少等情况,此时根据参考白点计算的色温是不准确的,而且在选取参考白点的过程中没有对噪点及色彩溢出进行过滤和防范,从而影响白平衡调整的效率和准确度。In an existing scheme, the reference white point in the image is determined according to the brightness and chromaticity of each pixel in the YCbCr (one luminance signal (Y) and two color difference signals (R-Y, B-Y)) chromaticity space image, and then Adjust the chromaticity of pixels in the RGB chromaticity space image according to the reference white point. This solution does not evaluate whether the color temperature information of the reference white point in the image is effective when adjusting the white balance. When there are more or less light-colored areas in the image, the number of selected reference white points may appear too high. In the case of too much or too little, the color temperature calculated based on the reference white point is inaccurate, and noise and color overflow are not filtered and prevented during the selection of the reference white point, which affects the efficiency and accuracy of white balance adjustment. Spend.

发明内容 Contents of the invention

本发明实施例的目的在于提供一种白平衡调整方法,旨在解决现有的白平衡调整中没有对图像中的参考白点的色温信息是否有效进行评估,影响白平衡调整的效率和准确度的问题。The purpose of the embodiments of the present invention is to provide a white balance adjustment method, which aims to solve the problem that the existing white balance adjustment does not evaluate whether the color temperature information of the reference white point in the image is valid, which affects the efficiency and accuracy of the white balance adjustment The problem.

本发明实施例是这样实现的,一种白平衡调整方法,所述方法包括:The embodiment of the present invention is achieved in this way, a white balance adjustment method, the method comprising:

将RGB格式的图像数据转为YCbCr格式的图像数据;Convert image data in RGB format to image data in YCbCr format;

检测图像中的参考白点并统计参考白点的色温信息;所述色温信息包括参考白点R、G、B三个通道的累加值Sum(R)、Sum(G)、Sum(B),以及参考白点的数量counter;Detect the reference white point in the image and count the color temperature information of the reference white point; the color temperature information includes the accumulated values Sum(R), Sum(G), and Sum(B) of the three channels of the reference white point R, G, and B, And the number counter of the reference white point;

判断参考白点的色温信息的有效性,将参考白点的数量counter与第一阈值N_max以及第二阈值N_min进行比较,当N_min<counter<N_max时,参考白点的色温信息有效,当counter≥N_max或者counter≤N_min时,参考白点的色温信息无效,其中,第一阈值N_max和第二阈值N_min为预先定义的值;To judge the validity of the color temperature information of the reference white point, compare the number counter of the reference white point with the first threshold N_max and the second threshold N_min, when N_min<counter<N_max, the color temperature information of the reference white point is valid, when counter≥ When N_max or counter≤N_min, the color temperature information of the reference white point is invalid, wherein the first threshold N_max and the second threshold N_min are predefined values;

输出有效的色温信息;Output valid color temperature information;

根据有效的色温信息计算R、G、B通道的增益,利用所述R、G、B通道的增益调整图像中像素的R、G、B值。Calculate the gains of the R, G, and B channels according to the effective color temperature information, and use the gains of the R, G, and B channels to adjust the R, G, and B values of the pixels in the image.

本发明实施例的另一目的在于提供一种白平衡调整系统,所述系统包括:Another object of the embodiments of the present invention is to provide a white balance adjustment system, the system comprising:

色彩空间转换单元,用于将RGB格式的图像数据转换为YCbCr格式的图像数据;A color space conversion unit for converting image data in RGB format into image data in YCbCr format;

色温信息检测模块,用于检测图像中的参考白点并统计参考白点的色温信息;所述色温信息包括参考白点R、G、B三个通道的累加值Sum(R)、Sum(G)、Sum(B),以及参考白点的数量counter;The color temperature information detection module is used to detect the reference white point in the image and count the color temperature information of the reference white point; the color temperature information includes the accumulated values Sum(R), Sum(G) of the three channels of the reference white point R, G and B ), Sum(B), and the number counter of the reference white point;

色温信息判断模块,判断参考白点的色温信息的有效性,将参考白点的数量counter与第一阈值N_max以及第二阈值N_min进行比较,当N_min<counter<N_max时,参考白点的色温信息有效,当counter≥N_max或者counter≤N_min时,参考白点的色温信息无效,其中,第一阈值N_max和第二阈值N_min为预先定义的值;The color temperature information judgment module judges the validity of the color temperature information of the reference white point, compares the number counter of the reference white point with the first threshold N_max and the second threshold N_min, and when N_min<counter<N_max, the color temperature information of the reference white point Valid, when counter≥N_max or counter≤N_min, the color temperature information of the reference white point is invalid, wherein the first threshold N_max and the second threshold N_min are predefined values;

色温信息输出单元,用于输出有效的色温信息;A color temperature information output unit, configured to output effective color temperature information;

增益调整单元,用于根据所述有效的色温信息计算R、G、B通道的增益,利用所述R、G、B通道的增益调整图像中像素的R、G、B值。The gain adjustment unit is configured to calculate the gains of the R, G, and B channels according to the effective color temperature information, and use the gains of the R, G, and B channels to adjust the R, G, and B values of the pixels in the image.

本发明实施例的另一目的在于提供一种包括上述白平衡调整系统的摄像装置。Another object of the embodiments of the present invention is to provide an imaging device including the above-mentioned white balance adjustment system.

本发明实施例在白平衡调整时,对参考白点色温信息的有效性进行评估,针对有效的色温信息进行白平衡调整,可以提高白平衡调整的效率和准确度。The embodiment of the present invention evaluates the validity of the reference white point color temperature information during white balance adjustment, and performs white balance adjustment based on effective color temperature information, which can improve the efficiency and accuracy of white balance adjustment.

附图说明 Description of drawings

图1是本发明实施例提供的白平衡调整方法的实现流程图;FIG. 1 is a flow chart for realizing a white balance adjustment method provided by an embodiment of the present invention;

图2是本发明实施例提供的参考白点判断阈值调整的实现流程图;Fig. 2 is a flow chart of realizing the adjustment of the reference white point judgment threshold value provided by the embodiment of the present invention;

图3是本发明实施例提供的白平衡调整系统的结构图;FIG. 3 is a structural diagram of a white balance adjustment system provided by an embodiment of the present invention;

图4是本发明实施例提供的摄像装置的结构图;FIG. 4 is a structural diagram of an imaging device provided by an embodiment of the present invention;

图5是本发明实施例提供的摄像装置中色温评估单元的结构图。Fig. 5 is a structural diagram of a color temperature evaluation unit in an imaging device provided by an embodiment of the present invention.

图6是本发明实施例提供的摄像装置中增益调整单元的结构图。Fig. 6 is a structural diagram of a gain adjustment unit in the imaging device provided by an embodiment of the present invention.

具体实施方式 Detailed ways

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

本发明实施例在白平衡调整时,对参考白点色温信息的有效性进行评估,针对有效的色温信息进行白平衡调整,可以提高白平衡调整的效率和准确度。The embodiment of the present invention evaluates the validity of the reference white point color temperature information during white balance adjustment, and performs white balance adjustment based on effective color temperature information, which can improve the efficiency and accuracy of white balance adjustment.

图1示出了本发明实施例提供的白平衡调整方法的实现流程,详述如下:Figure 1 shows the implementation process of the white balance adjustment method provided by the embodiment of the present invention, which is described in detail as follows:

在步骤S101中,通过色彩空间转换,将RGB格式的图像转换为YCbCr格式;In step S101, the image in RGB format is converted into YCbCr format through color space conversion;

在本发明实施例中,YcbCr格式的图像可以通过色彩空间转换获取,RGB色彩空间与YCbCr色彩空间之间的转换关系如公式(1)所示:In the embodiment of the present invention, the image of the YCbCr format can be obtained through color space conversion, and the conversion relationship between the RGB color space and the YCbCr color space is as shown in formula (1):

YY CbCb CrCr == 0.2570.257 0.5040.504 0.0980.098 -- 0.1480.148 -- 0.2910.291 0.4390.439 0.4390.439 -- 0.3680.368 -- 0.0710.071 &CenterDot;&CenterDot; (( RR GG BB ++ 00 00 00 )) ++ 00 128128 128128 -- -- -- (( 11 ))

利用公式(1),可以将RGB色彩空间的图像帧转换为YCbCr色彩空间的图像帧,获取像素的RGB数据以及YCbCr数据。Using the formula (1), the image frame in the RGB color space can be converted into the image frame in the YCbCr color space, and the RGB data and the YCbCr data of the pixel can be obtained.

在步骤S102中,检测图像中的参考白点,并根据参考白点的数据统计出色温信息;In step S102, the reference white point in the image is detected, and the color temperature information is calculated according to the data of the reference white point;

作为本发明的一个实施例,在检测图像中的参考白点时,可以根据下式判断:As an embodiment of the present invention, when detecting the reference white point in the image, it can be judged according to the following formula:

(Y_pixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn    (2)(Y_pixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn (2)

其中,Y_pixel、Cb_pixel和Cr_pixel分别为像素的亮度分量、蓝色色度分量和红色色度分量,thr_dyn为参考白点判断阈值,影响图像帧中的参考白点个数。由于后续操作中可能会根据情况对thr_dyn进行调整,故对第一帧处理时,thr_dyn的值并不十分重要,一般来说,对第一帧处理时,thr_dyn的值可以设置为0。Among them, Y_pixel, Cb_pixel and Cr_pixel are the luminance component, blue chrominance component and red chrominance component of the pixel respectively, and thr_dyn is the reference white point judgment threshold, which affects the number of reference white points in the image frame. Since thr_dyn may be adjusted according to the situation in subsequent operations, the value of thr_dyn is not very important when processing the first frame. Generally speaking, the value of thr_dyn can be set to 0 when processing the first frame.

在本发明的一个实施例中,在利用上述公式(2)检测参考白点的过程中,还可以同时采取如下公式对各被测像素进行检测:In one embodiment of the present invention, in the process of using the above formula (2) to detect the reference white point, the following formula can also be adopted to detect each pixel under test:

R_pixel<R通道阈值                   (3)R_pixel<R channel threshold           (3)

G_pixel<G通道阈值                   (4)G_pixel<G channel threshold (4)

B_pixel<B通道阈值                   (5)B_pixel<Threshold value of B channel

Y_pixel<亮度阈值                    (6)Y_pixel<Brightness Threshold                        

其中,R_pixel、G_pixel、B_pixel、Y_pixel分别为像素的R分量、G分量、B分量和亮度分量,R通道阈值、G通道阈值、B通道阈值以及亮度阈值均为预先定义的常量。一般来说,R通道阈值、G通道阈值、B通道阈值的取值范围通常为210至255,亮度阀值的取值范围经常可设置为200至240。Among them, R_pixel, G_pixel, B_pixel, and Y_pixel are the R component, G component, B component, and brightness component of the pixel, respectively, and the R channel threshold, G channel threshold, B channel threshold, and brightness threshold are all predefined constants. Generally speaking, the value ranges of the R channel threshold, the G channel threshold, and the B channel threshold are usually 210 to 255, and the value range of the brightness threshold can often be set to 200 to 240.

具体实现时,可以选取公式(3)、(4)、(5)或者(6)其中之一作为噪点过滤标准,也可以取这些公式的任意“与”或者“或”的组合作为噪点过滤标准。In specific implementation, one of the formulas (3), (4), (5) or (6) can be selected as the noise filtering standard, or any combination of these formulas with "and" or "or" can be used as the noise filtering standard .

通过公式(3)-(6),可以实现过滤图像中的噪点,以避免曝光过度造成的不良影响,以及防范色彩溢出现象,从而提高白平衡调整的精确度,优化图像的输出效果。Through the formulas (3)-(6), the noise in the image can be filtered to avoid adverse effects caused by overexposure and prevent color overflow, thereby improving the accuracy of white balance adjustment and optimizing the output effect of the image.

在本发明的实施例中,参考白点的色温信息则具体包括参考白点R、G、B三个通道的累加值Sum(R)、Sum(G)、Sum(B),以及参考白点的数量counter。在本发明的一个优选实施例中,当累计的参考白点的数量counter达到第一阈值N_max时则可以结束对图像中参考白点的检测及统计。In the embodiment of the present invention, the color temperature information of the reference white point specifically includes the accumulated values Sum(R), Sum(G), and Sum(B) of the three channels of the reference white point R, G, and B, and the reference white point The number of counters. In a preferred embodiment of the present invention, when the number counter of the accumulated reference white points reaches the first threshold N_max, the detection and statistics of the reference white points in the image can be ended.

作为本发明的一个实施例,参考白点信息可以通过直方图统计实现。As an embodiment of the present invention, the reference white point information may be implemented through histogram statistics.

在步骤S103中,判断该图像帧中参考白点的色温信息是否为有效,是则执行步骤S104,否则执行步骤S106;In step S103, it is judged whether the color temperature information of the reference white point in the image frame is valid, if so, execute step S104, otherwise execute step S106;

在本发明实施例中,将参考白点的数量counter与第一阈值N_max以及第二阈值N_min进行比较,当N_min<counter<N_max时,则可以判断参考白点的色温信息有效;反之,当counter≥N_max或者counter≤N_min时,则判断参考白点的色温信息无效。在上述优选实施例中,所述参考白点的色温信息无效的判决标准则为counter=N_max或者counter≤N_min。其中,第一阈值N_max和第二阈值N_min为预先定义的值。第一阈值N_max和第二阈值N_min可设置为与图像中的像素总数成比例的数,一般来说,第一阈值N_max可设置图像中像素总数的0.01倍,第二阈值N_min可设置图像中像素总数的0.001倍In the embodiment of the present invention, the number counter of the reference white point is compared with the first threshold N_max and the second threshold N_min, and when N_min<counter<N_max, it can be judged that the color temperature information of the reference white point is valid; otherwise, when counter When ≥N_max or counter≤N_min, it is determined that the color temperature information of the reference white point is invalid. In the above preferred embodiment, the criterion for judging that the color temperature information of the reference white point is invalid is counter=N_max or counter≤N_min. Wherein, the first threshold N_max and the second threshold N_min are predefined values. The first threshold N_max and the second threshold N_min can be set to a number proportional to the total number of pixels in the image. Generally speaking, the first threshold N_max can be set to 0.01 times the total number of pixels in the image, and the second threshold N_min can be set to the number of pixels in the image. 0.001 times the total

在步骤S104中,根据参考白点的色温信息计算R、G、B通道的增益;In step S104, calculate the gains of the R, G, and B channels according to the color temperature information of the reference white point;

在本发明实施例中,先计算所有参考白点的R、G、B的平均值R_avg、G_avg、B_avg,分别如公式(7)、(8)、(9)所示:In the embodiment of the present invention, the average values R_avg, G_avg, and B_avg of R, G, and B of all reference white points are first calculated, as shown in formulas (7), (8), and (9) respectively:

R_avg=Sum(R)/counter                  (7)R_avg=Sum(R)/counter (7)

G_avg=Sum(G)/counter                  (8)G_avg=Sum(G)/counter (8)

B_avg=Sum(B)/counter                  (9)B_avg=Sum(B)/counter (9)

再计算所有参考白点的Y的平均值,如公式(10)所示:Calculate the average value of Y of all reference white points again, as shown in formula (10):

Y_avg=0.257×R_avg+0.504×G_avg+0.098×B_avg       (10)Y_avg=0.257×R_avg+0.504×G_avg+0.098×B_avg (10)

则R、G、B通道的增益R_gain、G_gain、B_gain的计算分别如公式(11)、(12)、(13)所示:Then the calculations of the gains R_gain, G_gain, and B_gain of the R, G, and B channels are shown in formulas (11), (12), and (13) respectively:

R_gain=Y_avg/R_avg                    (11)R_gain=Y_avg/R_avg (11)

G_gain=Y_avg/G_avg                    (12)G_gain=Y_avg/G_avg (12)

B_gain=Y_avg/B_avg                    (13)B_gain=Y_avg/B_avg (13)

在步骤S105中,根据R、G、B通道的增益对图像中每个像素的原始R、G、B值进行调整,获取新的R、G、B值;In step S105, the original R, G, and B values of each pixel in the image are adjusted according to the gain of the R, G, and B channels, to obtain new R, G, and B values;

在本发明实施例中,新的R、G、B值R_new、G_new和B_new的计算分别如公式(14)、(15)、(16)所示:In the embodiment of the present invention, the calculations of the new R, G, and B values R_new, G_new, and B_new are shown in formulas (14), (15), and (16) respectively:

R_new=R×R_gain                       (14)R_new=R×R_gain (14)

G_new=G×G_gain                       (15)G_new=G×G_gain (15)

B_new=B×B_gain                       (16)B_new=B×B_gain (16)

在步骤S106中,调整动态阈值thr_dyn,统计下一图像帧中的参考白点。In step S106, the dynamic threshold thr_dyn is adjusted, and the reference white point in the next image frame is counted.

在本发明实施例中,参考白点判断阈值thr_dyn直接影响一帧图像中参考白点的个数,因此当出现无效的色温信息时,需要对参考白点判断阈值thr_dyn值进行调整,以保证下一帧图像中参考白点色温信息的有效性。In the embodiment of the present invention, the reference white point judgment threshold thr_dyn directly affects the number of reference white points in a frame of image, so when invalid color temperature information appears, it is necessary to adjust the reference white point judgment threshold thr_dyn to ensure the following The validity of the reference white point color temperature information in a frame image.

在本发明实施例中,参考白点判断阈值thr_dyn可以在预先定义的固定取值范围内进行动态调整,其调节可以采用变调节步长的方式,例如为参考白点判断阈值thr_dyn设置4个调节步长值:5,10,20,40。调整时,纪录和比较参考白点判断阈值thr_dyn上一图像帧的调节方向和当前的调节方向,综合分析上一图像帧调节情况和当前的情况,实时调整调节步长,以尽快找到合适的参考白点检测值。在白平衡调整第一次运行时,可以为参考白点判断阈值thr_dyn设置一个初始值,并在上述4个步长值中选择一个作为初始调节步长,以后参考白点判断阈值thr_dyn的值均为最新调节后的值,其具体调节方法如图2所示:In the embodiment of the present invention, the reference white point judgment threshold thr_dyn can be dynamically adjusted within a predefined fixed value range, and its adjustment can be adjusted by variable adjustment steps, for example, four adjustments are set for the reference white point judgment threshold thr_dyn Step value: 5, 10, 20, 40. When adjusting, record and compare the adjustment direction of the previous image frame and the current adjustment direction of the reference white point judgment threshold thr_dyn, comprehensively analyze the adjustment situation of the previous image frame and the current situation, and adjust the adjustment step in real time to find a suitable reference as soon as possible White point detection value. When the white balance adjustment is running for the first time, an initial value can be set for the reference white point judgment threshold thr_dyn, and one of the above four step values can be selected as the initial adjustment step. It is the latest adjusted value, and its specific adjustment method is shown in Figure 2:

在步骤S201中,判断当前帧的参考白点的数量counter是否大于或等于第一阈值N_max,是则执行步骤S202,否则执行步骤S209。In step S201, it is judged whether the number counter of reference white points in the current frame is greater than or equal to the first threshold N_max, if yes, execute step S202, otherwise execute step S209.

在步骤S202中,确定当前参考白点判断阈值thr_dyn的方向为调大,再根据调节方向指示器的纪录判断上一图像帧参考白点判断阈值thr_dyn的调节方向是否也是调大,是则执行步骤S203,否则执行步骤S206。In step S202, determine that the direction of the current reference white point judgment threshold thr_dyn is to increase, and then judge whether the adjustment direction of the reference white point judgment threshold thr_dyn of the previous image frame is also to increase according to the record of the adjustment direction indicator, and then execute the step S203, otherwise execute step S206.

所述调节方向指示器可以是变量等可存储参考白点判断阈值thr_dyn的调节方向的单元。The adjustment direction indicator may be a unit such as a variable that can store the adjustment direction of the reference white point judgment threshold value thr_dyn.

在步骤S203,判断上一图像帧的调节步长是否等于最大步长值(40)或者中等步长值(20),是则执行步骤S204,否则执行步骤S205。In step S203, it is judged whether the adjustment step of the last image frame is equal to the maximum step value (40) or the middle step value (20), if yes, execute step S204, otherwise execute step S205.

在步骤S204中,按上一图像帧的调节步长调大当前参考白点判断阈值thr_dyn,即当前参考白点判断阈值thr_dyn=上一图像帧调整后的参考白点判断阈值thr_dyn+上一图像帧的调节步长。In step S204, increase the current reference white point judgment threshold thr_dyn according to the adjustment step of the previous image frame, that is, the current reference white point judgment threshold thr_dyn=the adjusted reference white point judgment threshold thr_dyn of the previous image frame+the previous image frame The adjustment step size.

在步骤S205中,按升一级后的调节步长调大当前参考白点判断阈值thr_dyn,即如果上一图像帧的调节步长为5,则当前的调节步长为10;如果上一图像帧的调节步长为10,则当前的调节步长为20,当前参考白点判断阈值thr_dyn值=上一图像帧调整后的参考白点判断阈值thr_dyn+升级后的调节步长。In step S205, the current reference white point judgment threshold thr_dyn is increased according to the adjustment step after one level up, that is, if the adjustment step of the previous image frame is 5, the current adjustment step is 10; if the previous image frame If the adjustment step of a frame is 10, the current adjustment step is 20, and the current reference white point judgment threshold thr_dyn value=the adjusted reference white point judgment threshold thr_dyn of the previous image frame+upgraded adjustment step.

在步骤S206中,判断上一图像帧的调节步长是否等于最小步长值(5),是则执行步骤S207,否则执行步骤S208。In step S206, it is judged whether the adjustment step of the last image frame is equal to the minimum step value (5), if yes, execute step S207, otherwise execute step S208.

在步骤S207中,按最小步长调大当前参考白点判断阈值thr_dyn,则当前参考白点判断阈值thr_dyn=上一图像帧调整后的参考白点判断阈值thr_dyn+5。In step S207, the current reference white point judgment threshold thr_dyn is increased by the minimum step size, then the current reference white point judgment threshold thr_dyn=the adjusted reference white point judgment threshold thr_dyn+5 of the previous image frame.

在步骤S208中,按降一级后的调节步长调大当前参考白点判断阈值thr_dyn,即如果上一图像帧的调节步长为10,则当前的调节步长为5,以此类推,则当前参考白点判断阈值thr_dyn=上一图像帧调整后的参考白点判断阈值thr_dyn+降级后的调节步长。In step S208, the current reference white point judgment threshold thr_dyn is increased according to the adjustment step after one level down, that is, if the adjustment step of the previous image frame is 10, the current adjustment step is 5, and so on, Then the current reference white point judgment threshold thr_dyn=the adjusted reference white point judgment threshold thr_dyn of the previous image frame+the downgraded adjustment step.

在步骤S209中,确定当前参考白点判断阈值thr_dyn的方向为调小,再判断参考白点判断阈值thr_dyn上一图像帧的调节方向是否也是调小,是则执行步骤S210;否则执行步骤S213。In step S209, it is determined that the direction of the current reference white point judgment threshold thr_dyn is down, and then it is judged whether the adjustment direction of the previous image frame above the reference white point judgment threshold thr_dyn is also down, and if so, go to step S210; otherwise, go to step S213.

在步骤S210,判断上一图像帧的调节步长是否等于最大步长值或者较大步长值,是则执行步骤S211,否则执行步骤S212。In step S210, it is judged whether the adjustment step of the last image frame is equal to the maximum step value or a larger step value, if yes, execute step S211, otherwise, execute step S212.

在步骤S211中,按上一图像帧的调节步长调小当前参考白点判断阈值thr_dyn,即当前参考白点判断阈值thr_dyn=上一图像帧调整后的参考白点判断阈值thr_dyn-上一图像帧的调节步长。In step S211, reduce the current reference white point judgment threshold thr_dyn according to the adjustment step of the previous image frame, that is, the current reference white point judgment threshold thr_dyn=the adjusted reference white point judgment threshold thr_dyn of the previous image frame−previous image The adjustment step of the frame.

在步骤S212中,按升一级后的调节步长调小当前参考白点判断阈值thr_dyn,即当前参考白点判断阈值thr_dyn值=上一图像帧调整后的参考白点判断阈值thr_dyn-升级后的调节步长。In step S212, the current reference white point judgment threshold thr_dyn is adjusted down according to the adjustment step after upgrading one level, that is, the value of the current reference white point judgment threshold thr_dyn = the adjusted reference white point judgment threshold thr_dyn of the previous image frame - after the upgrade The adjustment step size.

在步骤S213中,判断上一图像帧的调节步长是否等于最小步长值,是则执行步骤S214,否则执行步骤S215。In step S213, it is judged whether the adjustment step of the previous image frame is equal to the minimum step value, if yes, execute step S214, otherwise execute step S215.

在步骤S214中,按最小步长调小当前参考白点判断阈值thr_dyn,则当前参考白点判断阈值thr_dyn=上一图像帧调整后的参考白点判断阈值thr_dyn-5。In step S214, the current reference white point judgment threshold thr_dyn is decreased by the minimum step size, then the current reference white point judgment threshold thr_dyn=the adjusted reference white point judgment threshold thr_dyn-5 of the previous image frame.

在步骤S215中,按降一级后的调节步长调小当前参考白点判断阈值thr_dyn,则当前参考白点判断阈值thr_dyn=上一图像帧调整后的参考白点判断阈值thr_dyn-降级后的调节步长。In step S215, the current reference white point judgment threshold thr_dyn is adjusted down according to the adjustment step after being reduced by one level, then the current reference white point judgment threshold thr_dyn=the adjusted reference white point judgment threshold thr_dyn of the previous image frame-after downgrading Adjust the step size.

本发明实施例中,参考白点判断阈值thr_dyn的取值范围可以为(0,240)。In the embodiment of the present invention, the value range of the reference white point judgment threshold thr_dyn may be (0, 240).

图3示出了本发明实施例提供的白平衡调整系统的结构图,色彩空间转换单元31通过色彩空间转换,将RGB格式的图像数据转换为YCbCr格式的图像数据。色温评估单元32检测图像中的参考白点,根据参考白点统计色温信息,并判断该色温信息的有效性,输出有效的色温信息。增益调整单元33根据色温评估单元32输出的有效的色温信息计算R、G、B通道的增益,利用R、G、B通道的增益调整图像中像素的R、G、B值,对图像进行调节。FIG. 3 shows a structural diagram of a white balance adjustment system provided by an embodiment of the present invention. The color space conversion unit 31 converts image data in RGB format to image data in YCbCr format through color space conversion. The color temperature evaluation unit 32 detects the reference white point in the image, calculates the color temperature information according to the reference white point, judges the validity of the color temperature information, and outputs valid color temperature information. The gain adjustment unit 33 calculates the gains of the R, G, and B channels according to the effective color temperature information output by the color temperature evaluation unit 32, and uses the gains of the R, G, and B channels to adjust the R, G, and B values of the pixels in the image to adjust the image. .

图4示出了本发明实施例提供的摄像装置的结构,为了便于说明,仅示出了与本发明实施例相关的部分。Fig. 4 shows the structure of the imaging device provided by the embodiment of the present invention, and for the convenience of description, only the parts related to the embodiment of the present invention are shown.

摄像头41采集图像信号,向白平衡环路42输出信号为RGB格式的图片数据。色彩空间转换单元43通过色彩空间转换,将RGB格式的图像数据转为YCbCr格式的图像数据。色温评估单元44检测图像中的参考白点,根据参考白点统计色温信息,并判断该色温信息的有效性,输出有效的色温信息。增益调整单元45根据色温评估单元44输出的有效的色温信息计算R、G、B通道的增益,并配置摄像头41,利用R、G、B通道的增益调整图像中像素的R、G、B值,对图像进行调节。The camera 41 collects image signals, and outputs image data in RGB format to the white balance loop 42 . The color space conversion unit 43 converts the image data in RGB format into image data in YCbCr format through color space conversion. The color temperature evaluation unit 44 detects the reference white point in the image, calculates the color temperature information according to the reference white point, judges the validity of the color temperature information, and outputs valid color temperature information. The gain adjustment unit 45 calculates the gains of the R, G, and B channels according to the effective color temperature information output by the color temperature evaluation unit 44, and configures the camera 41 to adjust the R, G, and B values of the pixels in the image using the gains of the R, G, and B channels , to adjust the image.

在本发明实施例中,色温信息包括参考白点R、G、B三个通道的累加值Sum(R)、Sum(G)、Sum(B),以及参考白点的数量counter。In the embodiment of the present invention, the color temperature information includes the accumulated values Sum(R), Sum(G), Sum(B) of the three channels of the reference white points R, G, and B, and the number counter of the reference white points.

图5示出了本发明实施例提供给的色温评估单元的结构,为了便于说明,仅示出了与本发明实施例相关的部分。Fig. 5 shows the structure of the color temperature evaluation unit provided by the embodiment of the present invention, and for the convenience of description, only the parts related to the embodiment of the present invention are shown.

参考白点检测模块441检测图像中的参考白点,并根据检测出的参考白点统计色温信息,作为本发明的一个实施例,图像中的参考白点根据下式检测:The reference white point detection module 441 detects the reference white point in the image, and calculates the color temperature information according to the detected reference white point. As an embodiment of the present invention, the reference white point in the image is detected according to the following formula:

(Y_pixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn;(Y_pixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn;

其中,Y_pixel、Cb_pixel和Cr_pixel分别为像素的亮度分量、蓝色色度分量和红色色度分量,thr_dyn为参考白点判断阈值。Among them, Y_pixel, Cb_pixel and Cr_pixel are the luminance component, blue chrominance component and red chrominance component of the pixel respectively, and thr_dyn is the reference white point judgment threshold.

作为本发明的一个优选实施例,为了避免曝光过度造成的不良影响,提高白平衡调整的精确度,优化图像的输出效果,在检测各像素是否为参考白点的同时还通过噪点过滤模块411对图像中的噪点进行过滤。As a preferred embodiment of the present invention, in order to avoid adverse effects caused by overexposure, improve the accuracy of white balance adjustment, and optimize the output effect of the image, while detecting whether each pixel is a reference white point, the noise filtering module 411 is also used to detect whether each pixel is a reference white point. Noise in the image is filtered.

在过滤图像中的噪点时,作为本发明的一个实施例,参考白点需满足以下各式之一,或者以下各式的任意“与”或者“或”的组合:When filtering noise in an image, as an embodiment of the present invention, the reference white point needs to satisfy one of the following formulas, or any combination of "and" or "or" of the following formulas:

R_pixel<R通道阈值;R_pixel<R channel threshold;

G_pixel<G通道阈值;G_pixel<G channel threshold;

B_pixel<B通道阈值;B_pixel<B channel threshold;

Y_pixel<亮度阈值;Y_pixel<brightness threshold;

其中,R_pixel、G_pixel、B_pixel、Y_pixel分别为像素的R分量、G分量、B分量和亮度分量。Among them, R_pixel, G_pixel, B_pixel, and Y_pixel are the R component, G component, B component, and brightness component of the pixel, respectively.

在本发明的一个优选实施例中,当累计的参考白点的数量counter达到第一阈值N_max时则可以结束对图像中参考白点的检测及统计。In a preferred embodiment of the present invention, when the number counter of the accumulated reference white points reaches the first threshold N_max, the detection and statistics of the reference white points in the image can be ended.

色温信息判断模块442判断参考白点的色温信息的有效性,作为本发明的一个实施例,在判断色温信息的有效性时,当第二阈值N_min<参考白点的数量counter<第一阈值N_max时,参考白点的色温信息有效,当参考白点的数量counter≥第一阈值N_max或者参考白点的数量counter≤第二阈值N_min时,参考白点的色温信息无效,当采用上述优选实施例中所述当累计的参考白点的数量counter达到第一阈值N_max时即结束对图像中参考白点的检测及统计,则色温信息无效的条件为参考白点的数量counter=第一阈值N_max或者参考白点的数量counter≤第二阈值N_min。The color temperature information judging module 442 judges the validity of the color temperature information of the reference white point. As an embodiment of the present invention, when judging the validity of the color temperature information, when the second threshold N_min<the number of reference white points counter<the first threshold N_max , the color temperature information of the reference white point is valid. When the number of reference white points counter≥the first threshold N_max or the number of reference white points counter≤the second threshold N_min, the color temperature information of the reference white point is invalid. When the above preferred embodiment is adopted When the accumulated reference white point number counter reaches the first threshold N_max, the detection and statistics of the reference white point in the image will be terminated, and the condition that the color temperature information is invalid is that the reference white point number counter=the first threshold N_max or The number of reference white points counter≤the second threshold N_min.

在本发明实施例中,当色温信息判断模块442判断参考白点的色温信息无效时,通过阈值调整模块443对参考白点判断阈值进行调整,具体调整方式如上所述,不再赘述。In the embodiment of the present invention, when the color temperature information judging module 442 judges that the color temperature information of the reference white point is invalid, the threshold adjusting module 443 adjusts the threshold for judging the reference white point.

色温信息输出模块443输出有效的色温信息。The color temperature information output module 443 outputs valid color temperature information.

图6示出了本发明实施例提供的增益调整单元的结构,为了便于说明,仅示出了与本发明实施例相关的部分。Fig. 6 shows the structure of the gain adjustment unit provided by the embodiment of the present invention, and for the convenience of description, only the parts related to the embodiment of the present invention are shown.

RGB平均值计算模块451根据下式计算所有参考白点的R、G、B的平均值R_avg、G_avg、B_avg:The RGB average calculation module 451 calculates the average value R_avg, G_avg, B_avg of R, G, B of all reference white points according to the following formula:

R_avg=Sum(R)/counterR_avg=Sum(R)/counter

G_avg=Sum(G)/counterG_avg=Sum(G)/counter

B_avg=Sum(B)/counterB_avg=Sum(B)/counter

亮度平均值计算模块452根据下式计算所有参考白点的亮度的平均值Y_avg:The brightness average calculation module 452 calculates the average value Y_avg of the brightness of all reference white points according to the following formula:

Y_avg=0.257×R_avg+0.504×G_avg+0.098×B_avgY_avg=0.257×R_avg+0.504×G_avg+0.098×B_avg

通道增益计算模块453根据下式计算R、G、B通道的增益R_gain、G_gain、B_gain:The channel gain calculation module 453 calculates the gains R_gain, G_gain, and B_gain of the R, G, and B channels according to the following formula:

R_gain=Y_avg/R_avgR_gain=Y_avg/R_avg

G_gain=Y_avg/G_avgG_gain=Y_avg/G_avg

B_gain=Y_avg/B_avgB_gain=Y_avg/B_avg

RGB调整模块454根据下式调整图像中像素的R、G、B值R_new、G_new和B_new:The RGB adjustment module 454 adjusts the R, G, and B values R_new, G_new and B_new of pixels in the image according to the following formula:

R_new=R×R_gainR_new=R×R_gain

G_new=G×G_gainG_new=G×G_gain

B_new=B×B_gain。B_new=B*B_gain.

本发明实施例在白平衡调整时,对参考白点色温信息的有效性进行评估,针对有效的色温信息进行白平衡调整,可以提高白平衡调整的效率和准确度。同时,过滤图像中的噪点,提高了色温评估的精确度,进而优化了输出的效果可以有效地防止白平衡调整过程中的色彩溢出现象,避免曝光过度造成的不良影响。The embodiment of the present invention evaluates the validity of the reference white point color temperature information during white balance adjustment, and performs white balance adjustment based on effective color temperature information, which can improve the efficiency and accuracy of white balance adjustment. At the same time, it filters the noise in the image, improves the accuracy of color temperature evaluation, and then optimizes the output effect, which can effectively prevent the color overflow phenomenon during the white balance adjustment process and avoid the adverse effects caused by overexposure.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.

Claims (14)

1.一种白平衡调整方法,其特征在于,所述方法包括:1. A method for adjusting white balance, characterized in that the method comprises: 将RGB格式的图像数据转为YCbCr格式的图像数据;Convert image data in RGB format to image data in YCbCr format; 检测图像中的参考白点并统计参考白点的色温信息;所述色温信息包括参考白点R、G、B三个通道的累加值Sum(R)、Sum(G)、Sum(B),以及参考白点的数量counter;Detect the reference white point in the image and count the color temperature information of the reference white point; the color temperature information includes the accumulated values Sum(R), Sum(G), and Sum(B) of the three channels of the reference white point R, G, and B, And the number counter of the reference white point; 判断参考白点的色温信息的有效性,将参考白点的数量counter与第一阈值N_max以及第二阈值N_min进行比较,当N_min<counter<N_max时,参考白点的色温信息有效,当counter≥N_max或者counter≤N_min时,参考白点的色温信息无效,其中,第一阈值N_max和第二阈值N_min为预先定义的值;To judge the validity of the color temperature information of the reference white point, compare the number counter of the reference white point with the first threshold N_max and the second threshold N_min, when N_min<counter<N_max, the color temperature information of the reference white point is valid, when counter≥ When N_max or counter≤N_min, the color temperature information of the reference white point is invalid, wherein the first threshold N_max and the second threshold N_min are predefined values; 输出有效的色温信息;Output valid color temperature information; 根据有效的色温信息计算R、G、B通道的增益,利用所述R、G、B通道的增益调整图像中像素的R、G、B值。Calculate the gains of the R, G, and B channels according to the effective color temperature information, and use the gains of the R, G, and B channels to adjust the R, G, and B values of the pixels in the image. 2.如权利要求1中所述的方法,其特征在于,所述第一阈值N_max和第二阈值N_min设置为与图像中的像素总数成比例的数。2. The method as claimed in claim 1, characterized in that the first threshold N_max and the second threshold N_min are set as numbers proportional to the total number of pixels in the image. 3.如权利要求1所述的方法,其特征在于,所述图像中的参考白点根据下式检测:3. The method according to claim 1, wherein the reference white point in the image is detected according to the following formula: (Y_pixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn;(Y_pixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn; 其中,Y_pixel、Cb_pixel和Cr_pixel分别为像素的亮度分量、蓝色色度分量和红色色度分量,thr_dyn为参考白点判断阈值,为0到240之间的值。Among them, Y_pixel, Cb_pixel, and Cr_pixel are the luminance component, blue chroma component, and red chroma component of the pixel, respectively, and thr_dyn is the reference white point judgment threshold, which is a value between 0 and 240. 4.如权利要求1所述的方法,其特征在于,所述判断参考白点的色温信息的有效性步骤进一步包括:4. The method according to claim 1, wherein the step of determining the validity of the color temperature information of the reference white point further comprises: 当判断参考白点的色温信息无效时,调整参考白点判断阈值。When it is judged that the color temperature information of the reference white point is invalid, adjust the reference white point judgment threshold. 5.如权利要求4所述的方法,其特征在于,所述当判断参考白点的色温信息无效时,调整参考白点判断阈值的步骤具体为:5. The method according to claim 4, wherein when the color temperature information of the reference white point is judged to be invalid, the step of adjusting the judgment threshold of the reference white point is specifically as follows: 判断当前图像帧的参考白点的数量counter是否大于或等于第一阈值N_max,是则执行步骤A,否则执行步骤B;Judging whether the number counter of the reference white point of the current image frame is greater than or equal to the first threshold N_max, if so, execute step A, otherwise execute step B; A:判断上一图像帧中参考白点判断阈值的调节方向是否调大,是则执行步骤A1,否则执行步骤A2;A: Determine whether the adjustment direction of the reference white point judgment threshold in the previous image frame is increased, if yes, execute step A1, otherwise execute step A2; A1:判断上一图像帧的调节步长是否为最大步长值或者比最大步长值低一级的步长值,是则执行步骤A11,否则执行步骤A12;A1: Determine whether the adjustment step of the previous image frame is the maximum step value or a step value lower than the maximum step value, if yes, execute step A11, otherwise execute step A12; A11:按上一图像帧的调节步长调大当前参考白点判断阈值;A11: Increase the current reference white point judgment threshold according to the adjustment step of the previous image frame; A12:按升一级后的调节步长调大当前参考白点判断阈值;A12: Increase the current reference white point judgment threshold according to the adjustment step after upgrading to one level; A2:判断上一图像帧的调节步长是否为最小步长值,是则执行步骤A21,否则执行步骤A22;A2: Determine whether the adjustment step of the previous image frame is the minimum step value, if yes, execute step A21, otherwise execute step A22; A21:按最小步长调大当前参考白点判断阈值;A21: Increase the judgment threshold of the current reference white point according to the minimum step size; A22:按降一级后的调节步长调大当前参考白点判断阈值;A22: Increase the current reference white point judgment threshold according to the adjustment step after one level down; B:判断上一图像帧中参考白点判断阈值的调节方向是否调小,是则执行步骤B1,否则执行步骤B2;B: Determine whether the adjustment direction of the reference white point judgment threshold in the previous image frame is reduced, if yes, execute step B1, otherwise execute step B2; B1:判断上一图像帧的调节步长是否为最大步长值或者比最大步长值低一级的步长值,是则执行步骤B11,否则执行步骤B12;B1: Determine whether the adjustment step of the previous image frame is the maximum step value or a step value lower than the maximum step value, if yes, execute step B11, otherwise execute step B12; B 11:按上一图像帧的调节步长调小当前参考白点判断阈值;B 11: Reduce the current reference white point judgment threshold according to the adjustment step of the previous image frame; B12:按升一级后的调节步长调小当前参考白点判断阈值;B12: Reduce the current reference white point judgment threshold according to the adjustment step after upgrading to one level; B2:判断上一图像帧的调节步长是否为最小步长值,是则执行步骤B21,否则执行步骤B22;B2: Determine whether the adjustment step of the last image frame is the minimum step value, if yes, execute step B21, otherwise execute step B22; B21:按最小步长调小当前参考白点判断阈值;B21: Decrease the judgment threshold of the current reference white point according to the minimum step size; B22:按降一级后的调节步长调小当前参考白点判断阈值。B22: Decrease the current reference white point judgment threshold according to the adjustment step after one level down. 6.如权利要求1所述的方法,其特征在于,所述检测图像中的参考白点并统计参考白点的色温信息的步骤还包括:6. The method according to claim 1, wherein the step of detecting the reference white point in the image and counting the color temperature information of the reference white point further comprises: 过滤图像中的噪点。Filters out noise in an image. 7.如权利要求6所述的方法,其特征在于,所述过滤图像中的噪点步骤中,参考白点需满足以下各式之一,或者以下各式的任意“与”或者“或”的组合:7. The method according to claim 6, characterized in that, in the step of filtering the noise in the image, the reference white point needs to satisfy one of the following formulas, or any of the following formulas "and" or "or" combination: R_pixel<R通道阈值;R_pixel<R channel threshold; G_pixel<G通道阈值;G_pixel<G channel threshold; B_pixel<B通道阈值;B_pixel<B channel threshold; Y_pixel<亮度阈值;Y_pixel<brightness threshold; 其中,R_pixel、G_pixel、B_pixel、Y_pixel分别为像素的R分量、G分量、B分量和亮度分量,R通道阈值、G通道阈值、B通道阈值取值范围为210至255,亮度阈值的取值范围为200至240。Among them, R_pixel, G_pixel, B_pixel, and Y_pixel are the R component, G component, B component, and brightness component of the pixel, respectively. The R channel threshold, the G channel threshold, and the B channel threshold range from 210 to 255, and the value range of the brightness threshold 200 to 240. 8.如权利要求1所述的方法,其特征在于,所述根据有效的色温信息计算R、G、B通道的增益的步骤具体为:8. The method according to claim 1, wherein the step of calculating the gain of the R, G, and B channels according to the effective color temperature information is specifically: 根据下式计算所有参考白点的R、G、B的平均值R_avg、G_avg、B_avg:Calculate the average values R_avg, G_avg, and B_avg of R, G, and B of all reference white points according to the following formula: R_avg=Sum(R)/counterR_avg=Sum(R)/counter G_avg=Sum(G)/counterG_avg=Sum(G)/counter B_avg=Sum(B)/counterB_avg=Sum(B)/counter 根据下式计算所有参考白点的亮度的平均值Y_avg:Calculate the average Y_avg of the brightness of all reference white points according to the following formula: Y_avg=0.257×R_avg+0.504×G_avg+0.098×B_avgY_avg=0.257×R_avg+0.504×G_avg+0.098×B_avg 根据下式计算R、G、B通道的增益R_gain、G_gain、B_gain:Calculate the gains R_gain, G_gain, and B_gain of the R, G, and B channels according to the following formula: R_gain=Y_avg/R_avgR_gain=Y_avg/R_avg G_gain=Y_avg/G_avgG_gain=Y_avg/G_avg B_gain=Y_avg/B_avgB_gain=Y_avg/B_avg 根据下式调整图像中像素的R、G、B值R_new、G_new和B_new:Adjust the R, G, B values R_new, G_new and B_new of the pixels in the image according to the following formula: R_new=R×R_gainR_new=R×R_gain G_new=G×G_gainG_new=G×G_gain B_new=B×B_gain。B_new=B*B_gain. 9.一种白平衡调整系统,其特征在于,所述系统包括:9. A white balance adjustment system, characterized in that the system comprises: 色彩空间转换单元,用于将RGB格式的图像数据转换为YCbCr格式的图像数据;A color space conversion unit for converting image data in RGB format into image data in YCbCr format; 参考白点检测模块,用于检测图像中的参考白点并统计参考白点的色温信息;所述色温信息包括参考白点R、G、B三个通道的累加值Sum(R)、Sum(G)、Sum(B),以及参考白点的数量counter;The reference white point detection module is used to detect the reference white point in the image and count the color temperature information of the reference white point; the color temperature information includes the accumulated values Sum(R), Sum( G), Sum(B), and the number counter of the reference white point; 色温信息判断模块,判断参考白点的色温信息的有效性,将参考白点的数量counter与第一阈值N_max以及第二阈值N_min进行比较,当N_min<counter<N_max时,参考白点的色温信息有效,当counter≥N_max或者counter≤N_min时,参考白点的色温信息无效,其中,第一阈值N_max和第二阈值N_min为预先定义的值;The color temperature information judgment module judges the validity of the color temperature information of the reference white point, compares the number counter of the reference white point with the first threshold N_max and the second threshold N_min, and when N_min<counter<N_max, the color temperature information of the reference white point Valid, when counter≥N_max or counter≤N_min, the color temperature information of the reference white point is invalid, wherein the first threshold N_max and the second threshold N_min are predefined values; 色温信息输出模块,用于输出有效的色温信息;The color temperature information output module is used to output effective color temperature information; 增益调整单元,用于根据所述有效的色温信息计算R、G、B通道的增益,利用所述R、G、B通道的增益调整图像中像素的R、G、B值。The gain adjustment unit is configured to calculate the gains of the R, G, and B channels according to the effective color temperature information, and use the gains of the R, G, and B channels to adjust the R, G, and B values of the pixels in the image. 10.如权利要求9所述的系统,其特征在于,所述图像中的参考白点根据下式检测:10. The system of claim 9, wherein the reference white point in the image is detected according to the following formula: (Y_ixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn;(Y_ixel-|Cb_pixel-128|-|Cr_pixel-128|)>thr_dyn; 其中,Y_pixel、Cb_pixel和Cr_pixel分别为像素的亮度分量、蓝色色度分量和红色色度分量,thr_dyn为参考白点判断阈值,为0到240之间的值。Among them, Y_pixel, Cb_pixel, and Cr_pixel are the luminance component, blue chroma component, and red chroma component of the pixel, respectively, and thr_dyn is the reference white point judgment threshold, which is a value between 0 and 240. 11.如权利要求9所述的系统,其特征在于,所述色温信息判断模块进一步包括:11. The system according to claim 9, wherein the color temperature information judging module further comprises: 阈值调整模块,用于当判断参考白点的色温信息无效时,调整参考白点判断阈值。The threshold adjustment module is configured to adjust the reference white point judgment threshold when the color temperature information of the reference white point is judged to be invalid. 12.如权利要求9所述的系统,其特征在于,所述参考白点检测模块进一步包括:12. The system according to claim 9, wherein the reference white point detection module further comprises: 噪点过滤模块,用于过滤图像中的噪点。The noise filter module is used to filter the noise in the image. 13.如权利要求12所述的系统,其特征在于,在过滤图像中的噪点时,参考白点需满足以下各式之一,或者以下各式的任意“与”或者“或”的组合:13. The system according to claim 12, wherein when filtering the noise in the image, the reference white point needs to satisfy one of the following formulas, or any combination of "and" or "or" of the following formulas: R_pixel<R通道阈值;R_pixel<R channel threshold; G_pixel<G通道阈值;G_pixel<G channel threshold; B_pixel<B通道阈值;B_pixel<B channel threshold; Y_pixel<亮度阈值;Y_pixel<brightness threshold; 其中,R_pixel、G_pixel、B_pixel、Y_pixel分别为像素的R分量、G分量、B分量和亮度分量,R通道阈值、G通道阈值、B通道阈值的取值范围为210至255,亮度阈值的取值范围为200至240.Among them, R_pixel, G_pixel, B_pixel, and Y_pixel are the R component, G component, B component, and brightness component of the pixel, respectively. The value range of the R channel threshold, G channel threshold, and B channel threshold is 210 to 255, and the value of the brightness threshold The range is 200 to 240. 14.如权利要求9所述的系统,其特征在于,所述增益调整单元包括:14. The system according to claim 9, wherein the gain adjustment unit comprises: RGB平均值计算模块,用于根据下式计算所有参考白点的R、G、B的平均值R_avg、G_avg、B_avg:The RGB average calculation module is used to calculate the average values R_avg, G_avg, and B_avg of R, G, and B of all reference white points according to the following formula: R_avg=Sum(R)/counterR_avg=Sum(R)/counter G_avg=Sum(G)/counterG_avg=Sum(G)/counter B_avg=Sum(B)/counterB_avg=Sum(B)/counter 亮度平均值计算模块,用于根据下式计算所有参考白点的亮度的平均值Y_avg:The brightness average calculation module is used to calculate the average value Y_avg of the brightness of all reference white points according to the following formula: Y_avg=0.257×R_avg+0.504×G_avg+0.098×B_avgY_avg=0.257×R_avg+0.504×G_avg+0.098×B_avg 通道增益计算模块,用于根据下式计算R、G、B通道的增益R_gain、G_gain、B_gain:The channel gain calculation module is used to calculate the gains R_gain, G_gain, and B_gain of the R, G, and B channels according to the following formula: R_gain=Y_avg/R_avgR_gain=Y_avg/R_avg G_gain=Y_avg /G_avgG_gain=Y_avg/G_avg B_gain=Y_avg/B_avgB_gain=Y_avg/B_avg RGB调整模块,用于根据下式调整图像中像素的R、G、B值R_new、G_new和B_new:RGB adjustment module, for adjusting the R, G, B value R_new, G_new and B_new of pixel in the image according to the following formula: R_new=R×R_gainR_new=R×R_gain G_new=G×G_gainG_new=G×G_gain B_new=B×B_gain。B_new=B*B_gain.

CN2008100262668A 2008-01-31 2008-01-31 White balance adjustment method, system and camera Expired - Fee Related CN101227623B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008100262668A CN101227623B (en) 2008-01-31 2008-01-31 White balance adjustment method, system and camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008100262668A CN101227623B (en) 2008-01-31 2008-01-31 White balance adjustment method, system and camera

Publications (2)

Publication Number Publication Date
CN101227623A CN101227623A (en) 2008-07-23
CN101227623B true CN101227623B (en) 2012-07-04

Family

ID=39859340

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008100262668A Expired - Fee Related CN101227623B (en) 2008-01-31 2008-01-31 White balance adjustment method, system and camera

Country Status (1)

Country Link
CN (1) CN101227623B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104378612A (en) * 2013-08-12 2015-02-25 联想(北京)有限公司 Method for adjusting color balance and electronic device

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101568039B (en) * 2009-06-03 2011-04-20 广东威创视讯科技股份有限公司 White balance adjusting method, white balance adjusting device and camera
CN102271259B (en) * 2011-08-09 2014-12-24 深圳万兴信息科技股份有限公司 Color temperature adjusting method and device
CN102271260B (en) * 2011-09-07 2014-04-16 天津天地伟业数码科技有限公司 Method for adjusting white balance
CN103780890B (en) * 2012-10-17 2017-07-14 鸿富锦精密工业(深圳)有限公司 White balance adjustment method
CN103037224A (en) * 2012-12-07 2013-04-10 珠海全志科技股份有限公司 Image white balance processing method and device
CN103200410B (en) * 2013-04-01 2015-07-08 上海富瀚微电子股份有限公司 White balance control method and white balance control device
CN103400557A (en) * 2013-07-29 2013-11-20 广东欧珀移动通信有限公司 A method and device for improving the display effect of an LCD display screen of a mobile communication terminal
US20170055574A1 (en) 2015-08-31 2017-03-02 British American Tobacco (Investments) Limited Cartridge for use with apparatus for heating smokable material
CN105812762A (en) * 2016-03-23 2016-07-27 武汉鸿瑞达信息技术有限公司 Automatic white balance method for processing image color cast
CN107404640B (en) * 2016-05-20 2018-12-25 北京集创北方科技股份有限公司 The white balance correcting and digital imaging device of digital imaging device
CN106709887A (en) * 2017-01-06 2017-05-24 凌云光技术集团有限责任公司 Image gray-world white balance adjustment method and device based on color temperature curve
CN107483909A (en) * 2017-10-11 2017-12-15 凌云光技术集团有限责任公司 White balancing treatment method and device
CN110876049B (en) * 2018-08-29 2021-12-28 浙江宇视科技有限公司 Image white balance processing method and device
CN109246406B (en) * 2018-11-16 2019-12-31 中国科学院西安光学精密机械研究所 A Realization Method of Automatic White Balance of Color Camera
CN112026496B (en) * 2019-06-04 2022-02-22 上海擎感智能科技有限公司 Vehicle window display method, front end, rear end, medium and equipment
CN112243119B (en) * 2019-07-19 2022-05-03 杭州海康威视数字技术股份有限公司 White balance processing method and device, electronic equipment and storage medium
CN110933404B (en) * 2019-11-30 2021-09-28 航天科技控股集团股份有限公司 Product liquid crystal white balance detection method
CN112055190B (en) * 2020-08-18 2025-02-14 重庆港宇高科技开发有限公司 Image processing method, device and storage medium
CN112040202B (en) * 2020-08-18 2025-02-14 重庆港宇高科技开发有限公司 Scene recognition method, device and storage medium
KR20220140369A (en) * 2021-04-09 2022-10-18 에스케이하이닉스 주식회사 Image sensing device and operating method thereof
CN116095511A (en) * 2023-02-07 2023-05-09 江苏无右微创医疗科技有限公司 A semi-automatic white balance realization method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1293521A (en) * 1999-10-18 2001-05-02 国际商业机器公司 White dot regulating method colour image processing method, white dot regulating device and liquid crystal display apparatus
CN1459983A (en) * 2002-05-20 2003-12-03 三星电子株式会社 White balance regulator and method thereof

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1293521A (en) * 1999-10-18 2001-05-02 国际商业机器公司 White dot regulating method colour image processing method, white dot regulating device and liquid crystal display apparatus
CN1459983A (en) * 2002-05-20 2003-12-03 三星电子株式会社 White balance regulator and method thereof

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
JP特开2000-148978A 2000.05.30
附图1、5.
附图2.

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104378612A (en) * 2013-08-12 2015-02-25 联想(北京)有限公司 Method for adjusting color balance and electronic device
CN104378612B (en) * 2013-08-12 2017-09-29 联想(北京)有限公司 A kind of method and electronic equipment for adjusting color balance

Also Published As

Publication number Publication date
CN101227623A (en) 2008-07-23

Similar Documents

Publication Publication Date Title
CN101227623B (en) 2012-07-04 White balance adjustment method, system and camera
WO2019148912A1 (en) 2019-08-08 Image processing method, apparatus, electronic device and storage medium
US8941755B2 (en) 2015-01-27 Image processing device with automatic white balance
CN102724405B (en) 2015-04-08 Method and device for automatic exposure compensation of backlit scenes in video imaging system
CN100421126C (en) 2008-09-24 Method, system and corresponding device for adjusting color balance in digital image processing chain
RU2496250C1 (en) 2013-10-20 Image processing apparatus and method
US20150215595A1 (en) 2015-07-30 Image processor, imaging apparatus equipped with the same, and image processing method
US20080112639A1 (en) 2008-05-15 Method and apparatus for removing noise in dark area of image
US9025820B2 (en) 2015-05-05 Image processing apparatus and image processing method
WO2011118329A1 (en) 2011-09-29 Image processing apparatus and control method for image processing apparatus
US8655098B2 (en) 2014-02-18 Image signal processing apparatus and computer-readable recording medium recording image signal processing program
JP5782311B2 (en) 2015-09-24 Imaging apparatus and control method thereof
KR20060118352A (en) 2006-11-23 Image processing apparatus, imaging device, and image processing program
KR101754425B1 (en) 2017-07-05 Apparatus and method for auto adjusting brightness of image taking device
US8144218B2 (en) 2012-03-27 Image signal processing apparatus, image signal processing program, and image signal processing method
KR101854432B1 (en) 2018-05-03 Method and apparatus for detecting and compensating back light frame
KR100915598B1 (en) 2009-09-07 White balance automatic adjustment device and method
CN202721740U (en) 2013-02-06 Automatic exposure compensation device of backlight type scenes in video imaging system
CN115804080B (en) 2025-01-03 Correction of color-tinted pixels captured in low-light conditions
JP5591026B2 (en) 2014-09-17 Imaging apparatus and control method thereof
KR101005769B1 (en) 2011-01-06 Auto exposure control and auto white balance for high dynamic range situations
CN111970501A (en) 2020-11-20 Pure color scene AE color processing method and device, electronic equipment and storage medium
JP2008305122A (en) 2008-12-18 Image-processing apparatus, image processing method and program
US7688357B2 (en) 2010-03-30 Method and apparatus for color temperature correction in a built-in camera of a portable terminal
KR101131109B1 (en) 2012-04-03 Auto white balance setting method by white detection considering sensor characteristic

Legal Events

Date Code Title Description
2008-07-23 C06 Publication
2008-07-23 PB01 Publication
2008-09-17 C10 Entry into substantive examination
2008-09-17 SE01 Entry into force of request for substantive examination
2012-07-04 C14 Grant of patent or utility model
2012-07-04 GR01 Patent grant
2017-06-30 TR01 Transfer of patent right

Effective date of registration: 20170612

Address after: 519085 C District, 1# workshop, No. 1, science and technology No. four road, hi tech Zone, Zhuhai, Guangdong, China

Patentee after: ACTIONS (ZHUHAI) TECHNOLOGY Co.,Ltd.

Address before: 519085 hi tech Zone, Guangdong, Zhuhai science and Technology Innovation Coast Road, No. four, No. 1

Patentee before: ACTIONS SEMICONDUCTOR Co.,Ltd.

2017-06-30 TR01 Transfer of patent right
2020-09-22 CP01 Change in the name or title of a patent holder

Address after: 519085 High-tech Zone, Tangjiawan Town, Zhuhai City, Guangdong Province

Patentee after: ACTIONS TECHNOLOGY Co.,Ltd.

Address before: 519085 High-tech Zone, Tangjiawan Town, Zhuhai City, Guangdong Province

Patentee before: ACTIONS (ZHUHAI) TECHNOLOGY Co.,Ltd.

2020-09-22 CP01 Change in the name or title of a patent holder
2025-01-24 CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120704

2025-01-24 CF01 Termination of patent right due to non-payment of annual fee