Background technology
Image is easily subject to external interference and produces some impulsive noises in formation, transmission, reception and processing procedure, thereby in image, produces the point of black, white, is called salt-pepper noise.The effect that salt-pepper noise can further affect rim detection, image is cut apart applies with the later image such as feature extraction.Therefore, improving signal to noise ratio is one of vital task of image processing.
At present, the method for image denoising is mainly divided into airspace filter, time-domain filtering and space-time in conjunction with filtering three classes.The normal employing of airspace filter is weighted average mode filtering to neighbor pixel, so airspace filter removal noise effects is poor and can sacrifice image high frequency detail section, makes image produce distortion.Time-domain filtering, owing to having considered video image correlation in time, adopts IIR filtering algorithm, carries out inter frame image weighting processing, and image sequence is more similar, and correlation is stronger, and denoising effect is better.But for moving image, moving target can produce the time domain bloomings such as artifact.Space-time adopts stationary part in video image is carried out to time-domain filtering in conjunction with filtering, and motion parts image is carried out to airspace filter, and this has just solved effectively, and airspace filter removal noise is poor can produce the time domain fuzzy problems such as artifact with time-domain filtering moving target.But how to judge image static in video image and motion, this problem has to be solved.
Existing method adopts prediction threshold method to judge conventionally, and when interframe block of pixels difference is greater than this threshold value, this area pixel is moving mass, and this piece is carried out to airspace filter.When being less than this threshold value, judge that this area pixel is static block, carries out time-domain filtering to this piece.But there are the following problems for existing mode: one, in image freeze region, when noise is larger, interframe block of pixels difference is still larger, this piece will be mistaken for to moving mass and carry out airspace filter.Two, in video image motion region, larger if threshold value is selected, this piece is judged as to static block and carries out time-domain filtering, thereby make image time domain fuzzy.
Summary of the invention
For the problems referred to above, the invention discloses a kind of dynamically adjust threshold value in Denoising Algorithm by mean square deviation method, the method can effectively address the above problem.
In order to reach above-mentioned technique effect, the present invention adopts following technical scheme: in a kind of Denoising Algorithm, by mean square deviation, dynamically adjust the method for threshold value, the method comprises the steps:
A. the raw video signal of input is divided into the frame of video of serial, with the Kuai Wei unit of 8x8 size, processes, judge whether this frame of video is denoising start frame, does not if it is process, former state output; If not, enter next step;
B. to current pending, carry out IIR filtering, obtain piece PBx.y (t), IIR Filtering Formula is:
.
Wherein, filter factor b1=0.85, a1=0.15, PBx.y (t-1) is filtered of same position in former frame, CB x.y (t) is current pending;
C. piece PBx.y (t) after current pending CBx.y (t) and filtering is carried out to difference, obtain MAD, thereby obtain mean square deviation
, formula is:
D.: by present frame threshold value and
compare and judge, being greater than
current block is moving mass, is less than
current block is static block, and first processed frame is first set to an initial threshold, and follow-up this threshold value dynamically updates, and judges whether present frame finishes, and if not, returns to step b, if so, enters next step;
E. travel through a two field picture, obtain the attribute list Tc of each piece in a two field picture, and then these piece attribute lists Tc is carried out to the filtering of morphology opening operation, remove isolated attribute block, again obtain piece attribute list Tp in present frame,
Wherein B represents to carry out the structural element of opening operation, adopts the cross template of 3x3;
F. by the T that tables look-up
p, moving mass is carried out to airspace filter, static block is carried out to IIR filtering, airspace filter adopts non-linear filtering, and the value of certain pixel in digital image sequence is replaced with the Mesophyticum of the value of each point in this vertex neighborhood, and medium filtering is defined as follows:
If the neighborhood territory pixel of object pixel is
, the large minispread according to value of n number is as follows:
After filtering, the value of object pixel is:
Interframe IIR filtering implementation is as follows:
PB
t(i,j)?=?0.8*PB
t-1?(i,j)?+?0.2*CB
?t(i,j);
G. calculate present frame MAD value variance, variance computational methods are as follows:
H. predict next frame threshold value, dynamic noise in actual video frame, mostly is white noise, and obeying average is 0, and variance is
gaussian Profile, be located at the appearance of not moving of certain hour scope, the difference between image is mainly caused have by noise:
In formula
representing the value of scene, because of without motion, is definite value, and n (t) represents noise, is changing value, and obeying average is 0, and variance is
gaussian Profile, inter-frame difference image is defined as:
Suppose to exist without motion, calculate difference image and face mutually the probability that 3 pieces are all greater than threshold value TH or are all less than threshold value TH,
Facing mutually the probability that 3 pieces are greater than threshold value is:
Suppose
be 5, when TH gets 1 times
time, calculating probability is 0.004, when getting TH, is 2 times
time, calculating probability is 1.178x
, this is a minimum probability event, in like manner, gets one and is a bit larger tham variance
threshold value, be also a minimum probability event, consider the feature of actual video sequence, this algorithm is got threshold value
;
I. return to step b, by the sequence of steps of b, c, d, e, f, g, h, circulate, traversal frame of video, obtains the sequence of frames of video after denoising.
In described steps d, Initial Hurdle is 4.
Beneficial effect of the present invention is: by calculating the mean square deviation of inter frame image absolute error average (MAD)
, with mean square deviation
characterize current video sequence motion state and calculate next frame threshold value.Make in to every frame video image denoising, in spatial domain, segmented moving mass and static block is processed respectively.Meanwhile, time-domain, with the mean square deviation of frame of video interframe MAD
calculate thresholding, dynamically analyzed the motion conditions of video sequence, make the calculating of thresholding more accurate.
Embodiment
Below in conjunction with flow chart, the present invention is described in more detail.
A. the raw video signal of input is divided into the frame of video of serial, with the Kuai Wei unit of 8x8 size, processes, judge whether this frame of video is denoising start frame, does not if it is process, former state output; If not, enter next step;
B. to current pending, carry out IIR filtering, obtain piece PBx.y (t), IIR Filtering Formula is:
Wherein, filter factor b1=0.85, a1=0.15, PBx.y (t-1) is filtered of same position in former frame, CB x.y (t) is current pending;
C. piece PBx.y (t) after current pending CBx.y (t) and filtering is carried out to difference, obtain MAD, thereby obtain mean square deviation
, formula is:
D.: by present frame threshold value and
compare and judge, being greater than
current block is moving mass, is less than
current block is static block, and first processed frame is first set to an initial threshold, and follow-up this threshold value dynamically updates, and judges whether present frame finishes, and if not, returns to step b, if so, enters next step;
E. travel through a two field picture, obtain the attribute list Tc of each piece in a two field picture, and then these piece attribute lists Tc is carried out to the filtering of morphology opening operation, remove isolated attribute block, again obtain piece attribute list Tp in present frame,
Wherein B represents to carry out the structural element of opening operation, adopts the cross template of 3x3;
F. by the T that tables look-up
p, moving mass is carried out to airspace filter, static block is carried out to IIR filtering, airspace filter adopts non-linear filtering, and the value of certain pixel in digital image sequence is replaced with the Mesophyticum of the value of each point in this vertex neighborhood, and medium filtering is defined as follows:
If the neighborhood territory pixel of object pixel is
, the large minispread according to value of n number is as follows:
After filtering, the value of object pixel is:
Interframe IIR filtering implementation is as follows:
PB
t(i,j)?=?0.8*PB
t-1?(i,j)?+?0.2*CB
?t(i,j);
G. calculate present frame MAD value variance, variance computational methods are as follows:
?;
H. predict next frame threshold value, dynamic noise in actual video frame, mostly is white noise, and obeying average is 0, and variance is
gaussian Profile, be located at certain hour scope, i.e. the adjacent two frames appearance of not moving, the difference between image is mainly caused have by noise:
In formula
representing the value of scene, because of without motion, is definite value, and n (t) represents noise, is changing value, and obeying average is 0, and variance is
gaussian Profile, inter-frame difference image is defined as:
Suppose to exist without motion, calculate difference image and face mutually the probability that 3 pieces are all greater than threshold value TH or are all less than threshold value TH,
Facing mutually the probability that 3 pieces are greater than threshold value is:
Suppose
be 5, when TH gets 1 times
time, calculating probability is 0.004, when getting TH, is 2 times
time, calculating probability is 1.178x
, this is a minimum probability event, in like manner, gets one and is a bit larger tham variance
threshold value, be also a minimum probability event, consider the feature of actual video sequence, this algorithm is got threshold value
;
I. return to step b, by the sequence of steps of b, c, d, e, f, g, h, circulate, traversal frame of video, obtains the sequence of frames of video after denoising.