Background technology
In the prior art, because the impact of color filters (color filter) characteristic, the image color of taking with the cmos image sensing device often not just, namely out color of image has colour cast from cmos sensor, need certain method to proofread and correct, a kind of known bearing calibration is:
Take the picture of a color verification sheet (color checker)-Standard colour board, calculate the mean value of each piece color lump in the captured image, compare with the standard value of corresponding color lump in the Standard colour board, estimate each correction coefficient (color coefficient) should be transferred in the color correction matrix (color matrix) direction and scope, until reach the purpose of colour correction.The color correction formula is as follows:
(1’)
Wherein, R ', G ', B ' are the standard value in the Standard colour board, and R, G, B are value corresponding to image after taking, and Color correction matrix is the color correction matrix.
In the cmos sensor device, be generally the 3X3 matrix as known color in common use correction matrix:
And need to satisfy: M11+M12+M13=1; (3 ')
M21+M22+M23=1; (4’)
M31+M32+M33=1; (5‘)
It is as follows that the rgb space data are transformed into the formula in YCbCr space:
Be the color gamut space transition matrix.
Be the YCbCr spatial data,
Be the rgb space data after the process colour correction.
The colour correction of prior art and rgb space are transformed into the YCbCr space, all carry out respectively step by step, can not select on demand.In addition, if need to carry out simultaneously colour correction and space translation operation, need to carry out repeatedly multiplying, required multiplier is also many, so that the area of image processing circuit is larger.
Embodiment
In order to make technical problem solved by the invention, technical scheme and beneficial effect clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
The embodiment of a kind of image processing method of the present invention as shown in Figure 1, comprises the steps:
S1, the red component that obtains each pixel of image, green component, blue component;
S2, at picture frame between dynamic stage, set color correction matrix or set the color gamut space transition matrix or calculate the combinatorial matrix of the product of color correction matrix and color gamut space transition matrix;
S3, in the image line valid period, utilize described color correction matrix or described color gamut space transition matrix or described combinatorial matrix that red component, green component, the blue component of described each pixel of image are proofreaied and correct.
As shown in Figure 2, T1 is picture frame section ineffective time, and T2 is image line section effective time.In order to determine frame between dynamic stage, need detection to be in invalid time started of frame and concluding time.In order to determine the row valid period, need detection to be in frame effectively and effective time started of row and concluding time.
Described color correction matrix is:
And need to satisfy: M11+M12+M13=1; (2)
M21+M22+M23=1; (3)
M31+M32+M33=1; (4)
Described color correction matrix is color correction matrix, and described M11, M12, M13, M21, M22, M23, M31, M32, M33 are color correction coefficient;
The color gamut space transition matrix is
A11, a12, a13, a21, a21, a23, a31, a32, a33 are the color gamut space conversion coefficient.
The formula that calculates the combinatorial matrix of presetting color correction matrix and default color gamut space transition matrix product is as follows:
(6)
Be combinatorial matrix,
Be the color gamut space transition matrix,
Be color correction matrix.
Image processing method of the present invention, is set color correction matrix or is set the color gamut space transition matrix or the combinatorial matrix of calculating color correction matrix and color gamut space transition matrix product between dynamic stage at picture frame; In the image line valid period, utilize described color correction matrix or described color gamut space transition matrix or described combinatorial matrix that red component, green component, the blue component of described each pixel of image are proofreaied and correct.This image processing method can carry out the selection that image is processed on demand, if and carry out simultaneously colour correction and space translation operation, in the method color correction matrix is in the different time periods from merging and the image rectification of color gamut space transition matrix, can reuse multiplier, reduce the use of multiplier, thereby reach the effect that reduces circuit area.
Constant color correction matrix with 3*3 is carried out linear transformations to input picture, and multiplication calculates introduces extra noise, and the image noise stack that each processing links is introduced under low light shines will cause the noise level of final image bad luck.Color representation and noise level are two large important indicators of evaluation map image quality.All very large in dark scene lower integral time and global gain, corresponding noise also is in high level.Consider that low light shows even more important reality according to noise control level under the scene than color, then adopt the coefficient that reduces color correction matrix to reduce noise.
A kind of processing method is, adds following steps: S4 between the step S1 of described image processing method and step S2: between dynamic stage, obtain the current time of integration and current global gain value at picture frame;
S5: at picture frame between dynamic stage, according to the described current time of integration and described current global gain value adjusting color correction matrix.
As shown in Figure 3, then whole image processing method comprises the steps: S1, obtains red component, green component, the blue component of each pixel of image;
S4: between dynamic stage, obtain the current time of integration and current global gain value at picture frame;
S5: at picture frame between dynamic stage, according to the described current time of integration and described current global gain value adjusting color correction matrix;
S2, at picture frame between dynamic stage, set the color correction matrix after the described adjustment or set the color gamut space transition matrix or calculate described adjustment after color correction matrix and the combinatorial matrix of the product of color gamut space transition matrix;
S3, in the image line valid period, utilize color correction matrix after the described adjustment or described color gamut space transition matrix or described combinatorial matrix that red component, green component, the blue component of described each pixel of image are proofreaied and correct.
As the embodiment of the invention, as shown in Figure 4, described step S5 specifically comprises:
S51, judge the described current time of integration whether greater than described time of integration of threshold value, when the described current time of integration greater than described time of integration during threshold value, then judge to enter the low light scene;
S52, under the low light scene, whether judge described current global gain value greater than described global gain threshold value, if described current global gain value greater than described global gain threshold value, judgement need to be adjusted automatically to color correction matrix;
Need automatically to adjust color correction matrix if S53 judges, calculate the difference of described current global gain value and global gain threshold value, utilize difference to determine to adjust coefficient k;
S54, utilization are adjusted coefficient k described color correction matrix are adjusted.
The difference of described current global gain value and global gain threshold value is larger, then adjusts the coefficient k value less, and the span of described adjustment coefficient k is [0,1], namely when difference is larger, and the current half-light environment that is in then, corresponding noise also is in high level.Consider that low light shows even more important reality according to noise control level under the scene than color, then K gets minimum value 0, and the coefficient that reduces color correction matrix reaches the purpose that reduces picture noise.When difference hour, then K gets maximum 1, makes image have higher color representation.
Color correction matrix after the described adjustment is as follows:
(5) described
For adjusting rear color correction matrix, k is for adjusting coefficient.
As embodiments of the invention, then among the corresponding step S2, between dynamic stage, the color correction matrix after calculating is adjusted and the combinatorial matrix of color gamut space transition matrix product are specific as follows at picture frame:
Combinatorial matrix is:
Be combinatorial matrix,
Be the color gamut space transition matrix,
Be the color correction matrix after adjusting.
Image processing method of the present invention is at picture frame between dynamic stage, according to the current time of integration and current global gain value color correction matrix being adjusted, to satisfy the demand of under the different light scene image being carried out colour correction, between dynamic stage, also set color correction matrix or the color correction matrix after setting color gamut space transition matrix or the calculating adjustment and the combinatorial matrix of color gamut space transition matrix product after adjusting at picture frame; In the image line valid period, utilize after the described adjustment color correction matrix or described color gamut space transition matrix or described combinatorial matrix that red component, green component, the blue component of described each pixel of image are proofreaied and correct.This image processing method can carry out the selection that image is processed on demand, if and carry out simultaneously colour correction and space conversion process, in the method color correction matrix is in the different time periods from merging and the image rectification of color gamut space transition matrix, can reuse multiplier, reduce the use of multiplier, thereby reach the effect that reduces circuit area.
The above only is preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.