Detailed description of the invention
Embodiments of the invention are described below in detail, and the example of described embodiment is shown in the drawings, the most from start to finish
Same or similar label represents same or similar element or has the element of same or like function.Below by ginseng
The embodiment examining accompanying drawing description is exemplary, is only used for explaining the present invention, and is not construed as limiting the claims.
Fig. 1 is the white balance method flow chart of the photosensitive device of one embodiment of the invention.As it is shown in figure 1, according to this
The white balance method of the photosensitive device of inventive embodiments, comprises the following steps:
Step S101, determines the reference white point in input picture according to the image information of input picture.
Specifically, it is judged that the red, green, blue component value of input picture meets below with reference to white point judgment formula the most simultaneously,
| R-G | < LIMIT1, (10)
| B-G | < LIMIT2, (11)
LIMIT3 < G < LIMIT4, (12)
Wherein, R, G, B are respectively the red, green, blue component value of the pixel of input picture, LIMIT1, LIMIT2,
LIMIT3 and LIMIT4 is respectively predetermined first and detects threshold value, the second detection threshold value, the 3rd detection threshold value and the 4th
Detection threshold value.
Wherein, the purpose of formula (10) and formula (11) is that finding out tri-color components of RGB differs smaller
Pixel.The purpose of formula (12) is to remove the pixel that brightness ratio is relatively low and the highest, and this is due to brightness ratio
The pixel RGB component value that relatively low and brightness ratio is higher all can not reflect color, truly so should remove.If
The red, green, blue component value of the pixel of input picture meets above-mentioned with reference to white point judgment formula (10), (11) simultaneously
(12), then pixel is with reference to white point.
Specifically, can by under different-colour (such as 2500K-7500K) shoot white object, statistics | R-G | and
The size of | B-G |, arranges the rational numerical value of comparison as the first detection threshold value LIMIT1 according to the size of | R-G | He | B-G |
With the second detection threshold value LIMIT2.And according to the characteristic of photosensitive device, the 3rd detection threshold value LIMIT3 and the 4th is set
Detection threshold value LIMIT4.
Step S102, calculates the first colour cast difference and the second colour cast difference according to reference to white point.
Specifically, first, statistical computation is with reference to red, green, blue component meansigma methods R_AVER of white point, G_AVER
And B_AVER.More specifically, respectively the red, green, blue component with reference to white point is carried out cumulative summation obtain reference white
Red, green, blue component total value R_SUB of point, G_SUB and B_SUB, count respectively further according to the number with reference to white point
Calculate and obtain with reference to red, green, blue component meansigma methods R_AVER of white point, G_AVER and B_AVER.
Then, according to red, green, blue component meansigma methods R_AVER, G_AVER and B_AVER, by following
Formula calculates described first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB,
R_AVER_SUB=R_AVER-G_AVER (20)
B_AVER_SUB=B_AVER-G_AVER (21)
Step S103, sentences according to the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB
Break and whether carry out blank level adjustment.
Specifically, it is judged that the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB are the most same
Time meet following white balance judgment formula,
| R_AVER_SUB | < LOCK1 (30)
| B_AVER_SUB | < LOCK2 (31)
Wherein, LOCK1 and LOCK2 is respectively the first predetermined colour cast threshold value and the second colour cast threshold value.
Should be understood that if to reach the first colour cast difference R_AVER_SUB=0 and the second colour cast difference
B_AVER_SUB=0 is relatively difficult, therefore, in an embodiment of the present invention, by setting the first colour cast threshold value LOCK1
With the second colour cast threshold value LOCK2 as colour cast judgment threshold, under conditions of ensureing that image will not shake, first
The precision of the value the least image blank level adjustment of colour cast threshold value LOCK1 and the second colour cast threshold value LOCK2 is the best.
The first colour cast threshold value LOCK1 and the second colour cast threshold value LOCK2 according to determining judge colour cast situation.If the
One colo(u)r bias value R_AVER_SUB and the second colour cast difference B_AVER_SUB meet white balance judgment formula simultaneously,
Now think that image does not occurs colour cast, then input picture does not carry out white balance process, otherwise needs to carry out blank level adjustment,
Continue executing with step S104.
In one embodiment of the invention, if the first colour cast difference R_AVER_SUB meets R_AVER_SUB >
LOCK1, then explanation present filming scene is partially red inclined, and colour temperature is low colour temperature;If the second colour cast difference
B_AVER_SUB meets B_AVER_SUB > LOCK2, then explanation current scene is partially blue inclined, and colour temperature is high
Colour temperature.
Step S104, if it is determined that carry out blank level adjustment, then determines input picture according to the image information of input picture
Photographed scene.
Specifically, it is illustrated in figure 2 the method flow diagram of the photographed scene of the determination input picture of the embodiment of the present invention,
The method of the photographed scene of determination input picture according to embodiments of the present invention, specifically includes following steps,
Step S401, according to the red, green, blue component value of the pixel of input picture, calculates defeated by below equation
Enter the brightness value Y of each pixel of image,
Y=a*R+b*G+c*B,
Wherein, a, b, c are proportionality coefficient, and a+b+c=1, in one embodiment of the invention, proportionality coefficient a,
B, c value is respectively a=0.299, b=0.587, c=0.114.
Step S402, according to the average brightness of the brightness value Y calculating input image of each pixel of input picture
Y_AVER。
Step S403, it is judged that the time of exposure INT_TIME and average brightness Y_AVER of photosensitive device, if with
Time meet scene judgment formula, scene judgment formula is as follows,
INT_TIME < INT_TH (40)
Y_AVER > Y_TH (41)
Wherein, INT_TH is predetermined time of exposure threshold value, and Y_TH is predetermined luminance threshold, time of exposure threshold value
INT_TH can determine according to photosensitive device.
Step S404, if the time of exposure INT_TIME of average brightness Y_AVER and photosensitive device meets simultaneously
Scene judgment formula (40) and (41), then the photographed scene of input picture is Outdoor Scene, otherwise input picture
Photographed scene is indoor scene.
Step S105, determines the scope of channel gain value according to the photographed scene of input picture.
Specifically, if the photographed scene of input picture is Outdoor Scene, then channel gain is determined by below equation
The scope of value,
LIMIT5 < R_GAIN < LIMIT6 (50)
LIMIT7 < B_GAIN < LIMIT8 (51)
Wherein, R_GAIN and B_GAIN is the reddest, blue channel yield value, LIMIT5, LIMIT6, LIMIT7
With LIMIT8 be respectively the predetermined first outdoor gain threshold, the second outdoor gain threshold, the 3rd outdoor gain threshold and
4th outdoor gain threshold.In one embodiment of the invention, according to the colour temperature ring at indoor 2500K and 7500K
Pure color scene image is shot under border, the pure color scene image shot by statistics is red after blank level adjustment accurately,
Blue channel yield value R_GAIN and B_GAIN, gives the first outdoor gain threshold LIMIT5, the second outdoor increasing respectively
Benefit threshold value LIMIT6, the 3rd outdoor gain threshold LIMIT8 of outdoor gain threshold LIMIT7 and the 4th.
If the photographed scene of input picture is indoor scene, then determined the scope of channel gain value by below equation,
LIMIT9 < R_GAIN < LIMIT10 (52)
LIMIT11 < B_GAIN < LIMIT12 (53)
Wherein, LIMIT9, LIMIT10, LIMIT11 and LIMIT12 be respectively the predetermined first indoor gain threshold,
Gain threshold in second indoor gain threshold, the 3rd indoor gain threshold and fourth ventricle, in one embodiment of the present of invention
In, the scene more according to shooting substantial amounts of picture, particularly green plant out of doors, and through white balance accurately
Adjust, Selection effect be preferably worth as the first indoor gain threshold LIMIT9, the second indoor gain threshold LIMIT10,
The size of gain threshold LIMIT12 in 3rd indoor gain threshold LIMIT11 and fourth ventricle.So ensure that at family
Photosensitive device can be carried out correct blank level adjustment under each outer scene, will not be because of some reflective serious fields
Scape causes white balance mistake to adjust, and causes image generation colour cast phenomenon.
No matter out of doors under scene or indoor scene, all green channel gain value being set to predetermined value, in the present invention
An example in, green channel gain value can pre-deposit in the depositor of photosensitive device.
Step S106, according to scope and the default step-length of channel gain value, adjusts channel gain value and increases to obtain passage
The end value of benefit value.
Owing to outdoor and indoor colour temperature differs greatly, when therefore switching over, need longer adjustment process.In the present invention
An embodiment in, add the function that step-length selects, thus when different photographed scenes is mutually changed, regulation increases
The step-length that benefit adjusts, realizes image blank level adjustment more quickly.
Specifically, first, according to the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB
Determine the step-length of channel gain value under different photographed scene.Then, according to step-length, the first colour cast difference
The scope of R_AVER_SUB, the second colour cast difference B_AVER_SUB and channel gain value adjusts channel gain value,
To obtain the end value of channel gain value.
Such as, it is judged that whether the first colour cast difference R_AVER_SUB meets the first following step-length selects formula,
| R_AVER_SUB | > LOCK3 (60)
Wherein, the inclined threshold value of tertiary color that LOCK3 is predetermined, and meet LOCK3 > LOCK1 to prevent needs
Little step-length have selected big step-length when adjusting, and adjustment phenomenon occurred.
If the first colour cast difference R_AVER_SUB meets the first step-length selects formula, then select red channel gain value
The step-length of R_GAIN is the first predetermined step-length STEP1, and the step-length otherwise selecting red channel gain value R_GAIN is
The second predetermined step-length STEP2, wherein STEP1 > STEP2 > 0.Thus, can select different according to concrete scene
Step-length, increases regulated efficiency and the precision of white balance.
Judge whether the second colour cast difference B_AVER_SUB meets the second following step-length and select formula,
| B_AVER_SUB | > LOCK4 (61)
Wherein, LOCK4 is the 4th predetermined colour cast threshold value, and LOCK4 > LOCK2 needs small step to prevent
Have selected big step-length during long adjustment, adjustment phenomenon occurred.
If the second colour cast difference B_AVER_SUB meets the second step-length selects formula, then select blue channel yield value
The step-length of B_GAIN is the first predetermined step-length STEP1, and otherwise the step-length of selection blue channel yield value B_GAIN is
The second predetermined step-length STEP2.
It should be understood that red channel gain value R_GAIN and blue channel yield value B_GAIN step-length determination regardless of
Sequencing.The step-length of red channel gain value R_GAIN and blue channel yield value B_GAIN can be identical, it is also possible to
Different.Specifically, the degree of accuracy according to R_GAIN and B_GAIN value sets the size of STEP1 and STEP2.
It is illustrated in figure 3 the method flow diagram adjusting red channel gain value of the embodiment of the present invention, implements according to the present invention
The method adjusting red channel gain value of example, specifically includes following steps,
Step S701, it is judged that whether the first colour cast difference R_AVER_SUB is more than 0.
Step S702, if the first colour cast difference R_AVER_SUB > 0, the reddest channel gain value R_GAIN increases
One step-length.
Specifically, the big I of the step-length that red channel gain value R_GAIN increases is according to the first colour cast difference
R_AVER_SUB determines.If the first colour cast difference R_AVER_SUB meets the first above-mentioned step-length selects formula,
The reddest channel gain value R_GAIN increases by first step-length STEP1, if the first colour cast difference R_AVER_SUB
Being unsatisfactory for the first above-mentioned step-length and select formula, the reddest channel gain value R_GAIN increases by second step-length STEP2.
Step S703, if the first colour cast difference R_AVER_SUB < 0, the reddest channel gain value R_GAIN reduces
One step-length.
Specifically, the big I of the step-length that red channel gain value R_GAIN reduces is according to the first colour cast difference
R_AVER_SUB determines.If the first colour cast difference R_AVER_SUB meets the first above-mentioned step-length selects formula,
The reddest channel gain value R_GAIN reduces first step-length STEP1, if the first colour cast difference R_AVER_SUB
Being unsatisfactory for the first above-mentioned step-length and select formula, the reddest channel gain value R_GAIN reduces second step-length STEP2.
Step S704, it is judged that whether red channel gain value R_GAIN after adjustment is in the range of red channel gain value.
Step S705, if red channel gain value R_GAIN after Tiao Zhenging is not in the range of red channel gain value, then weighs
Multiple above-mentioned set-up procedure S702 is to step S704.
Step S706, if red channel gain value R_GAIN after Tiao Zhenging is in the range of red channel gain value, then adjusts
After the end value that red channel gain value R_GAIN is red channel gain value.
It is illustrated in figure 4 the method flow diagram adjusting blue channel yield value of the embodiment of the present invention, implements according to the present invention
The method adjusting blue channel yield value of example, specifically includes following steps,
Step S707, it is judged that whether the second colour cast difference B_AVER_SUB is more than 0.
Step S708, if the second colour cast difference B_AVER_SUB > 0, then blue channel yield value B_GAIN increases
One step-length.
Specifically, the big I of the step-length that blue channel yield value B_GAIN increases is according to the second colour cast difference
B_AVER_SUB determines.If the second colour cast difference B_AVER_SUB meets the second above-mentioned step-length selects formula,
Then blue channel yield value B_GAIN increases by first step-length STEP1, if the second colour cast difference B_AVER_SUB
Be unsatisfactory for the second above-mentioned step-length and select formula, then blue channel yield value B_GAIN increases by second step-length STEP2.
Step S709, if the second colour cast difference B_AVER_SUB < 0, then blue channel yield value B_GAIN reduces
One step-length.
Specifically, the big I of the step-length that blue channel yield value B_GAIN reduces is according to the second colour cast difference
B_AVER_SUB determines.If the second colour cast difference B_AVER_SUB meets the second above-mentioned step-length selects formula,
Then blue channel yield value B_GAIN reduces first step-length STEP1, if the second colour cast difference B_AVER_SUB
Be unsatisfactory for the second above-mentioned step-length and select formula, then blue channel yield value B_GAIN reduces second step-length STEP2.
Step S7010, it is judged that whether the blue channel yield value B_GAIN after adjustment is in the range of blue channel yield value.
Step S7011, if the blue channel yield value B_GAIN after Tiao Zhenging is not in the range of blue channel yield value, then
Repeat above-mentioned set-up procedure S708 to step S7010.
Step S7012, if the blue channel yield value B_GAIN after Tiao Zhenging is in the range of blue channel yield value, then adjusts
The end value that blue channel yield value B_GAIN is blue channel yield value after whole.
It should be understood that the red channel gain value of adjustment and adjust blue channel yield value regardless of tandem.
Step S107, adjusts the Src Chan yield value of photosensitive device according to the end value of channel gain value.
It should be understood that the white balance method of photosensitive device described in embodiments of the invention on the basis of G component, point
Not Tiao Zheng R passage and the yield value of channel B, change image R component and B component, it is achieved the blank level adjustment of image.
In other embodiments of the invention, it is also possible on the basis of other components, such as, adjust respectively on the basis of R component
G passage and the yield value of channel B, change image G component and B component and realize the blank level adjustment of image, and these change
Become and change should be included within the scope of the present invention.
The white balance method of photosensitive device according to embodiments of the present invention, on the one hand by adding the shooting determining image
The step of scene, changes the adjusting range of channel gain value under different photographed scenes, thus can wait higher out of doors
AWB is accurately realized under the scene of colour temperature;On the other hand, select according to the first colour cast difference and the second colour cast difference
Select different step-lengths, thus when different photographed scenes is mutually changed, the step-length of regulation Gain tuning, more quickly
Realize image blank level adjustment, such as, can be in the case of two kinds of colour temperature temperature difference be relatively big, as worked as color in indoor scene
When temperature changes greatly, first select larger step size to carry out coarse adjustment, then select less step-length fine tuning, which thereby enhance color
During temperature change, AWB regulates the speed.
Fig. 5 is the structural representation of the white balancing apparatus of the photosensitive device of one embodiment of the invention.As it is shown in figure 5,
The white balancing apparatus of photosensitive device according to embodiments of the present invention, including colour cast computing module 100, white balance judge module
200, channel gain value range determination module 300 and blank level adjustment module 400.
Wherein, colour cast computing module 100 for determining the reference white in input picture according to the image information of input picture
Point, and calculate the first colour cast difference and the second colour cast difference according to reference to white point.White balance judge module 200 is for root
Judge whether input picture carries out blank level adjustment according to the first colour cast difference and the second colour cast difference.Channel gain value scope
Determine module 300 for when white balance judge module 200 determine carry out blank level adjustment time, according to the figure of input picture
As information determines the photographed scene of input picture, and determine the scope of channel gain value.Blank level adjustment module 400 is used
In the scope according to channel gain value and default step-length, adjust channel gain value to obtain the end value of channel gain value.
Fig. 6 is the structural representation of the colour cast computing module of the embodiment of the present invention.As shown in Figure 6, at one of the present invention
In embodiment, colour cast computing module 100 includes reference white point detector unit 110 and colour cast computing unit 120.
Wherein, reference white point detector unit 110 is for determining input figure according to the red, green, blue component value of input picture
Reference white point in Xiang.Colour cast computing unit 120 is for calculating reference according to the red, green, blue component value with reference to white point
The red, green, blue component meansigma methods of white point, and according to red, green, blue component mean value calculation the first color with reference to white point
Deviation value and the second colour cast difference.
Fig. 7 is the structural representation of the channel gain value range determination module of the embodiment of the present invention.As it is shown in fig. 7,
In one embodiment of the present of invention, channel gain value range determination module 300 includes average luminance computing unit 310, claps
Take the photograph scene and determine that unit 320, outdoor channel yield value determine that unit 330 and indoor channel yield value determine unit 340.
Wherein, average luminance computing unit 310 is based on the red, green, blue component value of the pixel according to input picture
Calculate the average brightness of input picture.Photographed scene determine unit 320 for the average brightness according to input picture and
The time of exposure of photosensitive device, it is judged that the photographed scene of input picture is Outdoor Scene or indoor scene.Outdoor channel increases
Benefit value determines that unit 330 is for determining the channel gain value scope of Outdoor Scene.Indoor channel yield value determines unit 340
For determining the channel gain value scope of indoor scene.
Fig. 8 is the structural representation of the blank level adjustment module of the embodiment of the present invention.As shown in Figure 8, in the one of the present invention
In individual embodiment, blank level adjustment module 400 includes first step size determination unit the 410, second step size determination unit 420
With blank level adjustment unit 430.
Wherein, the first step size determination unit 410 for determining the step-length of red channel gain value according to the first colour cast difference.
Second step size determination unit 420 for determining the step-length of blue channel yield value according to the second colour cast difference.Blank level adjustment
Unit 430 for respectively according to the step-length of red channel gain value and the step-length of blue channel yield value to red channel gain value and
Blue channel yield value is adjusted.
Should be understood that the specific operation process of the modules in assembly of the invention embodiment and unit can be implemented with method
Description in example is identical, is not described in detail herein.
The white balancing apparatus of photosensitive device according to embodiments of the present invention, is on the one hand determined by the photographed scene of image,
Under different photographed scenes, change the adjusting range of channel gain value, thus can wait out of doors under the scene of higher color temperature
Accurately realize AWB;On the other hand, select different step-lengths according to the first colour cast difference with the second colour cast difference,
Thus when different photographed scenes is mutually changed, the step-length of regulation Gain tuning, realize image white balance more quickly
Adjust.Additionally, assembly of the invention realizes simple, cost is relatively low.
Fig. 9 is the structural representation of the photosensitive device of one embodiment of the invention.As it is shown in figure 9, it is real according to the present invention
Execute the photosensitive device of example, including optical pickocff 1, RGB channel analog gain module 2, white balancing apparatus 3, feedback
Circuit 4 and numeral image processing module 5.
Wherein, optical pickocff 1 is for obtaining the image of current scene.RGB channel analog gain module 2 and optics
Sensor 1 is connected, for arranging the red, green, blue channel gain value of photosensitive device.Digital Image Processing module 5 with
RGB channel gain analog module 2 is connected, for processing to obtain to image according to red, green, blue channel gain value
Obtain the RGB data of image.White balancing apparatus 3 be connected with Digital Image Processing module 5 with receive image RGB number
According to, and carry out blank level adjustment to obtain the final adjustment of red, green, blue channel gain value according to the RGB data of image
Value, white balancing apparatus 3 is the white balancing apparatus described in the invention described above embodiment.Feedback circuit 4 is connected to white balance
Between device 3 and RGB channel analog gain module 2, for channel gain value that white balancing apparatus 3 is determined
Whole adjusted value feeds back to RGB channel analog gain module 2 to be adjusted red, green, blue channel gain value.
It should be noted that in embodiments of the present invention, the blank level adjustment carried out in white balancing apparatus 3 is at RGB
Space realizes, and after namely needing the view data of other color spaces is transformed into rgb space data, reapplies
The white balance adjustment method of the embodiment of the present invention.
Photosensitive device according to embodiments of the present invention, by increasing the white balancing apparatus of the present invention, waits higher color out of doors
Can accurately realize AWB under the scene of temperature, shoot high-quality image, meanwhile, according to different shooting fields
Scape implements different blank level adjustments, when switching between different photographed scenes, selects different adjustment step-lengths,
Accomplish that quick AWB adjusts, it is achieved accurate, the quick obtaining of shooting image.
Although an embodiment of the present invention has been shown and described, for the ordinary skill in the art, permissible
Understand these embodiments can be carried out without departing from the principles and spirit of the present invention multiple change, amendment,
Replacing and modification, the scope of the present invention is limited by claims and equivalent thereof.