Embodiment
The below describes embodiments of the invention in detail, and the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or the element with identical or similar functions from start to finish.Be exemplary below by the embodiment that is described with reference to the drawings, only be used for explaining the present invention, and can not be interpreted as limitation of the present invention.
Fig. 1 is the white balance method flow chart of the photosensitive device of one embodiment of the invention.As shown in Figure 1, the white balance method according to the photosensitive device of the embodiment of the present invention comprises the following steps:
Step S101 determines reference white point in input picture according to the image information of input picture.
Particularly, judge whether the red, green, blue component value of input picture satisfies below with reference to the white point judgment formula 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, and LIMIT1, LIMIT2, LIMIT3 and LIMIT4 are respectively predetermined the first detection threshold, the second detection threshold, the 3rd detection threshold and the 4th detection threshold.
Wherein, the purpose of formula (10) and formula (11) is to find out three color components of RGB and differs smaller pixel.The purpose of formula (12) is to remove the lower and higher pixel of brightness ratio, and this is low due to brightness ratio and the higher pixel RGB component value of brightness ratio all can not reflect color truly, so should remove.If the red, green, blue component value of the pixel of input picture satisfies above-mentioned with reference to white point judgment formula (10), (11) and (12) simultaneously, pixel is with reference to white point.
Particularly, can be by take white object under different-colour (for example 2500K-7500K), statistics | R-G| and | the size of B-G|, according to | R-G| and | the size of B-G| arranges more rational numerical value as the first detection threshold LIMIT1 and the second detection threshold LIMIT2.And according to the characteristic of photosensitive device, the 3rd detection threshold LIMIT3 and the 4th detection threshold LIMIT4 are set.
Step S102 calculates the first colour cast difference and the second colour cast difference according to the reference white point.
Particularly, at first, statistical computation is with reference to red, green, blue component mean value R_AVER, G_AVER and the B_AVER of white point.More specifically, the summation that adds up obtains red, green, blue component total value R_SUB, G_SUB and B_SUB with reference to white point to the red, green, blue component of reference white point respectively, then calculates respectively red, green, blue component mean value R_AVER, G_AVER and the B_AVER that obtains with reference to white point according to the number of reference white point.
Then, according to red, green, blue component mean value R_AVER, G_AVER and B_AVER, calculate described the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB by following formula,
R_AVER_SUB=R_AVER-G_AVER (20)
B_AVER_SUB=B_AVER-G_AVER (21)
Step S103 judges whether to carry out blank level adjustment according to the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB.
Particularly, judge whether the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB satisfy following white balance judgment formula simultaneously,
|R_AVER_SUB|<LOCK1 (30)
|B_AVER_SUB|<LOCK2 (31)
Wherein, LOCK1 and LOCK2 are respectively predetermined the first colour cast threshold value and the second colour cast threshold value.
Should understand, if reach the first colour cast difference R_AVER_SUB=0 and the second colour cast difference B_AVER_SUB=0 is more difficult, therefore, in an embodiment of the present invention, by setting the first colour cast threshold value LOCK1 and the second colour cast threshold value LOCK2 as the colour cast judgment threshold, guaranteeing that under the condition that image can not shake, the precision of the less image blank level adjustment of value of the first colour cast threshold value LOCK1 and the second colour cast threshold value LOCK2 is better.
According to the first colour cast threshold value LOCK1 that determines and the second colour cast threshold value LOCK2 judgement colour cast situation.If the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB satisfy the white balance judgment formula simultaneously, think that colour cast does not occur image this moment, input picture does not carry out the white balance processing, otherwise need to carry out blank level adjustment, continues execution in step S104.
In one embodiment of the invention, if the first colour cast difference R_AVER_SUB satisfies R_AVER_SUB>LOCK1, the current shooting scene is described for partially partially red, colour temperature is low colour temperature; If the second colour cast difference B_AVER_SUB satisfies B_AVER_SUB>LOCK2, current scene is described for partially partially blue, colour temperature is high color temperature.
Step S104 if blank level adjustment is carried out in judgement, determines the photographed scene of input picture according to the image information of input picture.
Particularly, be illustrated in figure 2 as the method flow diagram of photographed scene of definite input picture of the embodiment of the present invention, the method according to the photographed scene of definite input picture of the embodiment of the present invention specifically comprises the steps,
Step S401, according to the red, green, blue component value of the pixel of input picture, the brightness value Y of each pixel by following formula calculating input image,
Y=a*R+b*G+c*B,
Wherein, a, b, c are proportionality coefficient, and a+b+c=1, and in one embodiment of the invention, proportionality coefficient a, b, c value are respectively a=0.299, b=0.587, c=0.114.
Step S402 is according to the average brightness Y_AVER of the brightness value Y calculating input image of each pixel of input picture.
Step S403, whether time for exposure INT_TIME and the average brightness Y_AVER of judgement photosensitive device satisfy the scene judgment formula simultaneously, and the scene judgment formula is as follows,
INT_TIME<INT_TH (40)
Y_AVER>Y_TH (41)
Wherein, INT_TH is predetermined time for exposure threshold value, and Y_TH is predetermined luminance threshold, and time for exposure threshold value INT_TH can determine according to photosensitive device.
Step S404, if the time for exposure INT_TIME of average brightness Y_AVER and photosensitive device satisfies scene judgment formula (40) and (41) simultaneously, the photographed scene of input picture is Outdoor Scene, otherwise the photographed scene of input picture is indoor scene.
Step S105 determines the scope of channel gain value according to the photographed scene of input picture.
Particularly, if the photographed scene of input picture is Outdoor Scene, determine the scope of channel gain value by following formula,
LIMIT5<R_GAIN<LIMIT6 (50)
LIMIT7<B_GAIN<LIMIT8 (51)
Wherein, R_GAIN and B_GAIN are respectively red, blue channel yield value, LIMIT5, LIMIT6, LIMIT7 and LIMIT8 are respectively predetermined the first outdoor gain threshold, the second outdoor gain threshold, the 3rd outdoor gain threshold and the 4th outdoor gain threshold.In one embodiment of the invention, according to take the pure color scene image under the colour temperature environment of indoor 2500K and 7500K, the pure color scene image of taking by statistics is given respectively the first outdoor gain threshold LIMIT5, the second outdoor gain threshold LIMIT6, the 3rd outdoor gain threshold LIMIT7 and the 4th outdoor gain threshold LIMIT8 through red after blank level adjustment accurately, blue channel yield value R_GAIN and B_GAIN.
If the photographed scene of input picture is indoor scene, determine the scope of channel gain value by following formula,
LIMIT9<R_GAIN<LIMIT10 (52)
LIMIT11<B_GAIN<LIMIT12 (53)
Wherein, the interior gain threshold of the first indoor gain threshold, the second indoor gain threshold, the 3rd indoor gain threshold and the fourth ventricle that LIMIT9, LIMIT10, LIMIT11 and LIMIT12 are respectively predetermined, in one embodiment of the invention, according to taking out of doors a large amount of pictures, the more scene of green plant particularly, and through blank level adjustment accurately, select effect to be worth preferably size as gain threshold LIMIT12 in the first indoor gain threshold LIMIT9, the second indoor gain threshold LIMIT10, the 3rd indoor gain threshold LIMIT11 and fourth ventricle.Can guarantee like this can carry out correct blank level adjustment to photosensitive device under each scene out of doors, can not cause the adjustment of white balance mistake because of some reflective serious scenes, cause image generation colour cast phenomenon.
No matter out of doors under scene or indoor scene, equal green channel gain value values of being set to be scheduled to, in an example of the present invention, green channel gain value can pre-deposit in the register of photosensitive device.
Step S106 according to scope and the default step-length of channel gain value, adjusts the channel gain value to obtain the end value of channel gain value.
Because outdoor and indoor colour temperature differ greatly, need long adjustment process when therefore switching.In one embodiment of the invention, the function that adds step-length to select, thus when different photographed scenes is changed mutually, regulate the step-length that gain is adjusted, realize more quickly the image blank level adjustment.
Particularly, at first, determine the step-length of the channel gain value under different photographed scenes according to the first colour cast difference R_AVER_SUB and the second colour cast difference B_AVER_SUB.Then, adjust the channel gain value according to the scope of step-length, the first colour cast difference R_AVER_SUB, the second colour cast difference B_AVER_SUB and channel gain value, to obtain the end value of channel gain value.
For example, judge whether the first colour cast difference R_AVER_SUB satisfies the first following step-length and select formula,
|R_AVER_SUB|>LOCK3 (60)
Wherein, LOCK3 is the 3rd predetermined colour cast threshold value, and satisfies LOCK3>LOCK1 and selected large step-length to prevent when the needs small step is long to be adjusted, and the adjustment phenomenon occurs.
If satisfying the first step-length, the first colour cast difference R_AVER_SUB selects formula, select the step-length of red channel gain value R_GAIN to be the first predetermined step-length STEP1, otherwise select the step-length of red channel gain value R_GAIN to be the second predetermined step-length STEP2, wherein STEP1>STEP2>0.Thus, can select different step-lengths according to concrete scene, increase regulated efficiency and the precision of white balance.
Judge whether the second colour cast difference B_AVER_SUB satisfies 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 to have selected large step-length when small step is long to be adjusted to prevent, and the adjustment phenomenon occurs.
Select formula if the second colour cast difference B_AVER_SUB satisfies the second step-length, select the step-length of blue channel yield value B_GAIN to be the first predetermined step-length STEP1, otherwise select the step-length of blue channel yield value B_GAIN to be the second predetermined step-length STEP2.
It should be understood that definite order in no particular order of the step-length of red channel gain value R_GAIN and blue channel yield value B_GAIN.The step-length of red channel gain value R_GAIN and blue channel yield value B_GAIN can be identical, also can be different.Particularly, set the size of STEP1 and STEP2 according to the accuracy of R_GAIN and B_GAIN value.
Be illustrated in figure 3 as the method flow diagram of the red channel gain value of adjustment of the embodiment of the present invention, the method for channel gain value red in the adjustment of the embodiment of the present invention specifically comprises the steps,
Step S701 judges that whether the first colour cast difference R_AVER_SUB is greater than 0.
Step S702, if the first colour cast difference R_AVER_SUB>0, red channel gain value R_GAIN increases a step-length.
Particularly, the large I of the step-length of red channel gain value R_GAIN increase is determined according to the first colour cast difference R_AVER_SUB.If satisfying the first above-mentioned step-length, the first colour cast difference R_AVER_SUB selects formula, red channel gain value R_GAIN increases by first a step-length STEP1, do not select formula if the first colour cast difference R_AVER_SUB does not satisfy the first above-mentioned step-length, red channel gain value R_GAIN increases by second a step-length STEP2.
Step S703, if the first colour cast difference R_AVER_SUB<0, red channel gain value R_GAIN reduces a step-length.
Particularly, the large I of the step-length that reduces of red channel gain value R_GAIN is determined according to the first colour cast difference R_AVER_SUB.If satisfying the first above-mentioned step-length, the first colour cast difference R_AVER_SUB selects formula, red channel gain value R_GAIN reduces first a step-length STEP1, do not select formula if the first colour cast difference R_AVER_SUB does not satisfy the first above-mentioned step-length, red channel gain value R_GAIN reduces second a step-length STEP2.
Whether step S704, the red channel gain value R_GAIN after judgement is adjusted be in red channel gain value scope.
Step S705 is if the red channel gain value R_GAIN after adjusting repeats above-mentioned set-up procedure S702 to step S704 not in red channel gain value scope.
Step S706 is if the red channel gain value R_GAIN after the red channel gain value R_GAIN after adjusting in red channel gain value scope, adjusts is the end value of red channel gain value.
Be illustrated in figure 4 as the method flow diagram of the adjustment blue channel yield value of the embodiment of the present invention, the method according to the adjustment blue channel yield value of the embodiment of the present invention specifically comprises the steps,
Step S707 judges that whether the second colour cast difference B_AVER_SUB is greater than 0.
Step S708, if the second colour cast difference B_AVER_SUB>0, blue channel yield value B_GAIN increases a step-length.
Particularly, the large I of the step-length of blue channel yield value B_GAIN increase is determined according to the second colour cast difference B_AVER_SUB.If satisfying the second above-mentioned step-length, the second colour cast difference B_AVER_SUB selects formula, blue channel yield value B_GAIN increases by first a step-length STEP1, do not select formula if the second colour cast difference B_AVER_SUB does not satisfy the second above-mentioned step-length, blue channel yield value B_GAIN increases by second a step-length STEP2.
Step S709, if the second colour cast difference B_AVER_SUB<0, blue channel yield value B_GAIN reduces a step-length.
Particularly, the large I of the step-length that reduces of blue channel yield value B_GAIN is determined according to the second colour cast difference B_AVER_SUB.If satisfying the second above-mentioned step-length, the second colour cast difference B_AVER_SUB selects formula, blue channel yield value B_GAIN reduces first a step-length STEP1, do not select formula if the second colour cast difference B_AVER_SUB does not satisfy the second above-mentioned step-length, blue channel yield value B_GAIN reduces second a step-length STEP2.
Whether step S7010, the blue channel yield value B_GAIN after judgement is adjusted be in blue channel yield value scope.
Step S7011 is if the blue channel yield value B_GAIN after adjusting repeats above-mentioned set-up procedure S708 to step S7010 not in blue channel yield value scope.
Step S7012 is if the blue channel yield value B_GAIN after the blue channel yield value B_GAIN after adjusting in blue channel yield value scope, adjusts is the end value of blue channel yield value.
It should be understood that and adjust red channel gain value and adjust the blue channel yield value regardless of the front and back order.
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 the described photosensitive device of embodiments of the invention take the G component as benchmark, adjusts respectively the yield value of R passage and B passage, change image R component and B component, realize the blank level adjustment of image.In other embodiments of the invention; can also be take other components as benchmark; for example adjust respectively the yield value of G passage and B passage take the R component as benchmark, change the blank level adjustment that image G component and B component are realized image, within these changes and variation all should be included in protection scope of the present invention.
White balance method according to the photosensitive device of the embodiment of the present invention, the step of the photographed scene by having increased definite image on the one hand, change the adjusting range of channel gain value under different photographed scenes, can wait out of doors thus under the scene of higher color temperature and accurately realize Automatic white balance; On the other hand, select different step-lengths according to the first colour cast difference with the second colour cast difference, thereby when different photographed scenes is changed mutually, regulate the step-length that gain is adjusted, realize more quickly the image blank level adjustment, for example, can be in the situation that two kinds of colour temperature temperature difference be larger, as in indoor scene when colour temperature changes greatly, at first select larger step-length to carry out coarse adjustment, then select than the long fine tuning of small step, when having improved thus the colour temperature variation, Automatic white balance regulates the speed.
Fig. 5 is the structural representation of white balancing apparatus of the photosensitive device of one embodiment of the invention.As shown in Figure 5, the white balancing apparatus according to the photosensitive device of the embodiment of the present invention comprises colour cast computing module 100, white balance judge module 200, channel gain value scope determination module 300 and blank level adjustment module 400.
Wherein, colour cast computing module 100 is used for determining according to the image information of input picture the reference white point of input picture, and calculates the first colour cast difference and the second colour cast difference according to the reference white point.White balance judge module 200 is used for judging according to the first colour cast difference and the second colour cast difference whether input picture carries out blank level adjustment.Channel gain value scope determination module 300 is used for determining the photographed scene of input picture according to the image information of input picture when white balance judge module 200 is determined to carry out blank level adjustment, and the scope of definite channel gain value.Blank level adjustment module 400 is used for according to the scope of channel gain value and default step-length, adjusts the 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, in one embodiment of the invention, colour cast computing module 100 comprises reference white point detecting unit 110 and colour cast computing unit 120.
Wherein, reference white point detecting unit 110 is used for determining according to the red, green, blue component value of input picture the reference white point of input picture.Colour cast computing unit 120 is used for the red, green, blue component mean value according to the red, green, blue component value computing reference white point of reference white point, and according to red, green, blue component mean value calculation the first colour cast difference and the second colour cast difference of reference white point.
Fig. 7 is the structural representation of the channel gain value scope determination module of the embodiment of the present invention.As shown in Figure 7, in one embodiment of the invention, channel gain value scope determination module 300 comprises mean flow rate computing unit 310, photographed scene determining unit 320, outdoor channel gain value determining unit 330 and indoor channel yield value determining unit 340.
Wherein, mean flow rate computing unit 310 is used for the average brightness according to the red, green, blue component value calculating input image of the pixel of input picture.The time for exposure that photographed scene determining unit 320 is used for according to average brightness and the photosensitive device of input picture, the photographed scene of judgement input picture is Outdoor Scene or indoor scene.Outdoor channel gain value determining unit 330 is used for determining the channel gain value scope of Outdoor Scene.Indoor channel yield value determining unit 340 is used 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 one embodiment of the invention, blank level adjustment module 400 comprises the first step-length determining unit 410, the second step-length determining unit 420 and blank level adjustment unit 430.
Wherein, the first step-length determining unit 410 is used for determining according to the first colour cast difference the step-length of red channel gain value.The second step-length determining unit 420 is used for determining according to the second colour cast difference the step-length of blue channel yield value.Blank level adjustment unit 430 is used for according to the step-length of red channel gain value and the step-length of blue channel yield value, red channel gain value and blue channel yield value being adjusted respectively.
The specific operation process that should be understood that modules in device embodiment of the present invention and unit can be identical with the description in embodiment of the method, is not described in detail herein.
White balancing apparatus according to the photosensitive device of the embodiment of the present invention, on the one hand by determining the photographed scene of image, change the adjusting range of channel gain value under different photographed scenes, can wait out of doors thus under the scene of higher color temperature and accurately realize Automatic white balance; On the other hand, select different step-lengths according to the first colour cast difference with the second colour cast difference, thereby when different photographed scenes is changed mutually, regulate the step-length that gain is adjusted, realize more quickly the image blank level adjustment.In addition, device of the present invention is realized simple, and cost is lower.
Fig. 9 is the structural representation of the photosensitive device of one embodiment of the invention.As shown in Figure 9, according to the photosensitive device of the embodiment of the present invention, comprise optical pickocff 1, RGB tunnels analogy gain module 2, white balancing apparatus 3, feedback circuit 4 and Digital Image Processing module 5.
Wherein, optical pickocff 1 is used for obtaining the image of current scene.RGB tunnels analogy gain module 2 is connected with optical pickocff 1, is used for arranging the red, green, blue channel gain value of photosensitive device.Digital Image Processing module 5 is connected with RGB channel gain analog module 2, is used for according to red, green, blue channel gain value, image being processed to obtain the RGB data of image.White balancing apparatus 3 is connected to receive the RGB data of image with Digital Image Processing module 5, and carrying out blank level adjustment to obtain the final adjusted value of red, green, blue channel gain value according to the RGB data of image, white balancing apparatus 3 is the described white balancing apparatus of the invention described above embodiment.Feedback circuit 4 is connected between white balancing apparatus 3 and RGB tunnels analogy gain module 2, and the final adjusted value that is used for the channel gain value that white balancing apparatus 3 is definite feeds back to RGB tunnels analogy gain module 2 so that red, green, blue channel gain value is adjusted.
Need to prove, in embodiments of the present invention, the blank level adjustment that carries out in white balancing apparatus 3 realizes at rgb space, after namely needing view data with other color spaces to be transformed into the rgb space data, then uses the white balance adjustment method of the embodiment of the present invention.
Photosensitive device according to the embodiment of the present invention, by increasing white balancing apparatus of the present invention, wait out of doors under the scene of higher color temperature and can accurately realize Automatic white balance, take high-quality image, simultaneously, implement different blank level adjustments according to different photographed scenes, when switching between different photographed scenes, select different adjustment step-lengths, accomplish Automatic white balance adjustment fast, realize accurate, the quick obtaining of photographic images.
Although illustrated and described embodiments of the invention, for the ordinary skill in the art, be appreciated that without departing from the principles and spirit of the present invention and can carry out multiple variation, modification, replacement and modification to these embodiment, scope of the present invention is by claims and be equal to and limit.