# Patent

## Title
Low-cost roto-translational video stabilization

## Abstract

A method and system for filtering an image frame of a video sequence from spurious motion, comprising the steps of dividing the image frame and a preceding image frame of the video sequence into blocks of pixels; determining motion vectors for the blocks of the image frame; determining inter-frame transformation parameters for the image frame based on the determined motion vectors; and generating a filtered image frame based on the determined inter-frame transformation parameters; wherein the image frame is dived into overlapping blocks.

## Background
PRIORITY CLAIM
The instant application claims priority to Italian Patent Application No. VI2012A000087, filed Apr. 17, 2012, which application is incorporated herein by reference in its entirety.
BACKGROUND
Digital video capturing means are well-known in the consumer mass market and available for relatively low prices. However, amateur videos often suffer from misalignments of consecutive frames caused by hand-shaking (trembling). Thus, a variety of stabilization techniques based on motion estimation is known in the art (see, for example, A. Engelsberg, G. Schmidt, “A comparative review of digital image stabilizing algorithms for mobile video communications”, IEEE Transactions on Consumer Electronics, Vol. 45, No. 3, August 1999; J. K. Paik, Y. C. Park, D. W. Kim, “An adaptive motion decision system for digital image stabilizer based on edge pattern matching”, IEEE ICCE Consumer Electronics, Digest of Technical Papers, June1992 which are incorporated herein by reference).
In particular, motion estimation based on horizontal and vertical characteristic curves has been implemented (see, for example, M. Kim, E. Kim, D. Shim, S. Jang, G. Kim, and W. Kim, “An Efficient Global Motion Characterization Method for Image Processing Applications,” IEEE Trans. On Consumer Electronics, pages 1010-1018, November 1997; Y. Koo and W. Kim, “An Image Resolution Enhancing Technique Using Adaptive Sub-Pixel Interpolation For Digital Still Camera System”, IEEE Transactions On Consumer Electronics, Vol. 45, No. 1., February 2005 which are incorporated herein by reference). However, these kinds of stabilization methods are not sufficiently reliable in the cases of illumination changes, motion blur, new details entering into the scene or moving objects in the scene. These problems have partially been addressed in US 2010/124379 A1 and EP 2 204 982 A1 (which are incorporated herein by reference) wherein an algorithm was provided that particularly allows for the reduction of motion blur and distraction by moving objects. However, the proposed algorithm may be improved with respect to the overall stabilization preciseness and handling of regular patterns. Therefore, despite the recent technology advancements there is still a need for an improved video stabilization method taking into account the restricted computational resources available in video capturing mass products.



BRIEF DESCRIPTION OF THE DRAWINGS
Aspects and many of the attendant advantages of the claims will become more readily appreciated as the same become better understood by reference to the following detailed description, when taken in conjunction with the accompanying drawings, wherein:
FIG. 1 illustrates basis steps of an example of the herein disclosed method for digital video stabilization according to an embodiment.
FIG. 2 illustrates a block comprising searching windows at the margin and pixels used for matching according to an embodiment.
FIG. 3 shows a table with typical figures for sizes of searching windows and blocks as well as block numbers according to an embodiment.
FIG. 4 illustrates overlapping blocks according to an embodiment.
FIG. 5 shows a table with typical figures for sizes of searching windows and blocks and overlapping regions as well as block numbers according to an embodiment.
FIG. 6 shows two successive curves differing from each other due to change in illumination according to an embodiment.
FIGS. 7 and 8 show ideal matching and incorrect matching according to the integral projection method, respectively, for illumination change according to an embodiment.
FIG. 9 shows a response of a high pass filter used for pre-filtering row/column features according to an embodiment.
FIG. 10 shows a matching result obtained by the filter illustrated in FIG. 9 according to an embodiment.
FIG. 11 shows a matching result obtained by means of a Butterworth IIR band pass filter according to an embodiment.
FIG. 12 illustrates a response of the filter used to obtain the result shown in FIG. 11.
FIGS. 13 and 14 illustrate sub-pixel matching according to an embodiment.
FIG. 15 illustrates the process of determining inter-frame transformation parameters according to an embodiment.
FIG. 16 illustrates block selection for the determination of motion vectors according to an embodiment.
FIG. 17 shows a histogram obtained from motion vector components according to an embodiment.
FIG. 18 shows a histogram obtained from motion vector components in the case of a big moving object before (left diagram) and after (right diagram) applying a histogram filter according to an embodiment.
FIG. 19 illustrates a process for obtaining similarity model parameters according to an embodiment.
FIG. 20 shows error propagation in computing an error matrix according to an embodiment.
FIG. 21 shows system diagram of an embodiment disclosed herein.



DETAILED DESCRIPTION
The following discussion is presented to enable a person skilled in the art to make and use the subject matter disclosed herein. The general principles described herein may be applied to embodiments and applications other than those detailed above without departing from the spirit and scope of the present detailed description. The present disclosure is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed or suggested herein.
By way of overview, the subject matter disclosed herein may be directed to a system and method that addresses the above-mentioned need and, accordingly, relates to a method for compensating for unintentional motion in a video sequence caused by hand-shaking. It is provided, a method for filtering an image of a video sequence of images from spurious motion caused by hand-shaking (trembling). The method for filtering an image frame of a video sequence from spurious motion, comprises the steps of dividing the (current) image frame and a preceding image frame of the video sequence into blocks of pixels; determining motion vectors for the blocks of the (current) image frame; determining inter-frame transformation parameters for the (current) image frame based on the determined motion vectors; and generating a filtered image frame (from the current image frame) based on the determined inter-frame transformation parameters; wherein the image frame is dived into overlapping blocks.
In principle, motion vectors can be determined by any method known in the art, for example, block matching algorithms as disclosed by S. Auberger and C. Miro, Digital Video Stabilization Architecture For Low Cost Devices, Proceedings of the 4th International Symposium on Image and Signal Processing and Analysis, page 474, 2005, or F. Vella, A. Castorina, M. Mancuso, and G. Messina, Digital Image Stabilization By Adaptive Block Motion Vectors Filtering, IEEE Trans. on Consumer Electronics, 48(3):796-801, August 2002 or in EP 2 204 982 Al (which is incorporated herein by reference).
In the overall filtering procedure, the step of dividing a current frame into blocks of pixels is crucial for the resulting filtered image. The number of blocks obtained is important because each block should be big enough to allow for a good estimation of the respective motion vector and small enough to have a considerable number of motion vectors in order to facilitate extraction of the inter-frame transformation parameters.
According to an embodiment, overlapping blocks are obtained for an image frame under consideration. Each of the overlapping blocks may have the same number of pixels X. Then, both in the vertical direction and the horizontal direction neighboring blocks share some predetermined number of pixels X/Y where Y determines the number of pixels shared. Consider, for example, an area of the image frame of 128×128 pixels. This area might be divided into five blocks: A first block B0=(0 . . . 63, 0 . . . 63), i.e., comprising the first 64 pixels in each direction, a second block B1=(16 . . . 79, 16 . . . 79), a third block B2=(32 . . . 95, 32 . . . 95), a fourth block B3=(48 . . . 111, 48 . . . 111), and a fifth block B4=(64 . . . 127, 64 . . . 127). Thus, instead of two non-overlapping blocks (for pixels (0 . . . 63, 0 . . . 63) and (64 . . . 127, 64 . . . 127)), a number of overlapping blocks (in this example, five overlapping) are employed. By dividing the image frame into overlapping blocks, the number of motion vectors and blocks to be used for the determination of the inter-frame transformation parameters can be increased without making the sizes of the blocks too small for a reliable determination of the motion vectors.
The motion vectors can be determined by block matching and each of the blocks may comprise a sub-set of pixels that are used for the determination of the motion vectors. For example, each block comprises a searching window at each margin (left, right, top, bottom) wherein the searching windows comprise a predetermined number of (marginal) pixels that are not used for determining the motion vectors (block matching) thereby defining some maximum allowed movement of the blocks from one frame to another in the vertical and horizontal directions.
Experiments have shown that using at least 32 pixels used for the block matching and/or sizes of the searching windows in each direction of more than 5% of the dimension (number of pixels) of the image frame in that direction and/or at least 200 blocks into which the image frame is divided provides satisfying results for both the determination of the motion vectors and the determination of the inter-frame transformation parameters. It should be noted that, in principle, the embodiments described herein may comprise either dividing frames into overlapping blocks or using blocks with searching windows that are not used for block matching, i.e., providing overlapping blocks and searching windows that are not necessarily combined. Thus, it is provided a method for filtering an image frame of a video sequence from spurious motion, comprising the steps of dividing the image frame and a preceding image frame of the video sequence into blocks of pixels; determining motion vectors for the blocks of the image frame by block matching; determining inter-frame transformation parameters for the image frame based on the determined motion vectors; and generating a filtered image frame based on the determined inter-frame transformation parameters; wherein each block comprises a searching window at each margin (left, right, top, bottom) wherein the searching windows comprise a predetermined number of (marginal) pixels that are not used for determining the motion vectors (block matching). Each of the searching windows may comprise 16×16, or 32×32, or 40×40 or 64×64 pixels and/or each of the blocks may comprise 64×64, 96×96, or 112×112 or 160×160 pixels and/or overlapping regions of the blocks may comprise 16×16, or 32×32, or 40×40 or 48×48 pixels.
As it discussed in EP 2 204 982 A1, integral projections techniques of the art suffer from problems arising when new different details or regular patterns come into the imaged scene. In fact, a new matching formula was introduced in EP 2 204 982 A1 (see equations 5 and 6 or 9 and 10 of that document). In particular, in the presence of a regular pattern a matching curve representing the pattern may comprise a plurality of minima of similar values. In such a case, two successive minima and a maximum located between these minima can be considered and wrong local minima selection can be avoided according to the teaching of EP 2 204 982 A1. For this, a percentage P is defined:

P=(|min1−min2|))/(max1−min(min1, min2)

and if the percentage P is less than some predetermined threshold T the selected new minimum will be the one with the lower position (smaller absolute value on the abscissa) of min1 and min2, otherwise, the selected new minimum will be the minimum of min1 and min2).
However, the precision of the matching taught in EP 2 204 982 A1 can even be improved as follows (see also description of FIGS. 13 and 14 below). Say, a (global) minimum is determined for a pixel B(x2, y2). Then, the previous integer value, A(x2, y2), (pixel value of the previous pixel) and the following integer value, C(x2, y2), (pixel value of the previous pixel) are considered also. Now, it is the task to determine the coefficients a, b, and c of the equation of the parabola y=ax2+bx+c connecting A, B, and C. The vertex of the parabola is determined and this is taken as the new minimum. Thus, the minimum is determined on a sub-pixel (non-integer) scale thereby improving the accuracy of the matching process.
Starting from the determined motion vectors, for example, obtained based on some block matching algorithm known in the art, inter-frame parameters are extracted employing rejection rules (see detailed description below). In particular, an embodiment provides a new application of a histogram filter during the process of inter-frame parameter estimation (see also FIG. 15 and description thereof below).
As already described in US 2010/124379 A1 due to moving objects in the imaged scene there are motion vectors that are correctly calculated by block matching that are to be deleted for determining inter-frame parameters. In particular, big moving objects (for example, with sized of 50% of the image frame or more) can be dealt with a history filter (see FIG. 8 of US 2010/124379 A1). Application of the history filter described in US 2010/124379 A1 is also foreseen according to an exemplary embodiment of the herein disclosed method. Robustness of the inter-frame parameter can be further improved as follows. In presence of big moving objects (at least 50% of the entire frame in size) a histogram of motion vectors exhibits multiple peaks. One of the peaks is caused by camera motion whereas the other ones are caused by the moving object. According to an embodiment a histogram filter is used that finds the highest peak in the histogram of motion vectors and filters out all (components of) motion vectors that are too far away from the found highest peak. Decision about “too far away” is made by a threshold for the distance that is determined based on the maximum allowed rotation and scale. Histograms are related to Motion Vectors, found block by block. On the axes are shown the number of Motion Vectors which have the same value. Allowed rotation/scale is the range of values in which they are assumed to vary. These values can be experimentally obtained on a set of testing sequences. Examples are −5°<=rotation <=5° and 0.9<=scale <=1.1.
An embodiment making use of the histogram filter, may further comprise applying a history filter to motion vectors determined for a current image frame comprising determining a first set of motion vectors that are the same as motion vectors determined for a previous image frame and a second set of motion vectors that are not the same as motion vectors determined for the previous image frame, deleting some motion vectors of the first and second sets of motion vectors and combining the thus reduced sets of motion vectors to obtain a combined set of motion vectors and wherein the histogram filter is applied to the combined set of motion vectors. The second set of motion vectors may be reduced based on an error matrix determined for the previous image frame as described below.
It should be noted that the application of the histogram filter can be combined with the employment of overlapping blocks and blocks comprising searching windows as described above. In principle, the histogram filter can be used in a method for filtering an image frame based on non-overlapping blocks without searching windows. Thus, it is provided a method for filtering an image frame of a video sequence from spurious motion, comprising the steps of dividing the (current) image frame and a preceding image frame of the video sequence into blocks of pixels; determining motion vectors for the blocks of the (current) image frame; determining inter-frame transformation parameters for the (current) image frame based on the determined motion vectors; and generating a filtered image frame (from the current image frame) based on the determined inter-frame transformation parameters; and further comprising applying a histogram filter to determined motion vectors to filter out motion vectors that are too far away (beyond a predetermined threshold) from a highest peak found in a generated histogram of the motion vectors.
It is also provided herein a mobile video capturing device (for example, a digital video camera, a mobile phone or a digital camera), comprising a processor configured to perform the steps of the methods according to one of the above-described examples.
In the following, an example of the disclosed method for digital video stabilization is described with reference to FIG. 1. In a first step block motion estimation is performed. In this step, motion vectors are estimated for the incoming video frames that are divided into blocks. Moreover, particular parameters are calculated that are used in the subsequent second step of parameter extraction. When dividing frames into blocks some compromise between blocks big enough to allow for a reliable motion estimation and small enough to facilitate a good parameter extraction has to be found, in principle. According to this example, not all pixels of a block are used for motion estimation. Rather, one defines searching windows, i.e., the maximum allowed movements in the horizontal and vertical directions (see FIG. 2). A typical number of pixels allowing for reliable motion estimation is 32 or more. Typical figures of the block division that have proven to allow for reliable motion estimation are shown in FIG. 3. However, for a good parameter extraction more blocks are necessary than shown in FIG. 3. More blocks allow for the estimation of more motion vectors.
According to an example one may use overlapped blocks with two parameters: OverlapX and OverlapY, which represent the number of pixel to shift starting from the origin of the frame to obtain the new block, respectively in horizontal and vertical directions. An example is shown in FIG. 4. In this case, the horizontal dimension of the blocks is BlocksizeX=64 and the horizontal overlap OverlapX=16, so the first block (not overlapped (normal)) is given by B0=(0 . . . 63, 0 . . . 63), while the second block is given by B1=(16 . . . 79, 16 . . . 79) and so on up to the block B4=(64 . . . 127, 64 . . . 127). So instead of two blocks in the area of the frame of 128×64 pixels, we obtain five blocks. In general, to know the total number of blocks BlockNumber, the following formula is applied:

BlockNumberX=((Width−BlockSizeX)/OverlapX)+1

BlockNumberY=((Height−BlockSizeY)/OverlapY)+1

BlockNumber=BlockNumberX·BlockNumberY 

where Width and Height are the horizontal and vertical dimensions of the frame, while BlockSizeX and BlockSizeY are the horizontal and vertical dimensions of the block. A suitable number of blocks, for example, is 200 or more.
Next, feature extraction based on horizontal and vertical characteristics curve is to be performed. The row/column features (RCF) along the horizontal (m) and vertical (n) dimensions can be calculated from:



  
    
      
        RCF
        k
        x
      
      ⁡
      
        (
        j
        )
      
    
    =
    
      
        ∑
        
          i
          =
          1
        
        m
      
      ⁢
      
        
      
      ⁢
      
        p
        ij
      
    
  




  
    
      
        RCF
        k
        y
      
      ⁡
      
        (
        i
        )
      
    
    =
    
      
        ∑
        
          j
          =
          1
        
        n
      
      ⁢
      
        
      
      ⁢
      
        p
        ij
      
    
  



as it is described in EP 2 204 982 A1 (pij is the pixel value in position (i,j)).
The signal processing block of the first step illustrated in FIG. 1 deals with the problems to reduce the scene change illumination and motion blur effects, while original integral projection techniques (M. Kim, E. Kim, D. Shim, S. Jang, G. Kim, and W. Kim, “An Efficient Global Motion Characterization Method for Image Processing Applications,” IEEE Trans. On Consumer Electronics, pages 1010-1018, November 1997; Y. Koo and W. Kim, “An Image Resolution Enhancing Technique Using Adaptive Sub-Pixel Interpolation For Digital Still Camera System”, IEEE Transactions On Consumer Electronics, Vol. 45, No. 1., February 2005) suffer from this kind of problems. In order to illustrate the effect of illumination changes in the calculated row/column features the following example is provided. Two successive curves are displayed in FIG. 6. It is to note that the shape of the curves is really similar, but the values are slightly different for the scene illumination changes. The results of the ideal matching (−29) is shown in FIG. 7. With the classic integral projection method, the matching is not correct, like indicated in FIG. 8. Mainly the high dynamic changes occurring around the point 1600 cause method failure. The integral projection method, particularly, suffers from the strong edge around the point 1600.
It has been observed that better stabilization results can be obtained by pre-filtering the row/column features with a High Pass Filter (HPF), thus enhancing curve peaks, obtained in the following way:

Cxfil=Cx−(CxLPF)

Cyfil=Cy−(CyLPF)

A Low Pass Filter (LPF) with 16 ones (i.e., [1111111111111111]/16) allows obtaining a simple HPF, with good results and low extra cost, by subtracting the filtered data from the original one. The filter response is shown in FIG. 9. In the example proposed, with this simple filter, we obtain a good matching (−29), as shown in FIG. 10. This solution provides good results and it is simple to implement (just 15 sums and 1 shift operations per sample). It is noted that, alternatively, a Butterworth IIR Band Pass Filter (BPF) might be used. Experiments have shown that a 2nd order, Direct form II, with cutoff frequencies w1=0.01 Hz and w2=0.20 Hz filter is suitable, for example. Matching results and the magnitude response obtained by such a filter are shown in FIGS. 11 and 12.
Another problem to deal with is motion blur. The mentioned Butterworth IIR Band Pass Filter (BPF) is particularly suitable to deal with this problem. Alternatively, a Butterworth FIR HPF can be used (see detailed description in EP 2 204 982 A1).
The matching block of Step 1 of FIG. 1 deals with problems arising from new details coming into the scene captured by an image capturing means and taking into account regular pattern features as also described in EP 2 204 982 A1.
According to an embodiment, sub-pixel estimation is performed in order to increase precision of the matching. We consider three points in the matching: the chosen minimum (B) and the previous (A) and following (C) integer value. With these three points we tend to determine the parabola passing for these three points and the new minimum chosen will be the minimum of the obtained parabola.
Considering, for example, the three points A=(x1,y1), B=(x2,y2) and C=(x3,y3). The problem is to determine the coefficients a, b, c of the equation of the parabola y=ax2+bx+c passing for the points A, B, C. The solution is the following:

a=(x1·(y3−y2)−x2·y3+x3·y2+(x2−x3)·y1/den;

b=−(x12·(y3−y2)−x22·y3+x32·y2+(x22−x32)·y1)/den;

c=(x1·(x32·y2−x22·y3)+x12·(x2·y3−x3·y2)+(x22·x3−x2·x32)·y1)/den;

den=(x1·(x32−x22)−x2·x32+x22·x3+x12·(x2−x3));

To optimize the number of the operations needed, we can simplify as follows:

a=(t1−t2+t3+t4)/den;

b=−(x1·t1−x2·t2+x3·t3+x2·t4a−x3·t4b)/den;

c=(−x22·t1a+x32·t1b+x12·t2−x12·t3−x32·t4a+x22·t4b)/den;

den=(x12·(x2−x3)+x22·(x3−x1)+x32·(x1−x2));

where:

t1a=x1·y3; t1b=x1·y2; t1=t1a−t1b;

t2=x2·y3; t3=x3·y2;

t4a=x2·y1; t4b=x3·y1; t4=t4a−t4b;

x12=x12; x22=x22; x32 x32;

Since the vertex of the parabola (that is the minimum we are looking for) is at the location V=(Vx,Vy)=(−b/(2·a), (4·a·c−b2)/(4·a)), the total number of operations to calculate it are: 22 sums, 2 shifts, 25 multiplications and 5 divisions.
In particular, the calculation of Vx:

Vx=−b/(2·a)=(x1·t1−x2·t2+x3·t3+x2·t4a−x3·t4b)/(2·(t1−t2+t3+t4));

where t1, t2, t3, t4a, t4b and t4 is the same as (11). So the total operations to calculate Vx are: 10 sums, 1 shift, 11 multiplications and 1 division.
We can further optimize the calculation of Vx in the following manner:

Vx=−b/(2·a)=(x1·t1+x2·t2+x3·t3)/(2·(t1+t2+t3));

t1=x1·(y3−y2), t2=x2·(y1−y3); t3=x3·(y2−y1);

So the total operations to calculate Vx are further reduced: 7 sums, 1 shift, 6 multiplications and 1 division.
Just to show an example, if we consider the three points A=(x1,y1)=(−5, 5111), B=(x2,y2)=(−4, 4259) and C=(x3,y3)=(−3, 4259), we obtain V=(Vx,Vy)=(−3.5, 4152.5), that is exactly on the middle of the points B and C, since they have the same y-coordinate, as indicated in FIG. 13. In the case in which the two points near the vertex have not got the same y-coordinate, the vertex will be situated near the point which has got the lower y-coordinate, as shown in FIG. 14.
In the calculation of the vertex Vx, the parameter a assumes an important role. In fact, if a is greater than zero, then the parabola is convex, with the vertex down; if a is lower than zero, then the parabola is concave, with the vertex up; if a is equal to zero, then we have a line. Since we are interested in calculating the minimum of the parabola, a should be always greater than zero.
The second step shown in FIG. 1 relates to parameter extraction. Starting from a pair of consecutive frames (I(t), I(t−1)) inter-frame transformation parameters λ, the zoom parameter, θ, the rotation angle, Tx and Ty, respectively X-axis and Y-axis shifts, are computed. Basic blocks of step 2 are described in US 2010124379 A1. FIG. 15 illustrates a motion estimation algorithm according to an example embodiment. As compared to the algorithm described in US 2010124379 A1, in particular, according to one example, a histogram filter is employed.
In order to reduce the complexity of the algorithm, a proper selection of the blocks in used for the computation of local motion vectors may be done. The selection takes into account block history (typically a good block at time t is also reliable at time t+1), and random insertion (the variability of the scene condition is considered). In real time, a fixed upper bound of the number of operations may be set. In particular, the maximum number of blocks in which to compute local motion vector is typically known in advance. This upper bound is called maxVectorsNumber. The algorithm considers two percentage thresholds: selectHistory and selectRandom (their sum is equal to one). These thresholds determine the number of vectors selected due to their history (selectHistory*maxVectorNumber) or in a random way (selectRandom* maxVectorNumber). An Error Matrix Computing module provides information about the history of each block (boolean matrix Mb). This information is the starting point of the selection algorithm.
First of all, the reliable block positions provided by Mb are propagated into the neighborhood through morphological operators producing a Bmo positions matrix. This step embodies spatial similarity considerations (typically the neighbors of a good vector are also reliable vectors) and improves the performance of a pre-filtering module (see below). In fact some filtering criteria take into account neighbors' behavior and do not work properly in absence of a neighborhood. To fulfill the upper bound requirement a pruning step is also performed. This step eliminates the surplus vectors in a uniform way. We call the novel positions matrix Bmop, which thus far has been considered at most selectHistory*maxVectorNumber vectors. The remaining vectors are then randomly selected. To provide neighborhood information to each selected block, they are chosen in groups of four. Moreover, in order to force a uniform spatial distribution the following algorithm has been developed (see FIG. 16):
1. The rectangle image is transformed in a square image. The edge of the square is equal to the smaller rectangle size.
2. The square image is divided into M2 square regions. If one selects N group of blocks, M is the smaller integer that satisfy M2>N.
3. N square regions are randomly selected between the available M2.
4. For each selected region a real point is randomly selected.
5. The 2D coordinates of the selected points are transferred in the original rectangle and quantized.
To cope with possible overlaps, the steps above listed are iteratively repeated until every group of blocks have been placed. Each new iteration starts with the residual elements (blocks not yet inserted) of the previous one. However, the overall number of iterations to be done is typically be fixed in advance (an upper bound is necessary to satisfy the real-time computation requirements). To sum up the random insertion step, starting from Bmop, a Bs positions matrix is computed. This matrix, together with input frames at time t and t−1, is the input of the local estimator module shown in FIG. 15.
Local motion estimator typically computes many wrong motion vectors. To filter out these vectors that are not useful for global motion estimation, we make use of the following considerations:

    
    
        The IP_Error_x and IP_Error_y values have to be low (effective match).
        Local motion vectors have to share in their neighborhood similar values (motion continuity).
        Local motion vectors referred to homogeneous blocks are not reliable.
    
    


The above rules have been derived after an exhaustive experimental phase devoted to achieve a suitable trade-off between overall complexity and real-time constraints. According to the previous consideration we have derived five indexes: IP_Error_x and IP_Error_y (goodness of matching), NS (neighborhood similarity), DispX and DispY.
Both IP_Error_x, IP_Error_y and the inhomogeneity indexes (DispX and DispY) have been already computed during the curve matching phase. NS is computed as follows:




  
    
      
        NS
        ⁡
        
          (
          
            i
            ,
            j
          
          )
        
      
      =
      
        
          
            1
            8
          
          ⁢
          
            
              ∑
              
                k
                =
                
                  -
                  1
                
              
              1
            
            ⁢
            
              
            
            ⁢
            
              ∑
              
                h
                =
                
                  -
                  1
                
              
              1
            
          
        
        ⁢
        
          
        
        |
        
          
            
              Mv
              x
            
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          -
          
            
              Mv
              x
            
            ⁡
            
              (
              
                
                  i
                  +
                  k
                
                ,
                
                  j
                  +
                  h
                
              
              )
            
          
        
        |
      
    
     
  
  +
  
     
    
      |
      
        
          
            Mv
            y
          
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        -
        
          
            Mv
            y
          
          ⁡
          
            (
            
              
                i
                +
                k
              
              ,
              
                j
                +
                h
              
            
            )
          
        
      
      |
    
  




where Mvx(i,j) and Mvy(i,j) are the motion vectors respectively in horizontal and vertical direction of the block in position (i,j).
As already mentioned above a new matching formula was introduced in EP 2 204 982 A1 (see equations 9 and 10):



  
    
      
        P
        h
      
      ⁡
      
        (
        s
        )
      
    
    =
    
      
        
          ∑
          
            j
            =
            max_s
          
          
            M
            -
            max_s
          
        
        ⁢
        
          
        
        ⁢
        
          |
          
            
              
                RCF
                v
                
                  F
                  1
                
              
              ⁡
              
                (
                j
                )
              
            
            -
            
              
                RCF
                v
                
                  F
                  2
                
              
              ⁡
              
                (
                
                  j
                  +
                  s
                
                )
              
            
          
          |
          
            

          
          ⁢
          
            off
            h
          
        
      
      =
      
        {
        
          
            
              s
              ′
            
            ⁢
            
              :
            
            ⁢
            
              
                P
                h
              
              ⁡
              
                (
                
                  s
                  ′
                
                )
              
            
          
          =
          
            min
            ⁢
            
              
            
            ⁢
            
              
                P
                h
              
              ⁡
              
                (
                s
                )
              
            
          
        
        }
      
    
  




  
    
      
        P
        v
      
      ⁡
      
        (
        s
        )
      
    
    =
    
      
        
          ∑
          
            i
            =
            max_s
          
          
            N
            -
            max_s
          
        
        ⁢
        
          
        
        ⁢
        
          |
          
            
              
                RCF
                h
                
                  F
                  1
                
              
              ⁡
              
                (
                i
                )
              
            
            -
            
              
                RCF
                h
                
                  F
                  2
                
              
              ⁡
              
                (
                
                  i
                  +
                  s
                
                )
              
            
          
          |
          
            

          
          ⁢
          
            off
            v
          
        
      
      =
      
        {
        
          
            
              s
              ′
            
            ⁢
            
              :
            
            ⁢
            
              
                P
                v
              
              ⁡
              
                (
                
                  s
                  ′
                
                )
              
            
          
          =
          
            min
            ⁢
            
              
            
            ⁢
            
              
                P
                v
              
              ⁡
              
                (
                s
                )
              
            
          
        
        }
      
    
  



with the matching curve Pv(s) and parameters RCFh and RCFv for frame F in horizontal and vertical directions



  
    
      
        RCF
        k
        x
      
      ⁡
      
        (
        j
        )
      
    
    =
    
      
        ∑
        
          i
          =
          1
        
        m
      
      ⁢
      
        
      
      ⁢
      
        p
        ij
      
    
  




  
    
      
        RCF
        k
        y
      
      ⁡
      
        (
        i
        )
      
    
    =
    
      
        ∑
        
          j
          =
          1
        
        n
      
      ⁢
      
        
      
      ⁢
      
        p
        ij
      
    
  



where pij denotes the pixel value in position (i, j). IP_Error_x=min Ph(s) and IP_Error_y=min Pv(s), that is they are the matching error values provided by the local estimator based on integral projections. DispX=(max RCFx−min RCFx) and DispY=(max RCFy−min RCFy), that is they are the difference between maximum and minimum values of the integral projection curves.
The Prefiltering module filters local motion vectors by computing first the values IP_Error_x, IP_Error_y, NS, DispX, DispY. All the vectors with both DispX and DispY less than thHom (a threshold experimentally fixed) are filtered out. Starting from VIP vectors Vpf2 vectors are produced. Vpf2 vectors are then sorted in ascending order according to IP_Error_x, IP_Error_y (and NS) values, labelling also a percentage ppf1 (ppf2) of vectors with high IP_Error_x, IP_Error_y (NS) values as deleted. Moreover Vpf2 vectors are sorted in descending order according to DispX (and DispY) values, labeling a percentage ppf3 of vectors with low DispX (DispY) values as deleted. Finally the labeled vectors are rejected obtaining as final output a set of vectors Vpf.
The above-described filtering is devoted to eliminate all the wrong vectors computed by a generic BM algorithm. However, due to moving objects in the scene, there are vectors correctly computed by BM (hence, not filtered by Prefiltering module) that is typically deleted in order to have a good inter-frame parameters estimation. If the moving objects are not very big, their vectors probably will be rejected by robust estimation module. On the contrary if the moving objects are very big (even greater than 50% of the scene), single image information is not enough to filter out these vectors.
In order to make robust our algorithm to such situation, a History (Memory) filter module uses information on previous frames. All the Vpf vectors are split into Vpfnew (vectors not belonging to Vpf at the previous iteration t−1) and VpfOld (vectors belonging to Vpf at the previous iteration t−1). A percentage pmf1 of Vpfnew vectors is then rejected. They are considered less reliable than VpfOld vectors. We call the remaining vectors (not rejected) VpfnewF. According to Me(t−1) vector error values, VpfOld vectors are sorted and filtered out (a percentage pmf2 with high error). We call the remaining vectors (not rejected) VpfOldF. Finally VpfnewF and VpfOldF vectors are merged together into Vf.
Employment of a histogram filter represents a novel aspect. This innovative step improves the robustness of the proposed approach in presence of moving objects in the scene. Due to the limited amount of rotation and zoom factor involved in the mobile applications, motion vector components and translational parameters should have comparable values. Considering a 2D histogram of motion vector components, the vectors typically have the characteristics depicted in FIG. 17: motion vectors are very close to each other. In presence of big moving objects the 2D histogram contains multiple peaks as depicted in FIG. 18 (before (left figure) and after (right figure) histogram filter application. Typically, only one peak corresponds to the camera motion, the other one is related to a moving object entering in the scene. The histogram filter finds the highest peak in the 2D histogram and filters out all the vectors that are too far away from it (based on some predetermined threshold determined based on the maximum rotation and allowed scale). The remaining vectors (Vhf) are then propagated to the Robust Estimator module (see FIG. 15).
Global motion between adjacent frames can be estimated with a two-dimensional similarity model, usually a good trade-off between effectiveness and complexity. This exemplary model describes inter-frame motion using four different parameters, namely two shifts, one rotation angle and a zoom factor, and it associates a point (xi, yi) in frame In with a point (xf, yf) in frame In+1 with the following transformation:




  {
  
    
      
        
          
            
              x
              f
            
            =
            
              
                
                  x
                  i
                
                ⁢
                λ
                ⁢
                
                  
                
                ⁢
                cos
                ⁢
                
                  
                
                ⁢
                θ
              
              -
              
                
                  y
                  i
                
                ⁢
                λ
                ⁢
                
                  
                
                ⁢
                sin
                ⁢
                
                  
                
                ⁢
                θ
              
              +
              
                T
                x
              
            
          
        
      
      
        
          
            
              y
              f
            
            =
            
              
                
                  x
                  i
                
                ⁢
                λ
                ⁢
                
                  
                
                ⁢
                sin
                ⁢
                
                  
                
                ⁢
                θ
              
              +
              
                
                  y
                  1
                
                ⁢
                λ
                ⁢
                
                  
                
                ⁢
                cos
                ⁢
                
                  
                
                ⁢
                θ
              
              +
              
                T
                y
              
            
          
        
      
    
     
  




where λ is the zoom parameter, θ the rotation angle, Tx and Ty respectively X-axis and Y-axis shifts. Considering N motion vectors we obtain the following over-constrained linear system:




  
    
      
        
          A
          ·
          p
        
        =
        b
      
    
    
      
        A
        =
        
          (
          
            
              
                
                  x
                  
                    i
                    ⁢
                    
                      
                    
                    ⁢
                    1
                  
                
              
              
                
                  -
                  
                    y
                    
                      i
                      ⁢
                      
                        
                      
                      ⁢
                      1
                    
                  
                
              
              
                1
              
              
                0
              
            
            
              
                ⋮
              
              
                ⋮
              
              
                ⋮
              
              
                ⋮
              
            
            
              
                
                  x
                  in
                
              
              
                
                  -
                  
                    y
                    in
                  
                
              
              
                1
              
              
                0
              
            
            
              
                
                  y
                  
                    i
                    ⁢
                    
                      
                    
                    ⁢
                    1
                  
                
              
              
                
                  x
                  
                    i
                    ⁢
                    
                      
                    
                    ⁢
                    1
                  
                
              
              
                0
              
              
                1
              
            
            
              
                ⋮
              
              
                ⋮
              
              
                ⋮
              
              
                ⋮
              
            
            
              
                
                  y
                  in
                
              
              
                
                  x
                  in
                
              
              
                0
              
              
                1
              
            
          
          )
        
      
    
  
  
    
      
        p
        =
        
          (
          
            
              
                a
              
            
            
              
                b
              
            
            
              
                c
              
            
            
              
                d
              
            
          
          )
        
      
    
    
      
        b
        =
        
          (
          
            
              
                
                  x
                  
                    f
                    ⁢
                    
                      
                    
                    ⁢
                    1
                  
                
              
            
            
              
                ⋮
              
            
            
              
                
                  x
                  fn
                
              
            
            
              
                
                  y
                  
                    f
                    ⁢
                    
                      
                    
                    ⁢
                    1
                  
                
              
            
            
              
                ⋮
              
            
            
              
                
                  y
                  fn
                
              
            
          
          )
        
      
    
  




where a=λ cosθ, b=λ sinθ, c=Tx, d=Ty.

Vectors computation may be affected by noise so it is useful to apply a linear Least Squares Method on a set of redundant equations to obtain the parameters vector.

p=(At·A)−1·At·b 

All the similarity model parameters λ, θ, Tx, Ty can be easily derived from p vector components in the following way:
λ=√{square root over (a2+b2)}
θ=tan−1(b/a)
Tx=c
Ty=d
The whole set of local motion vectors probably includes wrong matches or correct matches belonging to self-moving objects in the filmed scene. Obviously, there are some correct pairs that do represent real camera shakes but several points simply do not relate to such information. Least Squares Method does not perform well when there is a large portion of outliers in the total number of features, as in this case. However, outliers can be identified, filtered out of the estimation process, resulting in better accuracy.
In order to obtain real-time performances we have implemented a fast rejection technique:

    
    
        Starting from Vhf values it computes a first Least Squares estimation of the inter-frame transformation parameters (λ1, θ1, Tx1, Ty1).
        Motion vectors which component along x and y axes are too far from the translational values (Tx1, Ty1) previously computed are filtered out. Due to the limited amount of rotation and zoom factor involved in the mobile applications, motion vector components and translational parameters should have values close to each other.
        For each Vd element two error measure (E1, E2) are computed that are given by the following formula:
    
    





  
    
      E
      1
    
    =
    
      
        e
        x
        2
      
      +
      
        e
        y
        2
      
    
  




  
    
      E
      2
    
    =
    
      
        
          (
          
            
              
                (
                
                  
                    x
                    s
                  
                  -
                  
                    x
                    i
                  
                
                )
              
              ·
              
                (
                
                  
                    x
                    f
                  
                  -
                  
                    x
                    i
                  
                
                )
              
            
            +
            
              
                (
                
                  
                    y
                    s
                  
                  -
                  
                    y
                    i
                  
                
                )
              
              ·
              
                (
                
                  
                    y
                    f
                  
                  -
                  
                    y
                    i
                  
                
                )
              
            
          
          )
        
        2
      
      
        
          snorm
          1
        
        ·
        
          snorm
          2
        
      
    
  




  
    
      snorm
      1
    
    =
    
      
        
          (
          
            
              x
              s
            
            -
            
              x
              i
            
          
          )
        
        2
      
      +
      
        
          (
          
            
              y
              s
            
            -
            
              y
              i
            
          
          )
        
        2
      
    
  




  
    
      snorm
      2
    
    =
    
      
        
          (
          
            
              x
              f
            
            -
            
              x
              i
            
          
          )
        
        2
      
      +
      
        
          (
          
            
              y
              f
            
            -
            
              y
              i
            
          
          )
        
        2
      
    
  




  
    
      e
      x
    
    =
    
      
        x
        s
      
      -
      
        x
        f
      
    
  




  
    
      e
      y
    
    =
    
      
        y
        s
      
      -
      
        y
        f
      
    
  



where (xi, yi) is the center of a block (related to a vector) in the frame t−1, (xf , yf) is the position of the block at frame t computed by the local motion vector estimator, and (xs, ys) is the position estimated according to inter-frame parameters (λ1, θ1, Tx1, Ty1).
According to the error E1 (and E2), it sorts all Vd elements in increasing order and filters out a percentage with high error value. We call the remaining vectors (not filtered out) Vs. Starting from Vs values it computes the Least Squares estimation of the inter-frame transformation parameters (λ, θ, Tx, Ty).
A diagram describing how the Robust Estimation block works is shown in FIG. 19. The error measure E1 is the square Euclidean distance between estimated and measured motion vectors whereas E2 is the square of the cosine of the angle between them. Both E1 and E2 sometimes fail considering reliable vectors that differ really much with respect to the real frame motion. However, by combining them these evaluation errors are dramatically reduced.
Eventually, an error matrix is computed (see FIG. 15). For each Vpf element it is computed an error (Euclidean Distance) used to fill the Me error matrix. This metric is simple to compute and able to efficiently distinguish between vectors belonging to objects entering in the scene and vectors describing the scene movements. Usually Vpf(t) contains elements corresponding to blocks that were not present in Vpf(t−1). Hence some vectors have not an Me entry when they are considered in the History filter. In order to partially solve this problem, we propagate error vectors value to its neighborhood by simply copying each error value into its neighbors with no value associated. The algorithm is computed from left to right, from up to down as illustrated in FIG. 20.
FIG. 21 shows system diagram of an embodiment disclosed herein. In this embodiment and image capture device 2110 is shown as disposed on a first integrated circuit die 2115. This first integrated circuit die may be coupled to a second integrated circuit die 2120 that may include a processor 2125 and a memory 2126. In other embodiments, the first and second integrated circuit dies 2115 and 2120 as shown may be a single integrated circuit die. Further yet, any of the methods described herein may be embodied in a computer readable medium having computer executable instructions to be executed by various circuits and processors as described herein.
While the subject matter discussed herein is susceptible to various modifications and alternative constructions, certain illustrated embodiments thereof are shown in the drawings and have been described above in detail. It should be understood, however, that there is no intention to limit the claims to the specific forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents falling within the spirit and scope of the disclosure.

## Claims

1. A method for filtering a current image frame of a video sequence from spurious motion, comprising:
dividing the current image frame and a preceding image frame of the video sequence into overlapping blocks of pixels;
determining motion vectors for the blocks of the image frame;
determining inter-frame transformation parameters for the image frame based on the determined motion vectors;
filtering the determined motion vectors of current image frame, wherein the filtering comprises,
filtering historical motion vectors determined for the current image frame by determining a first group of motion vectors equal to the motion vectors determined for the preceding image frame and a second group of motion vectors other than motion vectors determined for the preceding image frame,
deleting some motion vectors of the first and second groups of motion vectors to generate first and second reduced sets of motion vectors,
combining the first and second reduced sets of motion vectors to obtain a combined set of motion vectors; and

generating a filtered current image frame based on the determined inter-frame transformation parameters and the combined set of motion vectors.

2. The method according to claim 1, wherein the motion vectors are determined by block matching and each of the blocks comprises a sub-set of pixels that are used only for the determination of the motion vectors.

3. The method according to claim 1, further comprising a sub-pixel determination of a minimum of a matching curve for a regular pattern comprised in the image frame.

4. The method according to claim 1, further comprising generating a histogram of determined motion vectors and applying a histogram filter to the determined combined set of motion vectors to find a highest peak in the histogram and to filter out motion vectors with a distance from the found highest peak that is larger than a predetermined threshold.

5. The method according to claim 2, wherein at least 32 pixels are used for the block matching and/or the size of the searching window in each direction is more than 5% of the dimension of the image frame in that direction and/or the number of blocks the image is divided into is at least 200.

6. The method according to claim 2, wherein each of the searching windows comprises 16×16, or 32×32, or 40×40 or 64×64 pixels and/or each of the blocks comprises 64×64, 96×96, or 112×112 or 160×160 pixels and/or overlapping regions of the blocks comprise 16×16, or 32×32, or 40×40 or 48×48 pixels.

7. The method according to claim 3, wherein the sub-pixel determination is based on an equation of a parabola.

8. The method according to claim 4, further comprising applying a history filter to motion vectors determined for a current image frame comprising determining a first set of motion vectors that are the same as motion vectors determined for a previous image frame and a second set of motion vectors that are not the same as motion vectors determined for the previous image frame, deleting some motion vectors of the first and second sets of motion vectors and combining the thus reduced sets of motion vectors to obtain a combined set of motion vectors and wherein the histogram filter is applied to the combined set of motion vectors.

9. The method according to claim 8, wherein the second set of motion vectors is reduced based on an error matrix for the previous image frame.

10. A image capture device, comprising:
an image receive circuit configured to divide a first image frame and a second image frame of a video sequence into overlapping blocks of pixels;
a calculation circuit configured to determine motion vectors for the blocks of the first image frame in relation to the second image frame and to determine inter-frame transformation parameters for the first image frame based on the determined motion vectors and based on filtering the determined motion vectors, the filtering comprising,
filtering historical motion vectors determined for the current image frame by determining a first group of motion vectors equal to the motion vectors determined for the preceding image frame and a second group of motion vectors other than motion vectors determined for the preceding age frame,
deleting some motion vectors of the first and second groups of motion vectors to generate first and second reduced sets of motion vectors,
combining the first and second reduced sets of motion vectors to obtain a combined set of motion vectors; and

an image generation circuit configured to generate a filtered image frame based on the determined inter-frame transformation parameters and the combined set of motion vectors; and
a memory configured to store the filtered image.

11. The image capture device of claim 10, further comprising:
a pre-filtering circuit configured to apply a high pass filter to received image frames.

12. The image capture device of claim 10, further comprising a local estimation circuit configured to compute motion vectors to be filtered prior to generation of the motion vectors in the calculation circuit.

13. The image capture device of claim 10, wherein the calculation block further comprises:
a memory filter configured to receive images frames and filter images frames based on a history of received image frames;
a histogram circuit coupled to the memory filter and configured to apply a histogram filter to image frames from the memory filter; and
an error matrix generator coupled to the histogram circuit and configured to generate an error matrix based on the histogram filtered image.

14. The image capture device of claim 10, a display for displaying the stored image.

15. The image capture device of claim 10, wherein the image capture device comprises a mobile video camera.

16. The image capture device of claim 13, wherein the histogram circuit is further configured to generate a histogram of determined motion vectors and apply a histogram filter to the determined motion vectors to find a highest peak in the histogram and to filter out motion vectors with a distance from the found highest peak that is larger than a threshold.

17. The image capture device of claim 16, wherein the histogram is further configured to apply a history filter to motion vectors determined for the first image frame such that determining a first set of motion vectors that are the same as motion vectors determined for a previous image frame and a second set of motion vectors that are not the same as motion vectors determined for the previous image frame, and further configured to delete some motion vectors of the first and second sets of motion vectors and combine the reduced sets of motion vectors to obtain a combined set of motion vectors.

18. The image capture device of claim 16, wherein the error matrix generator is further configured to reduce the second set of motion vectors in response to generating an error matrix based on the second image frame.

19. The image capture device of claim 16, wherein the motion vectors are determined by block matching and each of the blocks comprises a sub-set of pixels that are used only for the determination of the motion vectors.

20. An integrated circuit, comprising:
an image receive circuit configured to divide a first image frame and a second image frame of a video sequence into overlapping blocks of pixels;
a calculation circuit configured to determine motion vectors for the blocks of the first image frame in relation to the second image frame and to determine inter-frame transformation parameters for the first image frame based on the determined motion vectors and based on filtering the determined motion vectors, the filtering comprising,
filtering historical motion vectors determined for the current image frame by determining a first group of motion vectors equal to the motion vectors determined for the preceding image frame and a second group of motion vectors other than motion vectors determined for the proceeding image frame,
deleting some motion vectors of the first and second groups of motion vectors to generate first and second reduced sets of motion vectors,
combining the first and second reduced sets of motion vectors to obtain a combined set of motion vectors; and

an image generation circuit configured to generate a filtered image frame based on the determined inter-frame transformation parameters and the combined set of motion vectors.

21. The integrated circuit of claim 20, further comprising a single integrated circuit die.

22. The integrated circuit of claim 20, further comprising multiple integrated circuit dies.

23. A system, comprising:
a first integrated circuit die including:
an image receive circuit configured to divide a first image frame and a second image frame of a video sequence into overlapping blocks of pixels;
a calculation circuit configured to determine motion vectors for the blocks of the first image frame in relation to the second image frame and to determine inter-frame transformation parameters for the first image frame based on the determined motion vectors and based on filtering the determined motion vectors, the filtering comprising,
filtering historical motion vectors determined for the current image frame by determining a first group of motion vectors equal to the motion vectors determined for the preceding image frame and a second group of motion vectors other than motion vectors determined for the preceding image frame,
deleting some motion vectors of the first and second groups of motion vectors to generate first and second reduced sets of motion vectors,
combining the first and second reduced sets of motion vectors to obtain a combined set of motion vectors; and

an image generation circuit configured to generate a filtered image frame based on the determined inter-frame transformation parameters and the combined set of motion vectors; and
a second integrated circuit die coupled to the first integrated circuit die.

24. The system of claim 23, further comprising a processor disposed on one of the first and second integrated circuit dies.

25. The system of claim 23, further comprising a memory disposed on one of the first and second integrated circuit dies.

26. The system of claim 23, further comprising one of a mobile video capturing device, a digital video camera, a mobile phone, and a digital camera.

27. A non-transitory computer-readable medium having computer-executable instructions for:
dividing a first image frame and a second image frame of a video sequence into overlapping blocks of pixels;
determining motion vectors for the blocks of the first image frame in relation to the second image frame;
filtering the determined motion vectors;
determining inter-frame transformation parameters for the first image frame based on the determined motion vectors;
generating a filtered image frame based on the determined inter-frame transformation parameters; and
storing the filtered image in a memory;
generating a histogram of determined motion vectors and applying a histogram filter to the determined motion vectors to find a highest peak in the histogram and to filter out motion vectors with a distance from the found highest peak that is larger than a threshold;
applying a history filter to determined motion vectors;
determining a first set of motion vectors that are the same as motion vectors determined for a previous image frame;
determining a second set of motion vectors that are not the same as motion vectors determined for the previous image frame;
deleting some motion vectors of the first and second sets of motion vectors; and
combining reduced sets of motion vectors to obtain a combined set of motion vectors such that the histogram filter is applied to the combined set of motion vectors.

28. The computer-readable medium of claim 27, further comprising computer-executable instructions wherein the motion vectors are determined by block matching and each of the blocks comprises a sub-set of pixels that are used only for the determination of the motion vectors.

29. The computer-readable medium of claim 27, further comprising computer-executable instructions wherein each block comprises at least 32 pixels; the method further comprising generating a plurality of searching windows having a pixel size in each direction that is at least 5% of dimensions of the first image frame.

30. A method, comprising:
dividing a first image frame into overlapping blocks of pixels;
dividing a second image frame into corresponding overlapping blocks of pixels;
determining motion vectors for the blocks of the first image frame in relation to the second image frame;
filtering the determined motion vectors;
determining inter-frame transformation parameters for the first image frame based on the determined motion vectors;
generating a filtered image frame based on the determined inter-frame transformation parameters; and
storing the filtered image in a memory;
generating a histogram of determined motion vectors and applying a histogram filter to the determined motion vectors to find a highest peak in the histogram and to filter out motion vectors with a distance from the found highest peak that is larger than a threshold;
applying a history filter to determined motion vectors;
determining a first set of motion vectors that are the same as motion vectors determined for a previous image frame;
determining a second set of motion vectors that are not the same as motion vectors determined for the previous image frame;
deleting some motion vectors of the first and second sets of motion vectors; and
combining reduced sets of motion vectors to obtain a combined set of motion vectors such that the histogram filter is applied to the combined set of motion vectors.

31. The method of claim 30, wherein the motion vectors are determined by block matching and each of the blocks comprises a sub-set of pixels that are used only for the determination of the motion vectors.

32. The method of claim 30, wherein each of the searching windows comprises dimensions of one of 16×16, 32×32, 40×40 and 64×64 pixels and each of the blocks comprises dimensions of one of 64×64, 96×96, 112×112, and 160×160 pixels such that overlapping regions of the blocks comprise dimensions of one of 16×16, 32×32, 40×40 and 48×48 pixels.

33. The method of claim 30, further comprising a sub-pixel determination of a minimum of a matching curve for a regular pattern comprised in the first image frame.

34. The method of claim 31, wherein each block comprises at least 32 pixels; the method further comprising generating a plurality of searching windows having a pixel size in each direction that is at least 5% of dimensions of the first image frame.

35. The method of claim 33, wherein the sub-pixel determination is based on an equation of a parabola.