Embodiment
The embodiment of the invention provides a kind of video sequence light and shade to change method and the video processing equipment of repairing, and is used for improving the quality of video sequence image.
For the purpose, technical scheme and the advantage that make the embodiment of the invention more cheer and bright, below with reference to accompanying drawing, the embodiment of the invention is commented thin description:
With reference to Fig. 1, change the method flow diagram of repairing for video sequence light and shade in the embodiment of the invention one, by choosing a brightness reference frame, each present frame is carried out luminance compensation, thereby the background area brightness of keeping present frame remains unchanged with respect to reference frame, below is elaborated by step:
101, a frame in the continuous P two field picture of saltus step does not take place as the reference frame of back video sequence in the brightness in the selecting video sequence;
Selection for reference frame can be followed following principle: if on the continuous multiple frames image brightness saltus step does not take place in the video sequence, can select a frame in the continuous multiple frames image as the reference frame of back video sequence, for example, can be with the last frame of continuous multiple frames image reference frame as the back video sequence.
In order to reflect the stability of image sequence background luminance preferably, can the above image of continuous detecting 5 frames, for example, if choose 5 frames, and the saltus step in the brightness do not take place in this 5 two field picture, then can be with the reference frame of the 5th frame as the back video sequence.
102, obtain the luminance compensation function of present frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame with respect to reference frame;
Angle from signal processing and analysis, can be with the stagnant zone brightness of reference frame as input signal, the output signal of input signal corresponding to some response functions regarded in the stagnant zone brightness of present frame as, this luminosity response relation can be described as: y=f (x), wherein, x represents the stagnant zone brightness of reference frame, and y represents the stagnant zone brightness of present frame, and f represents response function.Obviously, desirable response function should be y=x.If this response relation any flicker saltus step and light and shade can not occur and change between brightness of present frame stagnant zone and the brightness of reference frame stagnant zone.Based on this thought, can obtain the luminosity response function between the stagnant zone brightness of the stagnant zone brightness of present frame and reference frame.In order to obtain the luminosity response function, the stagnant zone brightness of choosing the stagnant zone brightness of reference frame and present frame is as research object.The stagnant zone brightness of why only choosing reference frame and present frame is as research object, be because, the moving region may be because of the variation of moving object in the image, factor such as block makes brightness bigger variation occur, and the brightness of stagnant zone is that the luminosity response function is followed in strictness in the image.
Luminosity response function y=f (x) is carried out inversion operation, obtain luminance compensation function: f
-1(f (x))=x.
103, adopt described luminance compensation function, the brightness of present frame is compensated.
Adopt f
-1(f (x))=x carries out luminance compensation to present frame, can make the background area brightness of present frame and the background area brightness approximately equal of reference frame, thereby the light and shade of eliminating the background area changes, and improves picture quality.
From this embodiment as can be seen, when saltus step in the brightness does not take place in the continuous P two field picture in determining video sequence, choose in the described continuous P two field picture a frame (for example, last frame) as the reference frame of back video sequence, obtain the luminance compensation function of present frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame then with respect to reference frame, adopt described luminance compensation function, the brightness of present frame is compensated, thereby realize reparation image brightness.Owing to select for use a frame in the continuous P two field picture that saltus step does not take place in the brightness in the video sequence as the reference frame, and adopt the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame to obtain the luminance compensation function of present frame with respect to reference frame, the brightness of stagnant zone is that strictness is followed the luminance compensation function and made response in the image, having got rid of moving region in the image may be owing to the variation of moving object, block the bigger variation that occurs in the brightness makes image repair the situation of distortion occur, therefore, can obtain the better image quality.
With reference to figure 2, be that the video sequence light and shade changes the method flow diagram of repairing in the embodiment of the invention two, below be elaborated by concrete steps:
201, a frame in the continuous P two field picture of saltus step in the brightness does not take place as the reference frame of back video sequence in the selecting video sequence;
For example, in concrete enforcement, can select last frame in the described continuous P two field picture as the reference frame of back video sequence.
202, obtaining the luminosity response function of the stagnant zone brightness of present frame with respect to the stagnant zone brightness of reference frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame, is a linear function;
A large amount of video sequence that the inventor passes through carries out test analysis, finds that the luminosity response approximation to function is a linear function, can be described as:
y=a+b×x (3)
(3) x in the formula represents the stagnant zone brightness of reference frame, and y represents the stagnant zone brightness of present frame, and a and b are the parameters of describing linear response function.
Because the luminosity response function is a linear function, therefore, can adopt least square method to obtain the parameter a and the b of linear function, specifically calculate referring to formula (4)-(7):
a=y-b×x (5)
X in formula (4)-(7)
iThe brightness value of i sample in the expression reference frame image, x represents the mean value of the brightness of all samples in the reference frame, y
iThe brightness value of i sample in the expression current frame image, y represents the mean value of the brightness of all samples of present frame.
In concrete enforcement, in order to reduce the influence of noise to selected sample, the static block that the stagnant zone of the stagnant zone of reference frame and present frame can be divided into some m * n size is used as sample, rather than directly uses the still image vegetarian refreshments in the stagnant zone to be used as sample.M and n are respectively applied for the number of horizontal and vertical pixel in expression present frame/reference frame, and the size of m, n needs appropriateness, and the value of m, n is too small, possibly can't effectively reduce in the image noise to the influence of sample; The value of m, n is excessive, causes number of samples too small, can not satisfy the requirement of method of least squares.The inventor finds that through experiment the value of m, n is relatively good between being generally 4~32, and the value of m, n can identical, also can be different.
Thus, the x above in the formula of (4)-(7)
iThe brightness value of then representing i sample static block in the reference frame (herein, the mean value of all pixel intensity is used as the brightness value of sample static block in the use static block, to reduce The noise), x represents the mean value of the brightness value of all sample static blocks in the reference frame, y
iThe brightness value of i sample static block (herein in the expression present frame, also be to use the mean value of all pixel intensity in the static block to be used as the brightness value of sample static block, to reduce The noise), y represents the mean value of the brightness value of all sample static blocks of present frame.
For the stagnant zone that how can determine exactly in the image, just seeking out motion vector is zero zone, that general employing is SAD (Sum of Absolute Difference when carrying out estimation in existing video coding agreement (as: H263, H264, MPEG agreement), absolute error and) criterion, referring to following formula (8):
x,y=-N,-(N-1),...N-1,N (8)
In the formula (8), Lref (i+x, the j+y) brightness value of pixel in the expression reference frame, Lcur (i, j) brightness value of pixel in the expression present frame; The size of selected piecemeal when m, n are estimation, the span of suggestion m and n is [4,32], and the value of m and n can be identical, also can difference, the value of recommendation m, n is all 16; X, y represent the scope of estimation, and the estimation scope in the formula (8) is between [N, N]; S is a judgment threshold, and when x, y were 0, formula (8) also satisfied, and thinks that then the current block in the present frame does not move with respect to reference frame, also is static block.
Yet, the inventor finds, utilizing formula (8) to carry out estimation is based on and carries out under the prerequisite that background luminance do not change, and in the present embodiment, change has taken place in background luminance, if still adopt the method for formula (8) to carry out estimation, because the influence that background luminance changes can't be found the static block in the image exactly.
The inventor finds, when the video camera internal components detects the scene overall brightness and changes, it can adjust gain automatically, therefore the brightness variation of object is a kind of property taken advantage of variation in the scene, according to this conclusion, in the following way, make and under the situation that background luminance changes, still can find static blocks all in the image exactly, with reference to formula (9)-(10):
x,y=-N,-(N-1),...N-1,N (9)
Parameter k represents the ratio of the mean flow rate of sample block in reference frame and present frame that will search for, add this parameter after, even variation has taken place scene brightness, still can find static blocks all in the image exactly.When in fact using following formula (9) to carry out the static block judgement, not be used in the image and search for, that is to say: at x, y all is 0 o'clock, judges directly whether following formula (9) is set up, and just can determine whether current block has been static block.During establishment, be static block; It when being false the nonstatic piece.
Find after the static blocks all in the image, with the sample of these static blocks as the use least square method, utilize (4)-(7) formula can simulate parameter a and parameter b, yet the parameter that obtain this moment might remain inaccurate, because may have some exceptional sample static blocks in the sample static block that uses, their existence can influence the parameter a that match obtains and the accuracy of parameter b.In order to eliminate the influence of exceptional sample static block, must at first weed out these exceptional sample static blocks, the sample static block to remainder carries out linear fit again, so just can obtain the parameter a and the parameter b of linear response function more accurately.
During specific implementation, can carry out according to following steps: at first obtain the straight line expression formula according to all sample static block matches, calculate the distance of all sample static blocks then, can be similar to and think that the size of these distances meets Gaussian Profile to this fitting a straight line.For Gaussian Profile, have (11) formula to set up:
p(|x-μ|≤3σ)≥97.3% (11)
Wherein, μ is the mean value of Gaussian Profile, and σ is a root mean square.The meaning that formula (11) is described is: for Gaussian Profile, the difference of the value of arbitrary sample and the mean value of all samples less than 3 times of root mean square probability more than or equal to 97.3%.Following formula is called the 3 σ criterions (dropping on interval interior probability more than or equal to 97.3%) of Gaussian Profile.That is to say,, otherwise just think that this sample is abnormal data and abandons it if the difference of a certain sample and all sample mean values, just thinks that this sample is reasonable data less than 3 σ.
This criterion of use is rejected the unusual static block sample in the static block samples all in the image that finds earlier, re-use remaining static block sample again match obtain straight line, calculate the distance of sample static block then to this straight line, re-use 3 σ criterion rejecting abnormalities sample static blocks, the sample static block of use remainder match again obtains straight line ... constantly repeat this process, till all sample static blocks all satisfy 3 σ criterions, the luminosity response function that match this moment obtains can be described the brightness situation of change of static block in reference frame and present frame exactly, can be referring to the result who uses matlab (a kind of simulation software) simulation to obtain among Fig. 3 a and Fig. 3 b.
Abscissa among Fig. 3 a and Fig. 3 b is represented the brightness value (this value is the mean value of all pixel intensity in the piece) of static block in the reference frame image, ordinate is represented the brightness value (this value also is the mean value of all pixel intensity in the piece) of static block in the current frame image, and entire curve is described is luminosity response relation between the brightness value of static block in this two two field picture.As can be seen, some is distributed in the static block brightness value before revising around the straight line dispersedly from Fig. 3 a, and from Fig. 3 b as can be seen, through the revised static block brightness value of Gauss's criterion then basically all on straight line.
203, ask for the inverse function of luminosity response function, obtain the luminance compensation function;
Obtained the luminosity response function, we can obtain inverse function, see (12) formula:
y=(x-a)/b (12)
According to inverse function, can obtain the luminance compensation function, see (13) formula:
y′=(y-a)/b (13)
(13) y in the formula represents present frame compensation brightness before, the brightness of y ' expression present frame after overcompensation.
As can be seen, utilizing the resulting luminance compensation function of luminosity response function of above-mentioned linearity also is a linear function.
204, adopt described luminance compensation function, the brightness of present frame is compensated.
Obtain static block brightness behind the luminosity response function of reference frame and present frame, (13) formula that re-uses compensates by pixel current frame image, need to prove at this, also can a pixel compensate stagnant zone in the present frame, and the nonstatic zone is not compensated, can make brightness of present frame background area and the brightness of reference frame background area be consistent substantially, thereby reach the purpose that removal of images background light and shade changes.Through the luminance compensation of (13) formula, the stagnant zone brightness of present frame can keep identical with reference frame in theory.
From this embodiment as can be seen, by choosing a frame in the image that saltus step does not take place the continuous P frame as the reference frame of back video sequence, and obtain the luminance compensation function of present frame with respect to reference frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame, adopt described luminance compensation function, brightness to present frame compensates, thereby realizes the reparation to image brightness.Owing to select for use a frame in the continuous P image that saltus step does not take place in the brightness as the reference frame, and adopt the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame to obtain the luminance compensation function of present frame with respect to reference frame, the brightness of stagnant zone is that strictness is followed the luminance compensation function and made response in the image, having got rid of moving region in the image may be owing to the variation of moving object, block the bigger variation that occurs in the brightness makes image repair the situation of distortion occur, therefore, can obtain the better image quality.
In addition, in the process of asking for the luminance compensation function parameter, the stagnant zone of reference frame and the stagnant zone of present frame are divided into some static blocks, to reduce the influence of picture noise to selected sample, and 3 σ criterion rejecting abnormalities sample static blocks of employing Gaussian Profile, can further improve the accuracy of the luminance compensation function parameter of being asked for, thereby further improve the quality of compensation back image.
With reference to Fig. 4, the method flow diagram of change repairing for video sequence light and shade in the embodiment of the invention three with the example that is applied as in the video conference terminal system, below is elaborated by concrete steps:
401, handle for the current frame image in the continuous videos sequence, at first, judge whether " needing to detect the reference frame sign " is that " very " is (when program initialization, " need to detect the reference frame sign " and be set to " very ", so that can entering initial reference frame, program detects), if be " very ", then execution in step 402; If be " vacation ", then execution in step 405;
402, carrying out reference frame detects;
Can adopt following method to carry out reference frame detects: the average brightness value that calculates each two field picture in the continuous videos sequence; The ratio of average brightness value of determining in the video sequence absolute value of the average brightness value difference of the average brightness value of each two field picture and former frame image in the continuous P two field picture and former frame image is during less than preset threshold value, with a frame of this continuous P two field picture reference frame as the back video sequence;
In concrete the enforcement, can select the reference frame of the last frame of continuous P two field picture as the back video sequence;
The choosing method of reference frame is specially: calculate the average brightness value of each two field picture of input, if when the average brightness value Lave_cur of continued presence P two field picture is satisfied with following formula (14) with respect to the variation of the average brightness value Lave_pre of its former frame image:
|Lave_cur-Lave_pre|/Lave_pre<Q (14)
In top formula (14)-(16), the size of m, n presentation video, the expression size is the image of m * n; (i, j) coordinate is that ((i, j) coordinate is (i, j) brightness value of pixel to Lpre in one two field picture of expression present frame front for i, the j) brightness value of pixel to Lcur in the expression present frame.
The last frame of selecting this continuous P two field picture is as the reference frame.The P value is a positive integer, and the inventor finds that by a large amount of experiments the span of P is controlled between [10,50] better, and the value of suggestion P is 20.Because, can not reflect the stability of image sequence background luminance preferably if the value of P is too small; And the value of P is excessive, and testing process is long again, and the probability that detects less than reference frame becomes bigger.Experiment shows that the Q value is controlled between [0.002,0.010] better, and the value of suggestion Q is 0.005.Because if the value of Q is too small, then detection algorithm changes too sensitivity to image brightness, causes and can't find reference frame; And the value of Q is excessive, and it is too blunt to cause detection algorithm that image brightness is changed again, and detected reference frame is nonconforming.
403, judge whether to detect reference frame, if then execution in step 404; If not, then execution in step 412, and present frame is encoded or export processing such as demonstration, present frame disposes, and when next two field picture arrives, will begin it is handled from step 401 again.
404, storage of reference frames, and will " need detect reference frame sign " be set to " vacation ", execution in step 405 then;
405, carrying out static block detects;
Can take following method to carry out static block detects, present frame and reference frame all are divided into the fritter of m * n size, and interior average brightness value Lave_cur (i) of the piece that calculates each m * n piece in present frame and the reference frame and Lave_ref (i), i={1,2,3, ... M}, M is the number of m * n piece of marking off in present frame/reference frame, wherein m and n are used to represent the size of static block, and the two can be the same or different, and recommended range is: [4,32], suggestion is divided into reference frame and current frame image the fritter of 16 * 16 sizes.
i={1,2,3,...M} (17)
i={1,2,3,...M} (18)
Above in two formulas, Lcur (i, j, k), (i, j k) represent in present frame, the reference frame brightness value of pixel in i m * n piece respectively to Lref.Then, use the following formula of judging to determine whether i the m * n piece in the present frame is static block with respect to reference frame:
In the top formula, i={1,2,3 ... M}, M are the number of m * n piece of marking off in present frame/reference frame; Lcur (i, j, k), (i, j k) represent in present frame, the reference frame brightness value of pixel in i m * n piece respectively to Lref; S is the decision threshold that judges whether to static block, the value size is relevant with selected block size, concern and to be expressed as between itself and the m * n size block: S=A * m * n, A is an adjustment factor herein, value is a positive integer, the value suggestion is between [1,10], and the value of A is to judge that the accuracy of static block was better at 4 o'clock.
By following formula (19), can obtain belonging to the number N of static block between present frame and brightness reference frame, and mark which piece is a static block in M the piece.
406, the static block number that obtains according to detection judges whether video scene changes, if then execution in step 407; If not, execution in step 408 then;
The number N that belongs to static block between present frame and reference frame thinks that video scene changes during less than preset value.
407, will " need to detect the sign of reference frame " and be set to " very ", and execution in step 411;
When video scene changes, need seek reference frame again, existing reference frame cancels, and execution in step 411 is encoded or is exported processing such as demonstration present frame, and present frame disposes.
When carrying out the next frame image processing, program brings into operation from step 401 again, be set to " very " because " need to detect the sign of reference frame ", thus begin to seek new reference frame, and with the compensation target of new reference frame as the subsequent video background luminance.
408, rejecting abnormalities static block;
Can use 3 σ criterions of Gaussian Profile, reject the unusual static block in detected all static blocks in the step 405.For Gaussian Profile, there be p (| x-μ |≤3 σ) 〉=97.3% ((11) formula of front, this formula are called 3 σ criterions of Gaussian Profile) to set up, wherein, μ is the mean value of Gaussian Profile, σ is a root mean square.
(11) the described meaning of formula is: for Gaussian Profile, the difference of the value of arbitrary sampled point and the mean value of whole sampled point less than 3 times of root mean square probability greater than 97.3%; That is to say,, otherwise just think that these data are abnormal datas and abandon it if the difference of sampled value and sample mean, just thinks that these data are reasonable data less than 3 σ.In the processing procedure of rejecting static block, can be understood as: when the difference between the average change value of the variation of static block brightness value and all static block brightness values during less than 3 times root mean square, think that then this static block is rational static block, otherwise just think that this static block is unusual static block, rejects it from the set of static block.The specific implementation process prescription is as follows:
At first, calculate the average value mu of all static block brightness variation ratios among the static block set N, its computing formula is as follows:
i={1,2,3,...N}(20)
In the following formula, N is the number of all static blocks, and the computational methods of Lave_cur (i) and Lave_ref (i) are seen before shown in the formula (17), (18) of face, represent average brightness value in the piece of i static block in present frame and reference frame.
Secondly, calculate the root mean square σ that all static block brightness change ratio, its computational methods are shown below:
i={1,2,3,...N}(21)
In the following formula, μ is the mean value that all static block brightness change ratio, and computational methods are seen formula (20); Identical in the meaning of N, Lave_cur (i) and Lave_ref (i) and (20).
At last, the formula below using is rejected unusual static block among the static block set N, when the brightness of static block changes the discontented foot of ratio formula, regards it as unusual static block, and it is rejected from the static block set.
|(Lave_cur(i)/Lave_ref(i))-μ|≤3σ (22)
All use following formula (22) to judge to all static blocks, the static block that satisfies following formula keeps, and does not satisfy the static block of following formula and rejects it, to obtain new static block set M1.
Constantly repeat top processing procedure, all static blocks in certain static block set all satisfy formula (22) simultaneously, have so just obtained final static block set Nn.
409, the parameter in the calculating penalty function;
A large amount of video sequence that the inventor passes through carries out test analysis, find that the luminosity response approximation to function is linear function: a y=a+b * x (shown in a front formula (3)), its corresponding inverse function is: y=(x-a)/b (shown in front formula (12)), then obtain luminance compensation function: y '=(y-a)/b (shown in front formula (13)), it also is straight line, therefore can adopt least square method to carry out linear fit, obtain parameter a and b among luminance compensation function y '=(y-a)/b (shown in front formula (13)).Brightness match according to all static blocks earlier obtains the straight line expression formula, calculates the distance of the brightness value of all static blocks to this fitting a straight line then, can be similar to and think that the size of these distances meets Gaussian Profile.Use 3 σ criterion rejecting abnormalities static blocks of Gaussian Profile, the brightness value that reuses remaining static block match again obtains straight line ... constantly repeat said process, till the brightness value of all static blocks all satisfies 3 σ criterions, the specific implementation process is as follows:
At first, calculate the mean value y and the x of all static blocks in present frame and the reference frame (these static blocks belong to static block set Nn) brightness, computing formula is as follows:
i={1,2,3,...N} (23)
i={1,2,3,...N} (24)
Above in two formulas, N is the number of all static blocks among the static block set Nn, Lave cur (i) and Lave_ref (i) represent average brightness value in the piece of static block in present frame and reference frame;
Secondly, obtain luminance compensation function parameters a and b by least square fitting, its computing formula is as follows:
a=y-b×x (26)
So, luminance compensation function y '=(y-a)/b can develop and be:
by′-y+a=0 (27)
Y is the input of function in the formula, and y ' is the output of function, and the luminance compensation function representation is a straight line on the plane.A bit (x on the plane
0, y
0) can be expressed as to the distance of this straight line:
Once more, respectively with average brightness value Lave_cur (i) in the piece of each static block in present frame and in reference frame average reference value Lave_ref (i) in the piece, input and output (Lave_cur (i) as formula (27), Lave_ref (i), utilize formula (28) to calculate each static block brightness value point (Lave_cur (i), Lave_ref (i)) with respect to the distance D (i) between the straight line of luminance compensation function place.Simultaneously, calculate all static blocks to luminance compensation function place rectilineal interval from mean value D μ:
Then, calculate these static blocks to luminance compensation function place rectilineal interval from root mean square D σ:
At last, use 3 σ criterions (can be similar to and think that the size of these distances is the to meet Gaussian Profile) rejecting of Gaussian Profile not satisfy the static block of Gaussian Profile 3 σ criterions, when static block arrives luminance compensation function place rectilineal interval when being discontented with the foot formula, regard it as unusual static block, it is rejected from the static block set.
|D(i)-Dμ|≤3×Dσ (31)
Re-use remaining static block and repeat said process, till the brightness value of all static blocks all satisfies 3 σ criterions of Gaussian Profile in certain static block set.At this moment, parameter a that tries to achieve and b are final luminance compensation function parameters.
In asking for the penalty function process, by rejecting abnormalities sample static block, can guarantee the accuracy of luminance compensation function as much as possible, improve picture quality.
410, image is compensated reparation;
The luminance compensation function parameters a and the b that calculate according to step 409, use formula y '=(y-a)/b (shown in front formula (13)) that the brightness value of all pixels in the present frame is compensated, also can compensate by a brightness value the pixel partly of the stagnant zone in the present frame, y in the formula (13) represents the brightness of certain pixel before the present frame compensation, the brightness of certain pixel of y ' expression present frame after overcompensation.
After present frame repaired, present frame disposed, can execution in step 411 further present frame is handled, when next two field picture arrives, will handle it since 401 places again.
411, image being carried out compressed encoding, storage or output shows.
After before image being repaired, can carry out compressed encoding or output demonstration to image.And, because after repairing, picture quality is improved, and therefore, when image is encoded, can save code stream, reduce code check, improve compression ratio.In addition, (YCbCr is a kind of digital video image data format to the form of the vision signal that first-class capture device is imported if make a video recording with carrying out the needed YCbCr of image repair, by defined in the CCIR601 standard of ITU-T formulation, the luminance component data of Y presentation video wherein, two chromatic component data of Cb, Cr presentation video) when form is inconsistent, can be in advance row format conversion of image repair.If when the form of the vision signal of image repair output and video display format are inconsistent, can after aforementioned several video repair actions, carry out video format conversion, to support the needed display type of display.
As seen, by detecting and choose effective reference frame, and after the pairing luminance compensation function parameters of the luminosity response function of asking for a linearity, utilize this luminance compensation function to carry out luminance compensation, thereby image is repaired, owing to select for use a frame in the continuous P two field picture that saltus step does not take place in the brightness as the reference frame, obtain the luminance compensation function of present frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame with respect to reference frame, the brightness of stagnant zone is that strictness is followed the luminance compensation function and made response, having got rid of the moving region may be because the variation of moving object, block and the bigger variation in the brightness occurs and make image repair the situation of distortion occur, therefore, adopt this luminance compensation function that the brightness of image is compensated, can repair picture quality well and can obtain the better image quality.
In addition, in the process of asking for the luminosity response function, the stagnant zone of reference frame and the stagnant zone of present frame are divided into some static blocks, can reduce the influence of picture noise to selected sample, and adopt 3 σ criterions of Gaussian Profile asking for luminance compensation function parameter front and back rejecting abnormalities sample static block, can further improve the accuracy of the luminance compensation function parameter of being asked for, further improve picture quality.
Be understandable that, the algorithm of mentioning in the present specification of asking for the penalty function parameter is the statistics approximate algorithm, therefore, as long as the sample static block that has some can be asked for the parameter of penalty function by least square method, so, the strategy of asking for the sample static block will be very flexible, all sample static blocks in the image all can be found out, also can only from image, ask for the sample static block in certain part, as long as the quantity of static block reaches some, on the other hand, the sample static block of asking for is many more, and the parameter of the penalty function of asking for by least square method will be accurate more.Simultaneously, as previously mentioned, the size of static block also can be selected.
More than the method for the image repair in the embodiment of the invention is described in detail, for those skilled in the art being understood better and realize the embodiment of the invention, below employed video processing equipment in the embodiment of the invention is described accordingly:
With reference to Fig. 5, be video processing equipment structural representation in the embodiment of the invention four, this video processing equipment comprises: reference frame is chosen unit 501, luminance compensation function acquiring unit 502, luminance compensation unit 503, wherein:
Reference frame is chosen unit 501, is used for a frame in saltus step in the brightness does not take place the selecting video sequence the continuous P two field picture as the reference frame of back video sequence;
Luminance compensation function acquiring unit 502 is used for obtaining the luminance compensation function of present frame with respect to reference frame according to the stagnant zone brightness of described reference frame and the stagnant zone brightness of present frame;
Luminance compensation unit 503 is used to the luminance compensation function that adopts luminance compensation function acquiring unit 503 to be obtained, and the brightness of present frame is compensated.
As can be seen, this video processing equipment is chosen the continuous P two field picture that saltus step in the brightness does not take place in the unit 502 selecting video sequences by reference frame, and from described continuous P two field picture, choose the reference frame of a frame as the back video sequence, obtain the luminance compensation function of present frame by luminance compensation function acquiring unit 502 according to the stagnant zone brightness of described reference frame and the stagnant zone brightness of present frame then with respect to reference frame, and the luminance compensation function that adopts luminance compensation function acquiring units 502 to be obtained by luminance compensation unit 503, present frame is carried out luminance compensation, thereby realize reparation image brightness.Owing to select for use a frame in the continuous P image that saltus step does not take place in the brightness as the reference frame, and the stagnant zone brightness of employing reference frame and the stagnant zone brightness of present frame obtain the luminance compensation function with respect to reference frame of present frame, the brightness of stagnant zone is that strictness is followed the luminance compensation function and made response in the image, having got rid of moving region in the image may be owing to the variation of moving object, block the bigger variation that occurs in the brightness makes image repair the situation of distortion occur, therefore, can obtain the better image quality.
In concrete enforcement, reference frame is chosen last frame in the continuous P two field picture that saltus step in the brightness does not take place in can the selecting video sequence in unit 501 as the reference frame of back video sequence.
Below further describe the present invention by several preferred embodiments and the video sequence light and shade changed the video processing equipment repair:
With reference to Fig. 6, be video processing equipment structural representation in the embodiment of the invention five, the reference frame described in the video processing equipment of embodiment four is chosen unit 501 and is comprised:
Frame brightness calculation subelement 601 is used for calculating the absolute value of average brightness value difference of the former frame image of the average brightness value of each two field picture in the video sequence continuous P two field picture and described each two field picture;
Reference frame is chosen subelement, whether the ratio of average brightness value of former frame image that is used for determining described absolute value and described each two field picture is less than preset threshold value, when less than preset threshold value, determine that the saltus step in the brightness does not take place for continuous P two field picture in the video sequence, and choose in the described video sequence frame in the continuous P two field picture as the reference frame of back video sequence.
With reference to Fig. 7, be video processing equipment structural representation in the embodiment of the invention six, the luminance compensation function acquiring unit 502 described in the video processing equipment of embodiment four can comprise:
The luminosity response function obtains subelement 701, is used for obtaining the luminosity response function of present frame with respect to reference frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame;
Luminance compensation function calculation subelement 702 is used to ask for the inverse function of the resulting luminosity response function of described luminosity response function acquiring unit, obtains the luminance compensation function.
Concrete, the luminosity response function that brightness benefit response function acquiring unit 701 is obtained is specifically as follows a linear function, and in order to reduce the influence of picture noise, described luminosity response function acquiring unit can obtain the brightness value of the sample static block that sampling obtains in reference frame and the present frame, and described luminosity response function obtains subelement 701 and specifically can comprise:
Luminosity response function parameter acquisition module, the mean value that is used for the brightness value of all sample static blocks in the brightness value of all sample static blocks in the mean value, present frame of the brightness value of all sample static blocks in the brightness value, reference frame according to all sample static blocks of reference frame and the present frame, adopt least square method, obtain the parameter of described linear function.
Be understandable that the embodiment in the present embodiment also is applicable to embodiment six described video processing equipments.
With reference to Fig. 8, be video processing equipment structural representation in the embodiment of the invention seven, describe to expand to example on embodiment four bases, this video processing equipment also can comprise compressed encoding unit 801, is used for the image that carries out behind the luminance compensation is carried out compressed encoding.
Because after this video processing equipment adopts the resulting luminance compensation function of stagnant zone brightness according to the stagnant zone brightness of reference frame and present frame to compensate, increased the correlation between the adjacent video frames, because this correlation strengthens, therefore, this video processing equipment is when carrying out compressed encoding, can save code stream, reduce code check, improve compression ratio.
Be understandable that above-mentioned expansion also is applicable to embodiment four or embodiment five described video processing equipments, illustrates no longer one by one.And, the above described video processing equipment of each embodiment of the present invention can be used for multiple systems or integrate with other video-unit, for example, this video processing equipment specifically can be a video camera, thereby contain and above-mentionedly the video image light and shade is changed the video camera carry out repair function the video image of taking can be carried out light and shade and change to repair to the user video image with better quality is provided, also can be used for the video conference terminal system, this video conference terminal system also comprises the device such as the camera that are used for capturing video, a device such as a display that is used to export display video, wherein, camera is finished the seizure of video, generate vision signal, the video processing equipment that the present invention introduced can receive the vision signal that camera head is imported, and the light and shade of image changed repair, certainly, simultaneously can also remove noise, processing such as zoomed image and overlapping text, after generating the output video sequence number, can output to display unit shows, certainly, also can temporarily store or carry out compressed encoding, because the video processing equipment that the present invention introduced can make the image light and shade change and well be repaired, improved the correlation between the adjacent video frames, when carrying out compressed encoding, can save code stream, reduce code check, improve compression ratio, and then can save memory space.
And different if the video format that camera head is exported and video processing equipment are imported needed video format, above-mentioned video processing equipment can be changed video format before image change repairs carrying out.
Be understandable that the video processing equipment of being introduced in the embodiment of the invention also can be realized with digital processing chip independently.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in a kind of computer-readable recording medium, this program comprises the steps: when carrying out
Frame in the continuous P two field picture of saltus step in the brightness does not take place in the selecting video sequence as the reference frame of back video sequence;
Obtain the luminance compensation function of present frame according to the stagnant zone brightness of reference frame and the stagnant zone brightness of present frame with respect to reference frame;
Adopt described luminance compensation function, the brightness of present frame is compensated.
The above-mentioned storage medium of mentioning can be a read-only memory, disk or CD etc.
More than a kind of video sequence light and shade provided by the present invention changed method and the video processing equipment repaired be described in detail, for one of ordinary skill in the art, thought according to the embodiment of the invention, part in specific embodiments and applications all can change, in sum, this description should not be construed as limitation of the present invention.