Summary of the invention
The objective of the invention is to overcome deficiency of the prior art; a kind of method of removing mosquito noise with rim detection, motion detection and medium filtering is provided; make it adopt the frame inward flange to detect and the adaptive method detection of interframe movement mosquito noise; and it is carried out medium filtering; protect the details composition in the image effectively, thereby improved whole treatment effect.
The present invention is achieved by the following technical solutions, the present invention includes two big aspects, promptly earlier image is carried out handling in the frame, handle carrying out interframe then through the three continuous two field pictures of handling in the frame, described image is carried out handling in the frame, be specially: use the Laplace operator that image is carried out rim detection earlier, obtain the marginal information of each pixel, if a certain pixel is in edge pixel or four pixels around it plural edge pixel to be arranged, it is constant to keep its value; Otherwise, this pixel is carried out Filtering Processing with a median filter.Described to carry out the interframe processing through the three continuous two field pictures of handling in the frame, be specially: at first carry out motion detection, according to the difference between the consecutive frame, judge whether the pixel in the present frame moves, if this pixel is the motion pixel, it is constant then to keep its value; If be non-motor image element, then the corresponding points in three frames are carried out the filtering result of the result of medium filtering as this pixel.
Mosquito noise is the noise on a kind of time domain, and mosquito noise of the present invention is defined as follows: mosquito noise is the fluctuation flicker in the intersection brightness of moving object and background and colourity.From the image of single frames, mosquito noise shows as on the fuzzy or background at object edge place some near the speckle on object edges; From the image of motion, mosquito noise shows as near irregular fluctuation object edge.The generation of mosquito noise mainly is because during interframe encode, and frame has adopted different quantization steps with coded prediction error between the frame, and in a frame sequence, the coding of same object may be different like this, thus the fluctuation that has produced brightness or chromatic value.Generally we call mosquito noise to this fluctuation of edge, and the Processing Algorithm of various mosquito noises also is to carry out at this fluctuation of edge.
Below the inventive method is further described, particular content is as follows:
1, use the Laplace operator to carry out rim detection
Edge of image can be defined as the discontinuity of image local characteristic, for example: the sudden change of brightness, the sudden change of color, the sudden change of texture structure etc.In general the edge in the image is the border that has between two zones of different average gray grades.Thereby the first derivative amplitude of the gray scale at place, image border can be bigger.Most of edge detecting technology are used the gradient operator of certain form.Rim detection of the present invention is that the second differnce with pixel grey scale serves as to detect foundation.
What the present invention adopted is the Laplace operator, the Laplace operator
Be a second-order differential operator, in digital picture, can be similar to difference
Δ
2f
t(m,n)=f
t(m+1,n)+f
t(m-1,n)+f
t(m,n+1)+f
t(m,n-1)-4f
t(m,n) (1)
F wherein
t(m n) is in the gray scale of the pixel of the capable n row of m, f in the expression t two field picture
t(m+1, n), f
t(m-1, n), f
t(m, n+1) and f
t(m n-1) represents respectively in the same frame and pixel (m, the n) gray scale of four pixels that cross is adjacent, Δ
2f
t(m, n) the above pixel of expression is through the result of Laplace operator computing.
For the better effects if of rim detection, can carry out some corrections to the Laplace operator, as shown in Equation (2).
Δ
2f
t(m,n)=|f
t(m+1,n)-f
t(m,n)|+|f
t(m-1,n)-f
t(m,n)|+|f
t(m,n+1)-f
t(m,n)|+|f
t(m,n-1)-f
t(m,n)|
(2)
Rim detection can be described below: (m n) loads the Laplace operator, obtains its second order gradient delta to the pixel of t frame in the former sequence to adopt formula (2)
2f
t(m, n); If (m, n) than rim detection thresholding height, then (m n) is edge pixel, otherwise is not edge pixel.The thresholding of rim detection is that self adaptation determines that the computational methods of rim detection thresholding as shown in Equation (3).
Wherein (2N+1) is the size of rim detection thresholding calculation window, and (m n) is pixel (m, rim detection thresholding n) to edg_threshold.If Δ
2f
t(m, n)>edg_threshold (m, n), then (m n) is edge pixel, its marginal information edge (m, n)=1, otherwise edge (m, n)=0.
2, filtering in the frame
Pattern with filtering in the marginal information decision frame.Filtering is divided into two patterns in the frame: medium filtering pattern and retained-mode.At first calculate pixel (m, the n) number of cross window inward flange pixel on every side, as shown in Equation (4).Again by formula (5) (m n) carries out filtering in the frame to pixel.If edg (m, n)=1 or edge_sum (m n)>2, then keeps its value and does not process; Other situation then uses median filter that it is carried out filtering.
edge_sum(m,n)=edge(m,n)+edge(m-1,n)+edge(m+1,n)+edge(m,n-1)+edge(m,n+1) (4)
Wherein median represents the several variablees in the bracket are got the computing of intermediate value,
(m, gray scale n) is carried out the result of filtering in the frame to pixel in expression.
3, motion detection
Motion detection is made up of two parts, is specially frame difference and calculates and motion determination.
The pixel grey scale that is used for the three continuous two field pictures of motion detection is used respectively
With
Expression, wherein
The gray scale of the pixel of the capable n row of m in the expression present frame,
Represent to be ahead of in time (m, the n) gray scale of the pixel in a frame period,
Expression lags behind in time
The gray scale of the pixel in a frame period, they all are the results of filtering in the frame.Pixel (m in the present frame, n) pixel grey scale in the neighborhood around gray scale and its compares with the pixel grey scale of front and back frame correspondence respectively, and with the summation of the absolute value of corresponding points difference, obtain difference prediff (m respectively, n) and postdiff (m, n), shown in formula (6) and (7).If these two differences have one or two all greater than thresholding, then judge (m n) is the motion pixel, movable information motion (m n)=1, otherwise is non-motion pixel, and motion (m, n)=0.Being calculated as follows of frame difference, (m, n), its gray scale is used for the pixel in the present frame
Expression uses following two formula to obtain two differences
Wherein the window size that calculates of frame difference is 2M+1, prediff (m, n) and postdiff (m n) is respectively the difference of present frame and former frame, and the present frame and the back difference of a frame.Two differences of formula (6) and (7) compare with thresholding respectively, and thresholding is according to the pixel in the present frame (m, gray scale n)
Determine, as shown in Equation (8).(m, calculating n) as shown in Equation (9) for movable information motion.
Wherein (m, n) expression is to current frame pixel (m, n) the motion detection thresholding of She Dinging for mov_threshold.
Frame difference is then judged pixel greater than the detection threshold of setting
Move, promptly its movable information motion (m, n)=1, otherwise motion (m, n)=0.
4, frame filter
Result according to motion detection determines the mode that interframe is handled, and promptly determines the filtering mode to pixel in the present frame.If (m n) is the motion pixel, promptly motion (m, n)=1, the result who handles in this retention frame so; Otherwise do the medium filtering on the time domain, promptly replace the pixel value of current point with the result of three pixel value medium filterings of front and back frame and present frame same point.Promptly
F wherein
t *(m, n) expression is carried out the result of frame filter to the t frame,
Expression is to pixel (m, n) carry out the result of filtering in the frame, median represents the several variablees in the bracket are got the computing of intermediate value, motion (m, n) in t frame of expression through processing in the frame, the motion state of the capable n row of m pixel, motion (m, n)=1 the expression this pixel be the motion pixel, otherwise till pixel.
The mosquito noise noise-reduction method that the present invention relates to; the protection to the image border details has been considered in the processing section in its frame; the protection to motion parts has been considered in the interframe processing section; when effectively removing mosquito noise; the details and the definition of image have been protected to greatest extent; reduce the level that only adopts in the prior art in the frame and vertical filtering to the loss that the details and the motion composition of image causes, improved the visual quality of output image.
Embodiment
Provide following examples in conjunction with content of the present invention:
As shown in the figure, Fig. 1 is the mosquito noise noise reduction algorithm schematic diagram that the present invention relates to.Noise reduction process is as follows:
(1) frame delay unit I and II: frame delay unit I is with video signal delay one frame of input, frame delay unit II is output as input with frame delay unit I, and it is postponed a frame, if promptly Shu Ru vision signal is (t+1) two field picture, the output of frame delay unit I is (t) two field picture, and the output of frame delay unit II is (t-1) two field picture.
(2) edge detection unit I, II, III: adopt the Laplace operator, respectively (t+1) two field picture, t two field picture and (t-1) two field picture of input are carried out rim detection according to formula (2), and by formula (3) calculate each rim detection thresholding, determine the marginal information of each pixel in (t+1) two field picture, t two field picture and (t-1) two field picture.
(3) filter unit I, II, III in the frame: according to the marginal information of each pixel in (t+1) two field picture, t two field picture and (t-1) two field picture, frame interior filter unit I, II, III by formula (4) and (5) carry out Filtering Processing in the frame to each pixel in (t+1) two field picture, t two field picture and (t-1) two field picture, obtain filtering result in the frame
With
(4) motion detection block: adopt formula (6) and (7) to calculate respectively
With
Difference prediff (m, n),
With
Difference postdiff (m n), and adopts formula (8) to calculate the motion detection thresholding, and by formula (9) are determined
In pixel movable information motion (m, n).(5) frame filter unit: right according to formula (10)
Carry out frame filter, obtain final mosquito noise noise reduction result as video output signals.
Concrete implementation content is as follows:
At first according to the result through the Laplace operator of each pixel in formula (2) calculating input image, and calculate the thresholding that each pixel edge detects according to formula (3), in an embodiment, the thresholding calculation window of selected rim detection is 3 * 3 windows, i.e. N=1 in the formula (3).Extract the edge of input picture as mentioned above, determine the marginal information of each pixel.According to formula (5) input picture is carried out filtering in the frame, obtain the result of filtering in the frame.The calculation window of selected frame differences is 3 * 3 windows, i.e. M=1 in formula (6) and (7).Adopt formula (6) and (7) to calculate the difference between the filtering result in the frame of three continuous frame input pictures,, and finish frame filter, obtain output image according to formula (9) and (10) according to the thresholding of formula (8) calculating motion detection.
The present invention adopts above algorithm that 10 frames are handled through the Phase Alternation Line system image sequence of MPEG2 compression.Decoded video sequence is the 4:2:0 form, luminance signal and carrier chrominance signal separate processes, last combined color image.Before carrying out the mosquito noise noise reduction, the signal to noise ratio of MPEG2 decoded picture is 31.181, and behind the noise reduction, signal to noise ratio is 31.523.Near the noise reduction back edge scintillation has obtained effective inhibition, and the details composition in the image is not affected.