Summary of the invention
The invention provides a kind of green balance adjustment method and device, by when judging green-component pixel values the need of correction, both with reference to the average pixel value of two kinds of green components in institute's statistical regions, again with reference to two green-component pixel values in current pixel block, and increase the mode of adjustable parameter, while can improving green balanced adjustment effect, improve the flexibility ratio of adjustment.
Green balance adjustment method provided by the invention, comprising:
S1: the mean value G obtaining green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb;
S2: obtain the component value G that described G1 and described G2 is corresponding before green balance
1Fand G
2Fabsolute difference G
imb2;
S3: according to described G
imb, described G
imb2and G described in the first calculation of parameter of user's setting
1Fand described G
2Ferror correction judgment value G'
imb;
S4: according to described G
imb, described G
imb2and G described in the second calculation of parameter of user's setting
1Fand described G
2Fcorrection numerical value G "
imb;
S5: judge described G'
imbwhether be greater than preset threshold value, if so, then perform the first default mode, if not, then according to prepattern and described G "
imbcarry out the process of clap function.
Optionally,
Also comprise before described step S1:
According to suing for peace, the mode of taking the mean calculates G described in the corresponding mean value of described G1 and described G2 in preset spatial dimension
1AVGwith described G
2AVG.
Optionally,
Described step S3 comprises:
G'
imb=P1 × (K1 × G
imb)
q1+ P2 × (K2 × G
imb2)
q2, wherein P1, K1, Q1, P2, K2 and Q2 are predetermined fixed value or self-defined numerical value.
Optionally,
Described step S4 comprises:
G "
imb=S1 × (L1 × G
imb)
t1+ S2 × (L2 × G
imb2)
t2, wherein S1, L1, T1, S2, L2 and T2 are predetermined fixed value or self-defined numerical value.
Optionally,
Described first default mode comprises:
Determine the component value G that described G1 is corresponding after green balance
1Cequal G
1Fvalue, the component value G that described G2 is corresponding after green balance
2Cequal G
2Fvalue.
Optionally,
Described according to prepattern and described G "
imbcarry out the process of clap function to comprise:
K1, judge described G
1AVGwhether be greater than described G
2AVGif perform step K 2, otherwise perform step K 3;
K2, determine the component value G that described G1 is corresponding after green balance
1Cfor clap (G
1F-G "
imb) the value of clap function, the component value G that described G2 is corresponding after green balance
2Cfor clap (G
2F+ G "
imb) the value of clap function;
K3, determine the component value G that described G1 is corresponding after green balance
1Cfor clap (G
1F+ G "
imb) the value of clap function, the component value G that described G2 is corresponding after green balance
2Cfor clap (G
2F-G "
imb) the value of clap function.
Green balance adjusting device provided by the invention, uses in conjunction with above-mentioned green balance adjustment method, comprising:
First acquiring unit, for obtaining the mean value G of green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb;
Second acquisition unit, for obtaining described G1 and described G2 component value G corresponding before green balance
1Fand G
2Fabsolute difference G
imb2;
First computing unit, for according to described G
imb, described G
imb2and G described in the first calculation of parameter of user's setting
1Fand described G
2Ferror correction judgment value G'
imb;
Second computing unit, for according to described G
imb, described G
imb2and G described in the second calculation of parameter of user's setting
1Fand described G
2Fcorrection numerical value G "
imb;
Judging unit, for judging described G'
imbwhether be greater than preset threshold value, if so, then trigger the first determining unit, if not, then according to prepattern and described G "
imbcarry out the process of clap function.
Optionally,
Described green balance adjusting device also comprises:
3rd computing unit, for calculating G described in the corresponding mean value of described G1 and described G2 in preset spatial dimension according to the mode of taking the mean of suing for peace
1AVGwith described G
2AVG.
Optionally,
Described first determining unit, for determining the component value G that described G1 is corresponding after green balance
1Cequal G
1Fvalue, the component value G that described G2 is corresponding after green balance
2Cequal G
2Fvalue.
Optionally,
Described judging unit comprises:
Judgment sub-unit, for judging described G
1AVGwhether be greater than described G
2AVG;
First determines subelement, for determining the component value G that described G1 is corresponding after green balance
1Cfor clap (G
1F-G "
imb) the value of clap function, the component value G that described G2 is corresponding after green balance
2Cfor clap (G
2F+ G "
imb) the value of clap function;
Second determines subelement, for determining the component value G that described G1 is corresponding after green balance
1Cfor clap (G
1F+ G "
imb) the value of clap function, the component value G that described G2 is corresponding after green balance
2Cfor clap (G
2F-G "
imb) the value of clap function.
In the present invention, first obtain the mean value G of green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb; Then the component value G that described G1 and described G2 is corresponding before green balance is obtained
1Fand G
2Fabsolute difference G
imb2; Then according to described G
imb, described G
imb2and G described in the first calculation of parameter of user's setting
1Fand described G
2Ferror correction judgment value G'
imb; Then according to described G
imb, described G
imb2and G described in the second calculation of parameter of user's setting
1Fand described G
2Fcorrection numerical value G "
imb; Finally judge described G'
imbwhether be greater than preset threshold value, if so, then perform the first default mode, if not, then according to prepattern and described G "
imbcarry out the process of clap function.By when judging green-component pixel values the need of correction, both with reference to the average pixel value of two kinds of green components in institute's statistical regions, again with reference to two green-component pixel values in current pixel block, and increase the mode of adjustable parameter, while green balance adjustment method provided by the invention and device can improve green balanced adjustment effect, improve the flexibility ratio of adjustment.
Embodiment
Embodiments provide a kind of green balance adjustment method and device, by when judging green-component pixel values the need of correction, both with reference to the average pixel value of two kinds of green components in institute's statistical regions, again with reference to two green-component pixel values in current pixel block, and increase the mode of adjustable parameter, while can improving green balanced adjustment effect, improve the flexibility ratio of adjustment.
The effect of clap function is that input numerical definiteness is exported in the zone of reasonableness of green-component pixel values again.If input numerical value is less than the minimum value of the zone of reasonableness of green-component pixel values, then the minimum value of getting green-component pixel values zone of reasonableness exports; If input numerical value in the zone of reasonableness of green-component pixel values, then exports according to input value initial value; If input numerical value is greater than the maximum of the zone of reasonableness of green-component pixel values, then the maximum of getting green-component pixel values zone of reasonableness exports.
Refer to Fig. 2, the first embodiment of embodiment of the present invention medium green balance adjustment method comprises:
S1: the mean value G obtaining green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb;
In the present embodiment, when needing to carry out green Balance Treatment to the color data of the video camera of the RGB type shown in Fig. 1, first need the mean value G obtaining green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb, it should be noted that, aforesaid G
1AVGand G
2AVGto be described in detail in subsequent embodiment, repeat no more herein, be understandable that, the absolute value G of aforesaid difference half
imbcomputing formula can be G
imb=| (G
1AVG-G
2AVG)/2|.
S2: obtain the component value G that G1 and G2 is corresponding before green balance
1Fand G
2Fabsolute difference G
imb2;
When obtaining the mean value G of green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imbwhile, also or afterwards, need to obtain G1 and G2 component value G corresponding before green balance
1Fand G
2Fabsolute difference G
imb2, be understandable that, aforesaid absolute difference G
imb2computing formula can be G
imb2=| G
1F-G
2F|.
S3: according to G
imb, G
imb2and the first calculation of parameter G of user's setting
1Fand G
2Ferror correction judgment value G'
imb;
Obtain G
imb, G
imb2afterwards, can according to the first calculation of parameter G of user's setting
1Fand G
2Ferror correction judgment value G'
imb, utilize error correction judgment value G'
imbg can be judged
1Fand G
2Fthe need of carrying out error correction.
S4: according to G
imb, G
imb2and the second calculation of parameter G of user's setting
1Fand G
2Fcorrection numerical value G "
imb;
Obtain G
imb, G
imb2afterwards, can according to the second calculation of parameter G of user's setting
1Fand G
2Fcorrection numerical value G "
imb, utilize and correct numerical value G "
imbg can be determined
1Fand G
2Fcarry out the value after error correction.
S5: judge G'
imbwhether be greater than preset threshold value, if so, then perform the first default mode, if not, then according to prepattern and G "
imbcarry out the process of clap function.
Judge G'
imbwhether be greater than threshold value, if so, then perform the first default mode, if not, then according to prepattern and G "
imbcarry out the process of clap function.
Be understandable that, above-mentioned preset threshold value can be the experience that those skilled in the art's long term test obtains, and does not specifically limit herein.
Be understandable that, aforesaid prepattern carries out the process of clap function and will be described in detail in subsequent embodiment, no longer specifically repeats herein.
By when judging green-component pixel values the need of correction, both with reference to the average pixel value of two kinds of green components in institute's statistical regions, again with reference to two green-component pixel values in current pixel block, and increase the mode of adjustable parameter, while the green balance adjustment method that the embodiment of the present invention provides can improve green balanced adjustment effect, improve the flexibility ratio of adjustment.
Simply describe the first embodiment of the green balance adjustment method of the present invention above, be described in detail below, refer to Fig. 3 to the second embodiment of the green balance adjustment method of the present invention, embodiment of the present invention medium green balance adjustment method second embodiment comprises:
301, the corresponding mean value G of G1 and G2 in preset spatial dimension is calculated according to the mode of taking the mean of suing for peace
1AVGand G
2AVG;
In the present embodiment, when needing to carry out green Balance Treatment to the color data of the video camera of the RGB type shown in Fig. 1, first need to calculate the corresponding mean value G of G1 and G2 in preset spatial dimension according to the mode of taking the mean of suing for peace
1AVGand G
2AVG, be understandable that, the formula that aforesaid summation is taken the mean is G
1AVG=(∑ G
1F)/m, G
2AVG=(∑ G
2F)/n, wherein m and n is respectively the number of G1, G2 component pixel point in aforesaid preset spatial dimension, and such as, preset spatial dimension shown in Fig. 1 can be the mean value G of all G1 components within the scope of multiple 2 × 2 block spaces
1AVG, all G2 components mean value G
2AVG.
302, the mean value G of green component G1 adjacent with red component in horizontal direction is obtained
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb;
In the present embodiment, when calculating the corresponding mean value G of G1 and G2 in preset spatial dimension according to the mode of taking the mean of suing for peace
1AVGand G
2AVGafterwards, the mean value G obtaining green component G1 adjacent with red component in horizontal direction is first needed
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb, it should be noted that, aforesaid G
1AVGand G
2AVGto be described in detail in subsequent embodiment, repeat no more herein, be understandable that, the absolute value G of aforesaid difference half
imbcomputing formula can be G
imb=| (G
1AVG-G
2AVG)/2|.
303, G1 and G2 component value G corresponding before green balance is obtained
1Fand G
2Fabsolute difference G
imb2;
When obtaining the mean value G of green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imbwhile, or afterwards, need to obtain G1 and G2 component value G corresponding before green balance
1Fand G
2Fabsolute difference G
imb2, be understandable that, aforesaid absolute difference G
imb2computing formula can be G
imb2=| G
1F-G
2F|.
304, according to G
imb, G
imb2and the first calculation of parameter G of user's setting
1Fand G
2Ferror correction judgment value G'
imb;
Obtain G
imb, G
imb2afterwards, can according to the first calculation of parameter G of user's setting
1Fand G
2Ferror correction judgment value G'
imb, utilize error correction judgment value G'
imbg can be judged
1Fand G
2Fthe need of carrying out error correction.
Above-mentioned error correction judgment value G'
imbbe specifically as follows P1 × (K1 × G
imb)
q1+ P2 × (K2 × G
imb2)
q2wherein P1, K1, Q1, P2, K2 and Q2 are predetermined fixed value or self-defined numerical value, the empirical value that concrete above-mentioned P1, K1, Q1, P2, K2 and Q2 can obtain for those skilled in the art's long term test, also can be the numerical value that user carries out according to own situation setting, not limit herein.
305, according to G
imb, G
imb2and the second calculation of parameter G of user's setting
1Fand G
2Fcorrection numerical value G "
imb;
Obtain G
imb, G
imb2afterwards, can according to the second calculation of parameter G of user's setting
1Fand G
2Fcorrection numerical value G "
imb, utilize and correct numerical value G "
imbg can be determined
1Fand G
2Fcarry out the value after error correction.
Above-mentioned error correction judgment value corrects numerical value G "
imbbe specifically as follows S1 × (L1 × G
imb)
t1+ S2 × (L2 × G
imb2)
t2wherein S1, L1, T1, S2, L2 and T2 are predetermined fixed value or self-defined numerical value, the empirical value that concrete above-mentioned S1, L1, T1, S2, L2 and T2 can obtain for those skilled in the art's long term test, also can be the numerical value that user carries out according to own situation setting, not limit herein.
306, G' is judged
imbwhether be greater than preset threshold value, if so, then perform the first default mode, if not, then according to prepattern and G "
imbcarry out the process of clap function.
Judge G'
imbwhether be greater than threshold value, if so, then perform the first default mode, if not, then according to prepattern and G "
imbcarry out the process of clap function.
Above-mentioned first default mode specifically can comprise: determine the component value G that G1 is corresponding after green balance
1Cequal G
1Fvalue, the component value G that G2 is corresponding after green balance
2Cequal G
2Fvalue.
Above-mentioned according to prepattern and G "
imbcarry out the process of clap function specifically to comprise: K1, judge G
1AVGwhether be greater than G
2AVGif perform step K 2, otherwise perform step K 3; K2, determine the component value G that G1 is corresponding after green balance
1Cfor clap (G
1F-G "
imb) the value of clap function, the component value G that G2 is corresponding after green balance
2Cfor clap (G
2F+ G "
imb) the value of clap function; K3, determine the component value G that G1 is corresponding after green balance
1Cfor clap (G
1F+ G "
imb) the value of clap function, the component value G that G2 is corresponding after green balance
2Cfor clap (G
2F-G "
imb) the value of clap function.
Be understandable that, above-mentioned preset threshold value can be the experience that those skilled in the art's long term test obtains, and does not specifically limit herein.
Be understandable that, aforesaid prepattern carries out the process of clap function and will be described in detail in subsequent embodiment, no longer specifically repeats herein.
By when judging green-component pixel values the need of correction, both with reference to the average pixel value of two kinds of green components in institute's statistical regions, again with reference to two green-component pixel values in current pixel block, and increase the mode of adjustable parameter, while the green balance adjustment method that the embodiment of the present invention provides can improve green balanced adjustment effect, improve the flexibility ratio of adjustment.
Simply describe the second embodiment of the green balance adjustment method of the present invention above, be described in detail below, refer to Fig. 4 to the second embodiment of the green balance adjusting device of the present invention, embodiment of the present invention medium green balance adjusting device first embodiment comprises:
First acquiring unit 401, for obtaining the mean value G of green component G1 adjacent with red component in horizontal direction
1AVGwith the mean value G of the value of green component G2 adjacent with blue component in horizontal direction
2AVGthe absolute value G of difference half
imb;
Second acquisition unit 402, for obtaining G1 and G2 component value G corresponding before green balance
1Fand G
2Fabsolute difference G
imb2;
First computing unit 403, for according to G
imb, G
imb2and the first calculation of parameter G of user's setting
1Fand G
2Ferror correction judgment value G'
imb;
Second computing unit 404, for according to G
imb, G
imb2and the second calculation of parameter G of user's setting
1Fand G
2Fcorrection numerical value G "
imb;
Judging unit 405, for judging G'
imbwhether be greater than preset threshold value, if so, then trigger the first determining unit 406, if not, then according to prepattern and G "
imbcarry out the process of clap function.
Optionally,
Refer to Fig. 5, green balance adjusting device also comprises:
3rd computing unit 407, for calculating the corresponding mean value G of G1 and G2 in preset spatial dimension according to the mode of taking the mean of suing for peace
1AVGand G
2AVG.
Optionally,
Refer to Fig. 6, the first determining unit 406, for determining the component value G that G1 is corresponding after green balance
1Cequal G
1Fvalue, the component value G that G2 is corresponding after green balance
2Cequal G
2Fvalue.
Optionally,
Judging unit 405 comprises:
Judgment sub-unit 4051, for judging G
1AVGwhether be greater than G
2AVG;
First determines subelement 4052, for determining the component value G that G1 is corresponding after green balance
1Cfor clap (G
1F-G "
imb) the value of clap function, the component value G that G2 is corresponding after green balance
2Cfor clap (G
2F+ G "
imb) the value of clap function;
Second determines subelement 4053, for determining the component value G that G1 is corresponding after green balance
1Cfor clap (G
1F+ G "
imb) the value of clap function, the component value G that G2 is corresponding after green balance
2Cfor clap (G
2F-G "
imb) the value of clap function.
The green balance adjusting device of the embodiment of the present invention is the corresponding device embodiment of the first embodiment of balance adjustment method green with the present invention and the second embodiment, therefore also has the first embodiment of the green balance adjustment method of the present invention and the advantage of the second embodiment.By when judging green-component pixel values the need of correction, both with reference to the average pixel value of two kinds of green components in institute's statistical regions, again with reference to two green-component pixel values in current pixel block, and increase the mode of adjustable parameter, while the green balance adjusting device that the embodiment of the present invention provides can improve green balanced adjustment effect, improve the flexibility ratio of adjustment.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the system of foregoing description, the specific works process of device and module, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
In several embodiments that the application provides, should be understood that, disclosed system, apparatus and method, can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described module, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple module or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or module or communication connection can be electrical, machinery or other form.
The described module illustrated as separating component can or may not be physically separates, and the parts as module display can be or may not be physical module, namely can be positioned at a place, or also can be distributed on multiple mixed-media network modules mixed-media.Some or all of module wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional module in each embodiment of the present invention can be integrated in a processing module, also can be that the independent physics of modules exists, also can two or more module integrations in a module.Above-mentioned integrated module both can adopt the form of hardware to realize, and the form of software function module also can be adopted to realize.
If described integrated module using the form of software function module realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, read-only memory (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), magnetic disc or CD etc. various can be program code stored medium.
The above, above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.