Embodiments pertain to systems and devices for, and methods of, motion-compensated temporal filtering based on variable filter parameters.
In video coding data, compression may be achieved by removing temporal and/or spatial redundancies. Video coding may use prediction and/or block-based motion compensation to reconstruct an approximation of the video data with minimal bits. Prediction-based compensation may use data in the current frame or in one or more previous and/or neighboring frames.
Embodiments include systems and devices for, and methods of, motion-compensated temporal filtering based on variable filter parameters. For example, a method embodiment includes (a) determining, by a processor having memory, a pixel-related residue image based on a set of differences between a current pixel intensity of a current frame and a corresponding pixel intensity of a previous frame, wherein the corresponding pixel intensity is augmented by a motion-compensated vector of the previous frame; (b) determining an intensity weight based on the determined pixel-related residue image and a temporal filtering parameter; and (c) filtering the pixel intensity of the current frame based on the determined intensity weight and the motion compensated vector of the previous frame. Optionally, the temporal filtering parameter may be based on the determined set of residue images. Further, the temporal filtering parameter may be based on a histogrammed set of square-rooted determined pixel-related residue images. The histogrammed set of square-rooted determined pixel-related residue images may also be based on a mode of the histogrammed set of square-rooted determined pixel-related residue images. In some embodiments the histogrammed set of square-rooted determined pixel-related residue images may be further based on a portion, e.g., a one-sided tail portion, of the histogrammed set of square-rooted determined pixel-related residue images.
Embodiments include motion-compensated temporal filtering where the filtering parameter is a spatial statistical representation of at least one of: intensity and the motion vector. Optionally, the filtering parameter may be based on a variance of image intensity within a region about the current pixel. In another embodiment the filtering parameter may be based on a variance of at least one directional component of a motion vector within a region associated with the current pixel. Optionally, the filtering parameter may be based on a variance of the current pixel intensity of the current frame and a variance of the motion vector within a region associated with the current pixel.
Another exemplary method embodiment of a motion-compensated temporal filtering may include the steps of: (a) determining, by a processor having memory, a pixel-related residue image based on a set of differences between a current pixel intensity of a current frame and a corresponding pixel intensity of a previous frame, wherein the corresponding pixel intensity is augmented by a motion-compensated vector of the previous frame; (b) determining a set of intensity weights based on the determined pixel-related residue image and a temporal filtering parameter; (c) determining a set of spatial weights based on a set of neighboring pixels; and (d) filtering the pixel intensity of the current frame based on the set of determined intensity weight, the set of determined spatial weight, and the motion compensated vector of the previous frame. Optionally, the set of spatial weights may be further based on a spatial candidate set comprising a plurality of motion compensated vectors of the previous frame. The spatial candidate set may be further based on a set of neighboring pixels where the weight is attenuated distal from the pixel around which the intensity vector is being determined.
Some embodiments pertain to devices for motion-compensated temporal filtering, for example, the device embodiment may comprise: a processor and addressable memory, wherein the processor is configured to: (a) determine a pixel-related residue image based on a set of differences between a current pixel intensity of a current frame and a corresponding pixel intensity of a previous frame, the corresponding pixel intensity augmented by a motion-compensated vector of the previous frame; and (b) determine an intensity weight based on the determined pixel-related residue image and a temporal filtering parameter; and (c) filter the pixel intensity of the current frame based on the determined intensity weight and the motion compensated vector of the previous frame. In some embodiments, the processor may be further configured to determine a set of spatial weights based on a set of neighboring pixels.
Some embodiments may include a computer-readable non-transitory medium having computer-executable instructions stored thereon which, when executed by a computer, configure the computer to: (a) determine a pixel-related residue image based on a set of differences between a current pixel intensity of a current frame and a corresponding pixel intensity of a previous frame, the corresponding pixel intensity augmented by a motion-compensated vector of the previous frame; (b) determine an intensity weight based on the determined pixel-related residue image and a temporal filtering parameter; and (c) filter the pixel intensity of the current frame based on the determined intensity weight and the motion compensated vector of the previous frame.
Embodiments are illustrated by way of example, and not limitation, in the figures of the accompanying drawings, and in which:
Disclosed are systems and devices for, and methods of, temporal filtering of pixels, or subpixels, of frames based on frame-to-frame pixel residues.
In some embodiments, the temporal filtering parameter 241, σt, may be revised or updated concurrently with image processing and pixel filtering where, for example, the image residue 231, D, may be passed to an optional histogrammer 260, i.e., defined frequency bins may be populated via tracking the count of the frames and apportioning according to the resulting square-root of each image residue 231, D, in the count according to a particular bin range. An estimate of the standard deviation of the square-root of the residue 262, {circumflex over (σ)}n, may then be determined based on the mode of the histogrammed data. In one embodiment, an estimate of a motion compensation error 264, {circumflex over (σ)}me may be determined based on an upper tail percentage of the histogrammed data. The estimate of a motion compensation error 264, {circumflex over (σ)}me may be combined with {circumflex over (σ)}n 262, e.g., in a second order polynomial function, to determine the temporal filter parameter, σt.
The motion-compensated temporal filter may first perform motion compensation of the pixel of the current frame based on the estimated motion vectors from the previous frame. Then the output of MCTF may be a weighted combination of the motion-compensated previous frame pixel and the spatially related pixel of the current frame. Motion vectors between a previous frame and current frame, u, v, may be expressed relative to a pixel, I, of the previous frame t−1, i.e., relative to I(i,j,t−1), as vi,j,t-1 and ui,j,t-1. The averaging window for determining the image pixel residue may be expressed as d, where d represents half of the averaging window length in either direction. The temporal filtering parameter σt is the filtering parameter applied to temporally smooth the output pixels. The output of MCTF, i.e., O(i,j,t), may be determined according to the following:
where the weight, wi,j,t-1, may be determined according to the following:
w
i,j,t-1=exp {−Di,j,t-1/2σt2)}; [2]
and, where the image pixel residue D for a range of ±d pixels in both spatial directions about the reference pixel I(i,j,t), applying the motion vectors, u,v, from I(i,j,t) to I(i,j,t−1), may be determined according to the following:
For a particular D, increasing σt provides more de-noising power, while concurrently tending toward over-smoothing, and potentially producing image artifacts. Embodiments determine values of σt that provide de-noising effects while not over-smoothing and/or generating artifacts.
The filtering parameter, σt, may be treated as spatially invariant, i.e., uniform for an entire frame, but may change over frames, i.e., temporally variant. The global properties of input frames and their sequences, such as their noise statistics, may affect the σt. An effective σt value may be defined as the one maximizing the peak signal-to-noise ratio between the filtered image and a ground truth. Alternatively, a metric such as the Structure Similarity Index (SSIM) may be applied to assess effective values of σt. In one embodiment, determining values of σt may be done a priori via trials that may be carried on sequences that have various texture complexity and motion complexity.
Although an averaged numerically optimal σts may be closely related to noise level, a factor that may model the deviation from the average for each frame may be lacking. For frames with σts above the average, the motion compensation errors may be, in general, small. Images having σts that are below the average in each level may correspond to large motion compensation errors in the compensated previous frames. Therefore, an additional feature related to the motion compensation error may be used for predicting the numerically optimal σt.
σt=a2{circumflex over (σ)}n2+a1{circumflex over (σ)}n+a0; and [4]
σt=a2{circumflex over (σ)}n2+a1{circumflex over (σ)}n+b2{circumflex over (σ)}me2+b1{circumflex over (σ)}me+c. [5]
The determining of the parameters a2, a1, a0, for the first polynomial-based predictor, and/or a2, a1, a0, b2, b1, and c for the second polynomial-based predictor, may be accomplished via a training process. The polynomial parameters defining fitted curves of two exemplary prediction methods are listed as training output in Table 1 of
Embodiments may include one or more processing modules where they comprise a processor, such as a central processing unit (CPU), and a memory store, such as addressable memory.
In some embodiments, the motion estimation may give incorrect correspondence between the current pixel and the pixel in the previous frame, and it may be possible that the correct corresponding pixel may be within the neighborhood of the incorrect pixel. Therefore, taking multiple candidates into account, multiple candidates may help recover the correct temporal correspondence. Some embodiments may consider only one pixel in the previous frame for filtering each pixel in the current frame. In another embodiment, the temporal filtering may be extended to consider multiple pixels in the previous frame for filtering one pixel in the current frame. These pixels may be referred to as candidates. Multiple candidates may have more de-noising power and may aid in correcting for the motion error.
Therefore, in some embodiments, the temporal filtering may consider multiple pixels in a previous frame for filtering the current pixel in the current frame. This may be in addition to considering only one pixel in the previous frame for filtering each pixel in the current frame. In a multi-pixel embodiment, the filtered intensity vector may be based additionally on a weighting, e.g., a spatial Gaussian distribution, to further determine the frame weighting. If applied, the spatial Gaussian may be positioned to attenuate the value of the weighting factor as the distance increases from the current pixel of the current frame.
An exemplary multi-candidate filtering scheme may be expressed where the output of the filter may be given by:
where the weight wm,n,t-1 may be defined by
w
m,n,t-1=exp {−Dm,n,t-1/(2σt2)}; the residue may be defined by: [7]
where
N(i+vi,j,t-1,j+ui,j,t-1) [9]
denotes the neighbor of point
(i+vi,j,t-1,j+ui,j,t-1). [10]
In addition, γ(m,n) may be based on a spatial Gaussian kernel, i.e.,
γ(m,n)=exp {−(m−(i+vi,j,t-1))2+(n−(j+ui,j,t-1))2)/2σs2)} [11]
where σs is the standard deviation parameter for the kernel. For single candidate, the optimal σt may have been searched. For the multi-candidate, the jointly optimal σt and σs may have been searched.
Filtering parameters for the motion-compensated temporal filtering may be locally adaptive. That is, one may predict the {circumflex over (σ)}t for each pixel in the image depending on local features of the input frame.
For example, the local features may comprise a local variance of the image intensity, VarI(i,j,t) and a local variance of each of the motion vectors, Varu(i,j,t) and Varv(i,j,t). The local variance of the image intensity, VarI(i,j,t), may be determined 660 based on subtracting the squared sum across the 2-D local window of the intensity vector of the current frame, I(m,n,t), divided by the square of unity plus the local window size, from the sum of the square of the intensity vector of the current frame, I(m,n,t), divided by the square of unity plus the local window size.
Also for example, the local variances of the motion vector for each component direction, Varu(i,j,t) and Varv(i,j,t), may be determined 660 by subtracting the square of the sum of the motion vector of the current frame, divided by the sum of unity plus the local window size, from the sum of the square of the motion vector divided by the square of unity plus the local window size. A total motion vector variance, VarMV(i,j,t) may then be determined by adding each direction vector, i.e., Varu(i,j,t)+Varv(i,j,t).
The filtering parameter {circumflex over (σ)}t may therefore be predicted according to local features. For example, the local variance of the image intensity, VarI(i,j,t), may be determined 660 according to the following:
Also for example, the local variance of the motion vector. The variance of each direction, u, v, of the motion vector, MV, may be determined 670 by:
The total variance, VarMV, may be given by
Var
MV(i,j,t)=Varu(i,j,t)+Varv(i,j,t). [15]
A test set for the predicting of the filtering parameter {circumflex over (σ)}t according to local features may be a synthetic dataset with, for example, additive Gaussian noise, std. dev.=10, and a compression rate=20 Mbps.
Additional features that may be considered for predicting the filtering parameter {circumflex over (σ)}t—according to local features—include, for example, normalized cross-correlation and mean-square difference. Additionally, in one embodiment, the use of other features for classification, such as gradient features which corresponds to edges, histogram features such as histogram similarity measurements—e.g., Bhattacharyya distance or Mahalanobis distance—or other spatial noise statistics may be used.
A prediction process depends on the existence and uniqueness of the optimal σt. The numerically optimal σt may relate to the noise level and motion compensation error. The numerical optimal σt for motion-compensated temporal filtering may be based on minimizing the mean-square error. For example, a point x0 in a scene at time t, i.e., the current frame, may be considered. The observed image pixel may be y0 where y0=x0+n0. Similarly, the corresponding point may be assumed x1 in time t−1 and the observed pixel may be y1=x1+n1. n0 and n1 may be additive Gaussian noise with zero mean and having a standard deviation, σn. A motion transformation M between x1 and x0, i.e., x1=M(x0) may be considered. The motion transformation may be invertible. An estimate of the motion transformation {circumflex over (M)} in the motion estimation stage may be obtained, then the inverse of the estimated motion may be applied to the t−1 frame, i.e.,
{circumflex over (M)}
−1(y1)={circumflex over (M)}−1(x1+n1)={circumflex over (M)}−1(M(x0)+n1). [16]
A filtering process may be express as:
where w may be the weighting value. If the motion estimation is correct, i.e., {circumflex over (M)}=M, the above equation becomes {circumflex over (M)}−1(y1)=x0+{circumflex over (M)}−1(n1). Since the motion transformation does not change the statistics of the noise, we denote {circumflex over (M)}−1(n1)Δn0′, which is independent and identically distributed (i.i.d) with respect to n0. So, for the situation of correctly estimated motion, the optimal weight, w, when defined as the weight that results in the largest de-noising power, is unity. Accordingly, the de-noised result will have noise variance of σn2/2.
The motion estimation is not always correct, and when the motion transformation is not correct, one may assume the difference between the true value and the compensated value to be Δx, i.e., {circumflex over (M)}−1M(x0)−x0=Δx. Accordingly:
{circumflex over (M)}
−1(y1)=x0+Δx+n0′ [17]
The correct motion estimation is a special case when Δx=0. However, for the incorrect motion estimation, the filtered result is thus
One may define the filtering error for pixel x0 as the expected mean-square error over the probability distribution of the Gaussian noise, i.e.,
With n0 and n0′ being independent and identically distributed (i.i.d) with zero mean and standard deviation σn2, the above expected mean-square error equation can be simplified as:
A partial derivative with respect to w, yields the following:
If the error is minimized for weight, then the partial derivative with respect to weight is zero, i.e.,
which in turn yields
[w(1+w)−(1+w2)]σn2=[w(1+w)−w2]Δx2, [23]
from which we derive the optimal weight, w*, is given by
which is equivalent to
When motion estimation is correct, Δx=0, then w=1. Another case that Δx=0, meaning that the pixel locates in a uniform area and the wrong motion compensation does not cause a difference, the weight is still unity. When σn increases, w increases, resulting more de-noising power. Accordingly, the upper bound of the weight is unity.
Local averaging may be an approximation to taking the expectation, and so the weight, w, may be expressed as: w=exp {−d/(2σt2)} where d, which is an expectation and not the one-half the window distance applied in a previous section, may be expressed as:
d=E
n[({circumflex over (M)}−1(y1)−(y0)2]=En[(Δx+n0′−n0)2]−Δx2+2σn2. [26]
The above equation for d has an underlying assumption that Δx varies little within a small local region. Therefore, the inverse of the weighting factor may be expressed as
Based on the Taylor Series of ex=1+x+x2/2 . . . , one may approximate the above inverted weighting factor equation by a first order, e.g.,
Therefore the numerically optimal σt should approximately satisfy the following:
and the above relationship can be solved as
The above equation shows the numerically optimal σt relates to the noise level. That is, the larger the value of σn, then the larger the value of σt. The above equation also relates to Δx, or d, which can be spatially variant. If Δx>>σn, the numerically optimal σt may be given by
This case of Δx>>σn, the value σt increases linearly with the value of σn.
To define a uniform σt for an entire frame, one may consider Δx to be a random variable having a zero mean and a variance of σ2me. One may use the expected value of Δx2 to approximate the σt, i.e.,
Definitions and notations are similar to the previous section. One may assume Δx to be a random variable of zero mean and variance of σ2me. The filter weighting may be defined as in equation no. 7 (above), i.e.,
w=exp {−(Δx2+2σn2)/(2σt2)}. [32]
One may define the normalized weight to be
Therefore the filter output is may be expressed as:
{circumflex over (x)}
0
=ρy
0+(1−ρ)/{circumflex over (M)}−1(y1). [33]
One may define the error as expected mean-square-error over both the distribution of additive noise and distribution of motion error,
i.e., En,Δx[({circumflex over (x)}0−x0)2]=En,Δx[(ρn0+(1−ρ)n0′+(1−ρ)Δx)2]. [34]
Taking expectation on the noise first, one may arrive at the expectation, or objective function, expressed as:
A partial derivative of the above objective function with respect to σt, where the order of expectation and derivative are exchanged, one has the following:
The following approximations on ρ:
The two approximations are all based on Taylor series. Therefore,
Substituting the expression for
into the expression for
yields the following:
The above expression can be simplified as:
optimal σt2 may be solved for as follows:
So, the optimal variance, (σt)* and the associated square root, σt, relate to both the noise variance and second, fourth and sixth moment of motion error.
It is contemplated that various combinations and/or sub-combinations of the specific features and aspects of the above embodiments may be made and still fall within the scope of the invention. Accordingly, it should be understood that various features and aspects of the disclosed embodiments may be combined with or substituted for one another in order to form varying modes of the disclosed invention. Further, it is intended that the scope of the claimed invention (below), disclosed herein by way of examples, should not be limited by the particular disclosed embodiments described above.