Abstract:
A method and apparatus for estimating motion and occlusion is disclosed. In one aspect, a method of estimating motion and occlusion between three or more frames in a video stream includes identifying a plurality of motion vector candidates for each of a forward direction and a backward direction, generating a plurality of candidate pairs, determining an energy for at least some of the plurality of candidate pairs using a processor by jointly evaluating the forward motion vector and the backward motion vector of at least some of the plurality of candidate pairs based on interframe difference, spatial motion correlation, temporal motion correlation, and spatial occlusion correlation, and estimating motion and occlusion between the three or more frames by selecting a candidate vector from the plurality of candidate vectors based on the determined energies.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
     The present application is a Continuation Application of U.S. application Ser. No. 11/813,464, filed Jan. 25, 2008, which application is a U.S. National Stage Application of PCT Application No. PCT/IE06/000001, filed Jan. 5, 2006, which application claims priority to Great Britain Application No. 0500174.8 filed Jan. 6, 2005, all of which are incorporated herein by reference. 
    
    
     BACKGROUND 
     The determination of motion from an image sequence is currently employed for a wide variety of tasks. For instance, in video coding the MPEG and H.261/2/3 standards employ motion information in order to efficiently compress image sequence data. The idea is that generally image content does not change substantially between frames in any interesting image sequence, excepting for motion. Thus if it were possible to transmit one frame at the start of a scene, and then simply send the motion information for subsequent frames instead of the actual picture material, then all the subsequent frames in that scene could be built at the receiver. The various MPEG and H.26x standards exploit this idea and in practice stipulate an allowable maximum amount of frames over which such motion compensated prediction is possible. It is because of video coding in particular that motion estimation has been widely studied and is of industrial importance. 
     Motion estimation is also useful for a number of video content retrieval tasks e.g. shot cut detection [6] and event detection [7]. It is also vital and heavily used for reconstructing missing images, deinterlacing, and performing sequence restoration tasks in general [20, 15]. 
     The Block Matching motion estimation algorithm is perhaps the most popular estimator and numerous variants have been proposed in the scientific [18, 3, 21, 10] and patent literature [19, 9, 17] from as early as 1988. The general idea is to assume that blocks of pixels (16×16 in the MPEG2 standard, and optionally 8×8 in the MPEG 4 standard) contain a single object moving with some simple and single motion. An exhaustive search in the previous and/or next frames for the best matching block of pixels of the same size, then yields the relevant motion vector. 
     Of course motion in an image sequence does not necessarily obey the block matching assumption. Typically at the boundaries of moving objects, blocks will contain two types of pixels. Some will be part of the moving object, while others will be part of another moving object or a stationary background. This situation is shown in  FIG. 1 . While this does not affect the use of block matching for video coding very much, it does have an implication for image manipulation e.g. restoration, deinterlacing, enhancement. In those applications processing blocks at motion boundaries without acknowledging the motion discontinuity causes poor image quality at the output sometimes giving the effect of dragging or tearing at moving object boundaries. One method for solving this problem is to split blocks at such boundaries e.g. as proposed in [8]. De Haan et al [17] propose an invention that also describes one such variant of that idea. 
     As early as 1981 [14, 13, 12] it was recognised that having a motion vector for every pixel in an image might overcome this problem. Various schemes have since then been proposed to do this based typically on some image gradient observations and the incorporation of the notion that motion in a local area of the image should be smooth in some sense. These are typically iterative methods and the result is a motion vector for every pixel in the image, yielding what is called the optical flow for an image. However, although estimating a vector for every pixel does overcome the problem somewhat, there is still no notion in determining optical flow of whether that pixel exists in future or previous frames i.e. there is no understanding of occlusion. 
     In some sense, occlusion estimation is related to allowing for motion discontinuities at the boundaries of moving objects. Since 1993 (Black et al [4]) this idea has been pursued in that way. Motion discontinuity estimation is now widely accepted to be a vital piece of information required to assist image manipulation tasks in general. For instance, in [11] an invention is described that uses a block splitting method to aid deinterlacing of video by extracting motion discontinuity information. 
     SUMMARY 
     This invention is novel in the following aspects: 
     It provides a single process for unifying the estimation of motion with the direct and explicit estimation of occlusion. (Unlike inventions [19, 9, 17] which are specifically targeted at motion (and not occlusion)). 
     It allows for motion information from any motion estimator (block matching or otherwise) to be refined to output motion and occlusion information. In the preferred embodiment a gradient based estimator is used. In [19] a refinement process is proposed which results only in motion information, and which uses block matching. None of the previous work proposes any such refinement idea. 
     It allows unimportant objects to be ignored in estimation. This is important particularly for the motion picture post production industry in which it is often the case that users will already know the position and extent of objects to be ignored. None of the previous work allows for this situation. 
     It allows the information to be created at pixel resolution. (Unlike inventions [19, 9, 17] which are specifically targeted at the block resolution). 
     It exploits a pyramid of successively coarser resolution images to allow for larger ranges of motion. None of the previous work incorporates this idea. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1 : The three frames n−1, n, n+1 are shown with a single square object translating across the images. Dark regions are shown in frame n (the current frame) which are occluded in frame n+1, and uncovered from frame n−1. It is this effect that the state s incorporates. The motion undergone by the object is also indicated as a vector in frame n−1 and frame n+1. This invention estimates and refines the motion from the current frame into the previous (n−1) and next (n+1) frames. 
         FIG. 2 : The three frames n−1, n, n+1 are shown together with their reduced size versions forming the multiresolution pyramid required. Motion estimation begins at level  2  in this case and then propagated and successively refined at each level until the final, original resolution level is processed and termination is achieved. 
         FIG. 3 : Two frames of 6×6 pixels are shown in which a central block of 5×5 pixels is being used for estimating motion. The sequence is the site indexing required (using raster scan) to create the vector z and gradient matrix G. Thus inter image differences are read out into z and gradients are read out into G. 
         FIG. 4 : The preferred overall motion estimation and motion/occlusion refinement process is shown. Block ( 3 ) is preferred but optional. 
         FIG. 5 : The relationship between the current site x and its neighbours p j :j=1:8 is shown. On the left a representative vector neighbourhood is shown, while on the right a representative occlusion state s neighbourhood is shown. The occlusion states are shown as circles that are either clear or dark indicating some value of s. This neighbourhood configuration is used in calculating the various spatial smoothness energies indicated in the description of this invention. 
         FIG. 6 : The two frames n, n+1 are shown, represented as 1-dimensional strips of 13 pixels for clarity. An object that is 4 pixels long (shown as a dark set of pixels) is moving by 2 pixels per frame. The use of the motion between n+1, n+2 to create a candidate for motion in the current frame n is shown. In effect, all the motion in n+1 is backprojected along their own directions and wherever they hit in the current frame n, a temporal candidate is found for that site. The example shows d n+1,n+2 (x) being backprojected to hit the site x−d n+1,n+2 (x). Of course it is unlikely that the hits will occur on the integer pixel grid, and in that case, the hit is assigned as a candidate to the nearest rounded pixel location. 
         FIG. 7 : Three frames n−1, n, n+1 are shown, represented as 1-dimensional strips of 13 pixels for clarity. An object that is 4 pixels long (shown as a dark set of pixels) is moving by 2 pixels per frame across the three frame sequence. The figure makes clear the relationship between pixel positions and the motion vectors d n,n−1 , . . . both forward and backward in time. The invention estimates d n,n+1 , d n,n−1  given all other motion information shown. The figure also indicates that the temporal prior compares d n,n−1 (x) with d n−1,n  at the displaced location x+d n,n+1 . These two vectors should match (be mirror reflections of each other) if no occlusion is occurring. The alternative prior configuration can also be identified in the figure as well. In that alternate case, d n,n+1  is compared with d n+1,n+2 . 
         FIG. 8 : An image of 5×7 pixels showing the sequence in which pixel sites are visited for estimating motion and occlusion using a checkerboard scan. 
     
    
    
     DETAILED DESCRIPTION 
     Define the current image under consideration as frame n, then the previous image is indexed with n−1 and the next with n+1. A pixel at a site h, k (i.e. column h, and row k) in frame n has a value that is denoted as I n  (h,k). This can also be expressed as I n  (x) where x=[h, k] is the position vector indicating a pixel at site h, k. To understand the outputs of the invention, it is sensible to state an initial image sequence model as follows.
 
 I   n ( x )= I   n−1 ( x+d   n,n−1 ( x ))+ e   n   b ( x )  (1)
 
 I   n ( x )= I   n+1 ( x+d   n,n+1 ( x ))+ e   n   f ( x )  (2)
 
     In the first equation, the current pixel I n (x) is shown to be the same as a pixel in the previous frame n−1 except at another location, and with some added noise e n   b (x). That location is x offset by the motion at that site d n,n−1 (x)=[d h , d k ]. Here d h  is the horizontal component of motion while d k  is the vertical. The second equation is the same except relating the current pixel to a pixel in the next frame. See  FIG. 7  for a clarifying illustration of the various vector terms used. 
     These two equations simply state that the current image can be created by rearranging the positions of pixels from the previous OR the next frames. They are the basis for all known block matching algorithms, and most known optical flow algorithms. In fact, the situation is more complicated than that. In some situations, an object will cover the current pixel in the next frame. Then equation (2) would not be valid because the current pixel will not exist in the next frame. Similarly, a pixel in the current frame may have been revealed by an object moving away from that site in the previous frame. In that case equation (1) becomes invalid. 
     The invention therefore estimates four quantities at each site x. The first two quantities are the forward and backward motion d n,n+1 (x), and d n,n−1 (x) respectively. The last two are occlusion indicators. These are two quantities O b (x), O f (x) which indicate the extent to which the site x is covered or revealed in the next, or, from the previous frames. They have a maximum value of 1 and a minimum value of 0. Being set to 1 indicates that the pixel does NOT exist in the relevant frame, while set to 0 means that the pixel DOES exist in the relevant frame. When O b  is set to 1 for instance, this means that the pixel does not exist in the previous frame. When O f  is set to 1, this means that the pixel does not exist in the next frame. These quantities are therefore indicators of occlusion, value close to one indicate occluded pixels, while close to zero indicate valid motion. In the preferred embodiment of this invention these indicators are binary, however this need not be the case.  FIG. 1  explains how occlusion occurs in a sequence. 
     For simplicity at each site the two occlusion variables can be combined into a single variable s=O b , O f . This state variable s can be interpreted as follows.
         s=00: There is no occlusion in either the previous or next frames and so both equations for motion, (1) and (2), are valid and the pixel exists in all frames.   s=10: There IS occlusion in the previous frame and so the pixel only exists in the current and next frames. Only equation (2) is valid.   s=01: There IS occlusion in the next frame and so the pixel only exists in the current and previous frames. The equation (1) is valid.   s=11: There IS occlusion in both next and previous frames. This cannot be true in any normally behaving image sequence. For it to occur there must be something wrong with the image data. A classic case occurs when the current image data is missing, e.g. due to digital data dropout in transmission or image damage in film (blotches and line scratches [15]).       

     In order to handle large values of motion and to improve the convergence of the overall process it is preferable to operate on a multiresolution basis. Therefore firstly, for each image I n−1 , I n , I n+1 , a pyramid of L images are created by low pass filtering and then downsampling the original image L times. This is shown as block ( 1 ) in the overall process in  FIG. 3 . Thus for image I n  for instance, of size M×N rows and columns, successively smaller images are created of size (M/2)×(N/2), (M/4)×(N/4), (M/8)×(N/8) and so on, up to (M/(2 L ))×(N/(2 L )). This situation is illustrated in  FIG. 1 . The preferred low pass filter is a separable Gaussian filter with a size of P taps. The filter coefficients g[h] are given by the equation below 
     
       
         
           
             
               
                 
                   
                     g 
                     ⁡ 
                     
                       [ 
                       h 
                       ] 
                     
                   
                   = 
                   
                     exp 
                     - 
                     
                       ( 
                       
                         
                           
                             ( 
                             
                               h 
                               - 
                               
                                 ( 
                                 
                                   P 
                                   / 
                                   2 
                                 
                                 ) 
                               
                             
                             ) 
                           
                           2 
                         
                         
                           2 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             σ 
                             g 
                             2 
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
     and the parameters of the filter are P and σ g   2 . h refers to one the P filter taps with range 0 . . . P−1. σ g   2  controls the amount of smoothing. Larger values yield more smoothing. In this invention values of σ g   2 =1.5 2 , and P=9 are preferred. Note that g[h] is normalised before use as a filter, so that Σ h=0   h=8  g[h]=1. The motion estimation and refinement process then begins at the coarsest level L. Level  0  is the original resolution image. Then estimates are propagated and refined at successively higher resolutions until the final output at level  0  results. 
     1.1 Initialisation 
     The invention takes as input a set of motion vectors from any previous motion estimation step. These vectors may be specified on either a block basis or a pixel basis. In a preferred embodiment a gradient based block motion estimator is used. This step is indicated as block ( 2 ) in the overall process in  FIG. 3 . 
     For this part the invention uses mathematical methods described in ?. Given a block size of B×B pixels, and an initial estimate for motion d 0  (which may be zero), the goal is to update the initial estimate to generate the correct motion d. It is possible to estimate that update u such that d=d 0 +u. The subscripts • n,n−1  etc are dropped for simplicity. Consider equation (1) (the situation is the same for the forward motion in equation (2)). This equation can be linearised by substituting for u and expanding the right hand term I n−1 (x+d(x)) as a Taylor series about d 0 . The linearised equation at each pixel site can be collected for the entire block to yield the following solution. 
     
       
         
           
             
               
                 
                   u 
                   = 
                   
                     
                       
                         [ 
                         
                           
                             
                               G 
                               T 
                             
                             ⁢ 
                             G 
                           
                           + 
                           
                             μ 
                             ⁡ 
                             
                               [ 
                               
                                 
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                 
                                 
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                 
                               
                               ] 
                             
                           
                         
                         ] 
                       
                       
                         - 
                         1 
                       
                     
                     ⁢ 
                     
                       G 
                       T 
                     
                     ⁢ 
                     z 
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
     z is a vector (of size) that collects displaced pixel differences at each pixel site in the block scanned in a raster fashion as follows 
     
       
         
           
             
               
                 
                   z 
                   = 
                   
                     [ 
                     
                       
                         
                           
                             
                               
                                 I 
                                 n 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   x 
                                   1 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 I 
                                 
                                   n 
                                   - 
                                   1 
                                 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     x 
                                     1 
                                   
                                   + 
                                   
                                     d 
                                     0 
                                   
                                 
                                 ) 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               
                                 I 
                                 n 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   x 
                                   2 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 I 
                                 
                                   n 
                                   - 
                                   1 
                                 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     x 
                                     2 
                                   
                                   + 
                                   
                                     d 
                                     0 
                                   
                                 
                                 ) 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               
                                 I 
                                 n 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   x 
                                   3 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 I 
                                 
                                   n 
                                   - 
                                   1 
                                 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     x 
                                     3 
                                   
                                   + 
                                   
                                     d 
                                     0 
                                   
                                 
                                 ) 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               
                                 I 
                                 n 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   x 
                                   4 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 I 
                                 
                                   n 
                                   - 
                                   1 
                                 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     x 
                                     4 
                                   
                                   + 
                                   
                                     d 
                                     0 
                                   
                                 
                                 ) 
                               
                             
                           
                         
                       
                       
                         
                           ⋮ 
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
           
         
       
     
     G is a matrix (of size B 2 ×2) containing the horizontal g x (•) and vertical gradients g y (•) at each pixel site in the block (in the frame n−1) scanned in a raster scan fashion. These gradients are estimated using pixel differencing, thus g x (h,k)=0.5(I n−1 (h+1, k)−I n−1 (h−1, k)) and g y (h,k)=0.5(I n−1 (h, k+1)−I n−1 (h, k−1)). The matrix is then defined as follows. 
     
       
         
           
             
               
                 
                   z 
                   = 
                   
                     [ 
                     
                       
                         
                           
                             
                               g 
                               x 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 1 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               g 
                               y 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 1 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           
                             
                               g 
                               x 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 2 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               g 
                               y 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 2 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           
                             
                               g 
                               x 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 3 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               g 
                               y 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 3 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           
                             
                               g 
                               x 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 4 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               g 
                               y 
                             
                             ⁡ 
                             
                               ( 
                               
                                 x 
                                 4 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           ⋮ 
                         
                         
                           
                               
                           
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
           
         
       
     
     In [2], μ is related to the noise e(•) in equation 1. In this invention it is configured differently as disclosed 
     The sequence for scanning measurements to create z and G is shown in  FIG. 3 . 
     In practice, one iteration is not enough to update the initial estimate to the correct motion d. Instead, the update is used to create a new estimate d=u+d 0  and that in turn is recursively used as the new initial estimate for further updating. The process is therefore iterative, and converges to a solution after a certain number of iterations T. The recursive procedure is terminated when any one of the following stopping criterion is true
         Iterations exceed the maximum allowed. T max =20 is preferred.   The sum squared prediction error ∥z∥=z T z is below a threshold z t . Two options are preferred for setting this threshold, z t =B 2 ×4 works for many applications, and also the threshold can be estimated adaptively (disclosed later). This adaptivity has not been presented previously.   There is no significant gradient in the block under consideration in the previous frame.   ∥u∥&lt;u t , where u t =0.01 is preferred.       

     At each iteration, the new estimate for motion may be fractional. In that case bilinear interpolation is used to retrieve the pixels at the off grid locations in the previous frame. 
     1.1.1 Adaptivity for μ 
     The term μ is more correctly identified as a regularising term which makes G T G invertible and also controls the rate of convergence of the solution. In [5] a recipe for adapting μ to the conditioning of G T G is given and this is used in this invention. However, when G T G is ill conditioned, this may be a symptom of either low gradient, or there is a dominant edge in the block. It is well known that motion cannot be accurately estimated in the direction parallel to an edge. [5] does not address this issue. In [16] a recipe for addressing this problem is presented, however the solution there is not recursive and does not incorporate any of the good convergence properties of equation 4. By combining these ideas together, a new adaptation for μ can be proposed. 
     The essence of this new adaptation is to measure the ill-conditioning in G T G and then select either the regularised solution disclosed above, or use Singular Value Decomposition in the case of ill-conditioning. This is the adaptation used in this invention. Therefore, at each iteration the motion update is estimated as follows. 
     
       
         
           
             
               
                 
                   u 
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               α 
                               max 
                             
                             ⁢ 
                             
                               e 
                               max 
                             
                           
                         
                         
                           
                             
                               if 
                               ⁢ 
                               
                                 
                                     
                                 
                                 ⁢ 
                                 
                                     
                                 
                               
                               ⁢ 
                               
                                 
                                   λ 
                                   max 
                                 
                                 
                                   λ 
                                   min 
                                 
                               
                             
                             &gt; 
                             α 
                           
                         
                       
                       
                         
                           
                             
                               
                                 [ 
                                 
                                   
                                     
                                       G 
                                       T 
                                     
                                     ⁢ 
                                     G 
                                   
                                   + 
                                   
                                     μ 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     I 
                                   
                                 
                                 ] 
                               
                               
                                 - 
                                 1 
                               
                             
                             ⁢ 
                             
                               G 
                               T 
                             
                             ⁢ 
                             z 
                           
                         
                         
                           otherwise 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
             
               
                 
                   μ 
                   = 
                   
                     
                       
                          
                         z 
                          
                       
                       ⁢ 
                       
                         
                           λ 
                           max 
                         
                         
                           λ 
                           min 
                         
                       
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       if 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           λ 
                           max 
                         
                         
                           λ 
                           min 
                         
                       
                     
                     ≤ 
                     α 
                   
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
             
               
                 
                   
                     α 
                     max 
                   
                   = 
                   
                     
                       
                         e 
                         max 
                         T 
                       
                       
                         λ 
                         max 
                       
                     
                     ⁢ 
                     
                       G 
                       T 
                     
                     ⁢ 
                     z 
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
     λ max , λ min  are the max and min eigen values of G T G. e max   T  is the eigen vector corresponding to the eigen value λ max . α is a threshold on the allowable ill-conditioning in the matrix G T G. The preferred value is 100.0 f. It is α that allows the selection of the two different updating strategies. 
     Note that the same situation exists for forward and backward motion estimation. 
     1.1.2 Adaptive Choice for z t    
     The threshold z t  determines which blocks are detected to contain moving objects or not. Assuming that most of the image contains pixels that are not part of moving objects, then by calculating the interframe difference for no motion most of the sites can contribute to an estimate of z t . The steps are as follows to calculate z t  for estimating motion between the current and previous frame pair.
         1. Calculate ε(x)=[I n (x)−I n−1 (x)] 2  at each site x in frame n.   2. Create a histogram of these values using bins of 0 . . . 255 in unit steps.   3. Reject those sites constituting the upper P % of the histogram. P=60 is a suitable conservative value.   4. For those remaining sites calculate the mean value of ε(x), {circumflex over (ε)}.   5. Set z t =B 2 ×{circumflex over (ε)}       

     In this invention block sizes vary depending on the size of the image. For an image of size 1440×1152, the preferred B=16, for 720×576, B=9, for 360×288 B=9, for 144×288 B=5, and for all smaller resolutions the same. 
     1.1.3 Pixel Assignment 
     The previous steps result in a motion vector per image block. To initialise each pixel with a motion vector, the block vector has to be assigned to individual pixels. This is done for each block with the steps as below
         1. A set of 9 candidate vectors are selected for a block. These candidates are collected from the current block, and its eight nearest neighbours.   2. The candidates are then pruned to remove repeated vectors, or vectors which are within 0.1 pixels of each other in length. Denote the pruned candidate vector as v c  where there are C candidates in all.   3. For each pixel in the block, the prediction error for each candidate |I n (x)−I n−1 (x+v c )| is measured.   4. The vector candidate yielding the lowest prediction error is used as the assigned vector for this site.       

     The same process is used for forward motion assignment. Note that a simpler assignment process is to just repeat the block based vector for all pixels in the block. That idea does work, but sometimes results in more iterations required in the next and final step. The preferred process is the candidate selection disclosed here. This is shown as block ( 5 ) in the  FIG. 3 . 
     1.2 Motion and Occlusion Estimation 
     Given initial estimates for motion from any prior motion estimation step at a particular resolution level L, the task now is to incorporate new constraints in order to estimate the true motion information. Consider a single site x in frame n. It is required to estimate d n,n−1 , d n,n+1 , O b , O f  at that site. Note that the position argument has been dropped for simplicity. Proceeding in a probabilistic fashion, it is required to manipulate p(d n,n−1 , d n,n+1 , s|D − , S − , I n , I n−1 , I n+1 ). Here D − , S −  denote the state of the pixel sites in terms of motion and occlusion at the pixels in the neighbourhood of the size x, but NOT including the site x itself. This neighbourhood may also include pixels in the previous and next frames. In other words, it is required to manipulate the probability distribution of the unknowns (motion, occlusion) GIVEN the motion, occlusion data at the pixel sites around and image data in the current, previous and next frames. 
     Using Bayes&#39; theorem the p.d.f may be expressed as a combination of a likelihood and a number of priors which incorporate various known properties of motion and occlusion fields.
 
 p ( d   n,n−1   ,d   n,n+1   ,s|D   −   ,S   −   ,I   n   ,I   n−1   ,I   n+1 )∝ p ( I   n   ,I   n−1   ,I   n+1   |d   n,n−1   ,d   n,n+1   ,s )× p ( d   n,n−1   ,d   n,n+1   |D   − )× p ( s|S   − )  (9)
 
     To use this expression, suitable functional forms have to be designed for each of the terms above. These are disclosed below. 
     1.2.1 The Likelihood 
     The connection between the variables and the image data is given directly from equations (1), (2) and the statements about occlusion given earlier. The expression is as follows and assumes that e(x) is a sample from a Gaussian distribution with mean 0 and variance σ e   2 . 
     
       
         
           
             
               
                 
                   
                     p 
                     ⁡ 
                     
                       ( 
                       
                         
                           I 
                           n 
                         
                         , 
                         
                           I 
                           
                             n 
                             - 
                             1 
                           
                         
                         , 
                         
                           
                             I 
                             
                               n 
                               + 
                               1 
                             
                           
                           ❘ 
                           
                             d 
                             
                               n 
                               , 
                               
                                 n 
                                 - 
                                 1 
                               
                             
                           
                         
                         , 
                         
                           d 
                           
                             n 
                             , 
                             
                               n 
                               + 
                               1 
                             
                           
                         
                         , 
                         s 
                       
                       ) 
                     
                   
                   ∝ 
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
             
               
                 
                   
                       
                   
                   ⁢ 
                   
                     { 
                     
                       
                         
                           
                             exp 
                             - 
                             
                               ( 
                               
                                 
                                   
                                     
                                       [ 
                                       
                                         
                                           
                                             I 
                                             n 
                                           
                                           ⁡ 
                                           
                                             ( 
                                             x 
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             I 
                                             
                                               n 
                                               - 
                                               1 
                                             
                                           
                                           ⁡ 
                                           
                                             ( 
                                             
                                               x 
                                               + 
                                               
                                                 d 
                                                 
                                                   n 
                                                   , 
                                                   
                                                     n 
                                                     - 
                                                     1 
                                                   
                                                 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                     2 
                                   
                                   + 
                                   
                                     
                                       [ 
                                       
                                         
                                           
                                             I 
                                             n 
                                           
                                           ⁡ 
                                           
                                             ( 
                                             x 
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             I 
                                             
                                               n 
                                               + 
                                               1 
                                             
                                           
                                           ⁡ 
                                           
                                             ( 
                                             
                                               x 
                                               + 
                                               
                                                 d 
                                                 
                                                   n 
                                                   , 
                                                   
                                                     n 
                                                     + 
                                                     1 
                                                   
                                                 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                     2 
                                   
                                 
                                 
                                   2 
                                   ⁢ 
                                   
                                     σ 
                                     e 
                                     2 
                                   
                                 
                               
                               ) 
                             
                           
                         
                         
                           
                             s 
                             = 
                             00 
                           
                         
                       
                       
                         
                           
                             exp 
                             - 
                             
                               ( 
                               
                                 
                                   
                                     
                                       [ 
                                       
                                         
                                           
                                             I 
                                             n 
                                           
                                           ⁡ 
                                           
                                             ( 
                                             x 
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             I 
                                             
                                               n 
                                               - 
                                               1 
                                             
                                           
                                           ⁡ 
                                           
                                             ( 
                                             
                                               x 
                                               + 
                                               
                                                 d 
                                                 
                                                   n 
                                                   , 
                                                   
                                                     n 
                                                     - 
                                                     1 
                                                   
                                                 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                     2 
                                   
                                   
                                     2 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       σ 
                                       e 
                                       2 
                                     
                                   
                                 
                                 + 
                                 β 
                               
                               ) 
                             
                           
                         
                         
                           
                             s 
                             = 
                             01 
                           
                         
                       
                       
                         
                           
                             exp 
                             - 
                             
                               ( 
                               
                                 
                                   
                                     
                                       [ 
                                       
                                         
                                           
                                             I 
                                             n 
                                           
                                           ⁡ 
                                           
                                             ( 
                                             x 
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             I 
                                             
                                               n 
                                               + 
                                               1 
                                             
                                           
                                           ⁡ 
                                           
                                             ( 
                                             
                                               x 
                                               + 
                                               
                                                 d 
                                                 
                                                   n 
                                                   , 
                                                   
                                                     n 
                                                     + 
                                                     1 
                                                   
                                                 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                     2 
                                   
                                   
                                     2 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       σ 
                                       e 
                                       2 
                                     
                                   
                                 
                                 + 
                                 β 
                               
                               ) 
                             
                           
                         
                         
                           
                             s 
                             = 
                             10 
                           
                         
                       
                       
                         
                           
                             exp 
                             - 
                             
                               ( 
                               
                                 2 
                                 ⁢ 
                                 β 
                               
                               ) 
                             
                           
                         
                         
                           
                             s 
                             = 
                             11 
                           
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
     Here β acts as a hypothesis check on outliers in the gaussian distribution for the displaced pixel difference e(x). β=2.76 2  gives a 90% chance that occlusion will be selected when that error exceeds 2.76 2 ×2σ e   2 . 
     This expression encodes the notion that when there is no occlusion, the current and next or previous pixels, compensated for motion, should be similar. 
     1.2.2 Spatial Smoothness 
     The first piece of prior information to be encoded is the fact that in a local region of pixels, it is expected that the occlusion state s and the motion field d should be smooth. A Markov random field is used to encode this idea. The spatial smoothness prior for backward motion is the same as for forward motion and is as follows. 
     
       
         
           
             
               
                 
                   
                     p 
                     ⁡ 
                     
                       ( 
                       
                         
                           d 
                           
                             n 
                             , 
                             
                               n 
                               - 
                               1 
                             
                           
                         
                         ❘ 
                         
                           D 
                           - 
                         
                       
                       ) 
                     
                   
                   ∝ 
                   
                     exp 
                     - 
                     
                       ( 
                       
                         Λ 
                         ⁢ 
                         
                           
                             ∑ 
                             
                               
                                 
                                   p 
                                   j 
                                 
                                 ∈ 
                                 N 
                               
                               , 
                               
                                 j 
                                 = 
                                 
                                   1 
                                   : 
                                   8 
                                 
                               
                             
                             
                                 
                             
                           
                           ⁢ 
                           
                             
                               λ 
                               j 
                             
                             ⁢ 
                             
                               f 
                               ⁡ 
                               
                                 ( 
                                 
                                    
                                   
                                     
                                       d 
                                       
                                         n 
                                         , 
                                         
                                           n 
                                           - 
                                           1 
                                         
                                       
                                     
                                     - 
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             - 
                                             1 
                                           
                                         
                                       
                                       ⁡ 
                                       
                                         ( 
                                         
                                           p 
                                           j 
                                         
                                         ) 
                                       
                                     
                                   
                                    
                                 
                                 ) 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
           
         
       
     
     Here the vectors p j  are taken from the 8 nearest neighbour sites to x(N), the site under consideration. λ=1 for the neighbourhood sites on the vertical and the horizontal, and 1/√{square root over (2)} for the 4 diagonal neighbourhood sites. A controls the overall smoothness strength that is applied. Λ=2.0 is preferred. This prior essentially penalises the estimated motion from being significantly different from its neighbours. See  FIG. 5  for clarification of the spatial relationship between the current site x and its neighbourhood. 
     The function f(•) allows for motion discontinuities by encoding the idea that either the motion field is generally so smooth that the vectors are the same, but where they are different they are very different. Many different robust functions may be used here, e.g. Huber&#39;s function, Tukey&#39;s function. Here a simple robust function is preferred which is as follows 
               f   ⁡     (            d     n   ,     n   -   1         -       d     n   ,     n   -   1         ⁡     (     p   j     )              )       =     {                        d     n   ,     n   -   1         -       d     n   ,     n   -   1         ⁡     (     p   j     )                      for   ⁢           ⁢            d     n   ,     n   -   1         -       d     n   ,     n   -   1         ⁡     (     p   j     )                &lt;     v   t                 v   t         otherwise         ⁢     v   t       =   5     ,             
and |•| is the Euclidean distance between two vectors.
 
     In another alternate form for f(•) an explicit image edge detector may be used e.g. Canny or any zero crossing edge detector. When an edge is detected between a pair of vectors in the calculation above, the output is 0. In cases where there is no edge, the output is the usual Euclidean distance. This idea allows motion across an image edge to be independent, and assumes that motion edges are likely to occur at image edges. 
     In a similar way a spatial smoothness constraint on the occlusion field s can be configured as follows. 
     
       
         
           
             
               
                 
                   
                     p 
                     ⁡ 
                     
                       ( 
                       
                         s 
                         ❘ 
                         
                           
                             S 
                             - 
                           
                           ⁢ 
                           1 
                         
                       
                       ) 
                     
                   
                   ∝ 
                   
                     exp 
                     - 
                     
                       ( 
                       
                         Λ 
                         ⁢ 
                         
                           
                             ∑ 
                             
                               
                                 
                                   p 
                                   j 
                                 
                                 ∈ 
                                 N 
                               
                               , 
                               
                                 j 
                                 = 
                                 
                                   1 
                                   : 
                                   8 
                                 
                               
                             
                             
                                 
                             
                           
                           ⁢ 
                           
                             
                               λ 
                               j 
                             
                             ⁡ 
                             
                               ( 
                               
                                 s 
                                 ≠ 
                                 
                                   s 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       p 
                                       j 
                                     
                                     ) 
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   12 
                   ) 
                 
               
             
           
         
       
     
     In this case the occlusion configuration at the current site is encouraged to be similar to the configuration at sites in the neighbourhood. See  FIG. 5  for clarification of the spatial relationship between the current site x and its neighbourhood. 
     1.2.3 Temporal Smoothness 
     Another observation typically made about any motion in a real image sequence is that the motion is smooth in time, except when there is occlusion. See  FIG. 7  for a clarification. There are several ways to encode this notion mathematically. The simplest is to employ already existing estimates for motion in the previous and next frames as follows.
 
 P   t ( d   n,n−1   |D   − )∝
 
     
       
         
           
             
               
                 
                   { 
                   
                     
                       
                         
                           exp 
                           - 
                           
                             ( 
                             
                               
                                 1 
                                 
                                   2 
                                   ⁢ 
                                   
                                     σ 
                                     d 
                                     2 
                                   
                                 
                               
                               [ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   
                                      
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             - 
                                             1 
                                           
                                         
                                       
                                       + 
                                       
                                         
                                           d 
                                           
                                             
                                               n 
                                               - 
                                               1 
                                             
                                             , 
                                             n 
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             x 
                                             + 
                                             
                                               d 
                                               
                                                 n 
                                                 , 
                                                 
                                                   n 
                                                   - 
                                                   1 
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                      
                                   
                                   2 
                                 
                                 + 
                                 
                                   
                                      
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             + 
                                             1 
                                           
                                         
                                       
                                       + 
                                       
                                         
                                           d 
                                           
                                             
                                               n 
                                               + 
                                               1 
                                             
                                             , 
                                             n 
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             x 
                                             + 
                                             
                                               d 
                                               
                                                 n 
                                                 , 
                                                 
                                                   n 
                                                   + 
                                                   1 
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                      
                                   
                                   2 
                                 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           s 
                           = 
                           00 
                         
                       
                     
                     
                       
                         
                           exp 
                           - 
                           
                             ( 
                             
                               
                                 
                                   1 
                                   
                                     2 
                                     ⁢ 
                                     
                                       σ 
                                       d 
                                       2 
                                     
                                   
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                      
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             - 
                                             1 
                                           
                                         
                                       
                                       + 
                                       
                                         
                                           d 
                                           
                                             
                                               n 
                                               - 
                                               1 
                                             
                                             , 
                                             n 
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             x 
                                             + 
                                             
                                               d 
                                               
                                                 n 
                                                 , 
                                                 
                                                   n 
                                                   - 
                                                   1 
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                      
                                   
                                   2 
                                 
                               
                               + 
                               
                                 β 
                                 1 
                               
                             
                             ) 
                           
                         
                       
                       
                         
                           s 
                           = 
                           01 
                         
                       
                     
                     
                       
                         
                           exp 
                           - 
                           
                             ( 
                             
                               
                                 
                                   1 
                                   
                                     2 
                                     ⁢ 
                                     
                                       σ 
                                       d 
                                       2 
                                     
                                   
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                      
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             + 
                                             1 
                                           
                                         
                                       
                                       + 
                                       
                                         
                                           d 
                                           
                                             
                                               n 
                                               + 
                                               1 
                                             
                                             , 
                                             n 
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             x 
                                             + 
                                             
                                               d 
                                               
                                                 n 
                                                 , 
                                                 
                                                   n 
                                                   + 
                                                   1 
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                      
                                   
                                   2 
                                 
                               
                               + 
                               
                                 β 
                                 1 
                               
                             
                             ) 
                           
                         
                       
                       
                         
                           s 
                           = 
                           10 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   13 
                   ) 
                 
               
             
           
         
       
     
     This expression encourages vectors to agree between frames. Thus, provided there is no occlusion, the motion between n and n−1 for instance, should be the same as the motion between n−1 and n. The state s=11 is not allowed here. The temporal relationship between the motion vectors used here is indicated in  FIG. 7 . 
     This prior may be configured in another fashion by comparing d n,n−1  with d n−1,n−2  (and similar for d n,n+1 ) for brevity this is not explicitly stated here. However this alternate prior can be constructed by replacing d n−1,n  with d n−1,n−2  and replacing d n+1,n  with d n+1, n+2  in the expression above. In practice the expression above is preferred but there are situations in which the alternate expression may be suitable e.g. in the case where the current frame is missing for some reason. Typically β 1 =β, and σ d   2 =2.0. σ d   2  controls the match between motion that is expected in time. A large value tolerates very poor matches. 
     1.3 The Final Algorithm 
     The problem is highly non-linear. However, the key idea is to recognise that given existing estimates for motion, the correct motion estimate already exists somewhere in the image. This implies then that a solution can be generated by combining the Iterated Conditional Modes algorithm of Besag [1] with a candidate selection process. In essence, the final algorithm proceeds by selecting a subset of vectors from the surrounding region in time and space, then evaluating each of these vectors using the expression in equation 9 and combining it with occlusion. The candidate with the best probability is selected for the current site, and then the next site is visited. Since all the candidates are being substituted into the same expression, using the log probability removes the need to calculate exponentials. Furthermore, maximising probability is then the same as minimising the log probability, therefore the evaluation process is simplified extensively. This step is shown as block ( 6 ) in  FIG. 4 . 
     1. A set of initial candidates for motion are created by using the motion at the current site x and the 8 nearest neighbours. In addition another candidate can be generated by selecting the vector that occurs the most in a block of B 1 ×B 1  pixels around the current site. Here B 1 =64 is sensible. This yields 10 candidates. 
     Finally a set of additional candidates can be generated by projecting vectors from the previous or next frames into the current one. Thus vectors d n−1,n (x) can be mapped to become the candidate for forward motion at site x+d n−1,n (x) in frame n. Similarly for n−1. Of course using this projection idea implies that not all the sites in frame n get hit with the same number of temporal candidates. Nevertheless at most sites in n temporal candidates will result.  FIGS. 6 and 7  show this possibility. 
     This set of vectors (the initial 10 and the additional temporal candidates if they exist) is then pruned to remove repeated vectors, or those that are closer together than v 1  pixels in length. v 1 =0.1 is preferred. Two sets are generated v b   c  and v c   f  for backward and forward motion. 
     2. The candidate sets are combined to create candidate pairs. Thus if there are N b  backward and N f  forward candidates for motion, there are N c =N b ×N f  pairs of combinations. 
     3. With each of the N c  candidate pairs, there are 4 possibilities for occlusion states s. Thus 4N c  candidates are created by associating every candidate motion pair with 4 of the occlusion candidates. 
     4. For each candidate v c =[d n,n−1   c ,d n,n+1   c ,s c ] the following energies or log-probabilities are calculated. 
     
       
         
           
             
                 
             
             ⁢ 
             
               
                 
                   E 
                   1 
                 
                 ⁡ 
                 
                   ( 
                   
                     v 
                     c 
                   
                   ) 
                 
               
               = 
               
                 { 
                 
                   
                     
                       
                         
                           
                             
                               
                                 
                                   [ 
                                   
                                     
                                       
                                         I 
                                         n 
                                       
                                       ⁡ 
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                     - 
                                     
                                       
                                         I 
                                         
                                           n 
                                           - 
                                           1 
                                         
                                       
                                       ⁡ 
                                       
                                         ( 
                                         
                                           x 
                                           + 
                                           
                                             d 
                                             
                                               n 
                                               , 
                                               
                                                 n 
                                                 - 
                                                 1 
                                               
                                             
                                             c 
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                   ] 
                                 
                                 2 
                               
                               + 
                               
                                 
                                   [ 
                                   
                                     
                                       
                                         I 
                                         n 
                                       
                                       ⁡ 
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                     - 
                                     
                                       
                                         I 
                                         
                                           n 
                                           + 
                                           1 
                                         
                                       
                                       ⁡ 
                                       
                                         ( 
                                         
                                           x 
                                           + 
                                           
                                             d 
                                             
                                               n 
                                               , 
                                               
                                                 n 
                                                 + 
                                                 1 
                                               
                                             
                                             c 
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                   ] 
                                 
                                 2 
                               
                             
                             
                               2 
                               ⁢ 
                               
                                 σ 
                                 e 
                                 2 
                               
                             
                           
                         
                         
                           
                             
                               s 
                               c 
                             
                             = 
                             00 
                           
                         
                       
                       
                         
                           
                             
                               
                                 
                                   [ 
                                   
                                     
                                       
                                         I 
                                         n 
                                       
                                       ⁡ 
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                     - 
                                     
                                       
                                         I 
                                         
                                           n 
                                           - 
                                           1 
                                         
                                       
                                       ⁡ 
                                       
                                         ( 
                                         
                                           x 
                                           + 
                                           
                                             d 
                                             
                                               n 
                                               , 
                                               
                                                 n 
                                                 - 
                                                 1 
                                               
                                             
                                             c 
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                   ] 
                                 
                                 2 
                               
                               
                                 2 
                                 ⁢ 
                                 
                                   σ 
                                   e 
                                   2 
                                 
                               
                             
                             + 
                             β 
                           
                         
                         
                           
                             
                               s 
                               c 
                             
                             = 
                             01 
                           
                         
                       
                       
                         
                           
                             
                               
                                 
                                   [ 
                                   
                                     
                                       
                                         I 
                                         n 
                                       
                                       ⁡ 
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                     - 
                                     
                                       
                                         I 
                                         
                                           n 
                                           + 
                                           1 
                                         
                                       
                                       ⁡ 
                                       
                                         ( 
                                         
                                           x 
                                           + 
                                           
                                             d 
                                             
                                               n 
                                               , 
                                               
                                                 n 
                                                 + 
                                                 1 
                                               
                                             
                                             c 
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                   ] 
                                 
                                 2 
                               
                               
                                 2 
                                 ⁢ 
                                 
                                   σ 
                                   e 
                                   2 
                                 
                               
                             
                             + 
                             β 
                           
                         
                         
                           
                             
                               s 
                               c 
                             
                             = 
                             10 
                           
                         
                       
                       
                         
                           
                             2 
                             ⁢ 
                             β 
                           
                         
                         
                           
                             s 
                             = 
                             11 
                           
                         
                       
                     
                     ⁢ 
                     
                       
 
                     
                     ⁢ 
                     
                       
                         E 
                         2 
                       
                       ⁡ 
                       
                         ( 
                         
                           v 
                           c 
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       Λ 
                       ⁢ 
                       
                         
                           ∑ 
                           
                             
                               
                                 p 
                                 j 
                               
                               ∈ 
                               N 
                             
                             , 
                             
                               j 
                               = 
                               
                                 1 
                                 : 
                                 8 
                               
                             
                           
                           
                               
                           
                         
                         ⁢ 
                         
                           
                             λ 
                             j 
                           
                           ⁢ 
                           
                             f 
                             ⁡ 
                             
                               ( 
                               
                                  
                                 
                                   
                                     d 
                                     
                                       n 
                                       , 
                                       
                                         n 
                                         - 
                                         1 
                                       
                                     
                                     c 
                                   
                                   - 
                                   
                                     
                                       d 
                                       
                                         n 
                                         , 
                                         
                                           n 
                                           - 
                                           1 
                                         
                                       
                                     
                                     ⁡ 
                                     
                                       ( 
                                       
                                         p 
                                         j 
                                       
                                       ) 
                                     
                                   
                                 
                                  
                               
                               ) 
                             
                           
                         
                       
                     
                     + 
                     
                         
                       
                         
                           Λ 
                           ⁢ 
                           
                             
                               ∑ 
                               
                                 
                                   
                                     p 
                                     j 
                                   
                                   ∈ 
                                   N 
                                 
                                 , 
                                 
                                   j 
                                   = 
                                   
                                     1 
                                     : 
                                     8 
                                   
                                 
                               
                               
                                   
                               
                             
                             ⁢ 
                             
                               
                                 λ 
                                 j 
                               
                               ⁢ 
                               
                                 f 
                                 ⁡ 
                                 
                                   ( 
                                   
                                      
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             + 
                                             1 
                                           
                                         
                                         c 
                                       
                                       - 
                                       
                                         
                                           d 
                                           
                                             n 
                                             , 
                                             
                                               n 
                                               + 
                                               1 
                                             
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             p 
                                             j 
                                           
                                           ) 
                                         
                                       
                                     
                                      
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               
                                 
 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   E 
                                   3 
                                 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     v 
                                     c 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         = 
                         
                           Λ 
                           ⁢ 
                           
                             
                               ∑ 
                               
                                 
                                   
                                     p 
                                     j 
                                   
                                   ∈ 
                                   N 
                                 
                                 , 
                                 
                                   j 
                                   = 
                                   
                                     1 
                                     : 
                                     8 
                                   
                                 
                               
                               
                                   
                               
                             
                             ⁢ 
                             
                               
                                 λ 
                                 j 
                               
                               ( 
                               
                                 
                                   
                                     s 
                                     c 
                                   
                                   ≠ 
                                   
                                     
                                       s 
                                       ⁡ 
                                       
                                         ( 
                                         
                                           p 
                                           j 
                                         
                                         ) 
                                       
                                     
                                     ⁢ 
                                     
                                       
 
                                     
                                     ⁢ 
                                     
                                       
                                         E 
                                         4 
                                       
                                       ( 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         v 
                                         c 
                                       
                                       ) 
                                     
                                   
                                 
                                 = 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   { 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       
                                         
                                           
                                             
                                               1 
                                               
                                                 2 
                                                 ⁢ 
                                                 
                                                   σ 
                                                   d 
                                                   2 
                                                 
                                               
                                             
                                             ⁢ 
                                             
                                               
                                                  
                                                 
                                                   
                                                     d 
                                                     
                                                       n 
                                                       , 
                                                       
                                                         n 
                                                         - 
                                                         1 
                                                       
                                                     
                                                     c 
                                                   
                                                   + 
                                                   
                                                     
                                                       d 
                                                       
                                                         
                                                           n 
                                                           - 
                                                           1 
                                                         
                                                         , 
                                                         n 
                                                       
                                                     
                                                     ⁡ 
                                                     
                                                       ( 
                                                       
                                                         x 
                                                         + 
                                                         
                                                           d 
                                                           
                                                             n 
                                                             , 
                                                             
                                                             n 
                                                             - 
                                                             1 
                                                             
                                                           
                                                           c 
                                                         
                                                       
                                                       ) 
                                                     
                                                   
                                                 
                                                  
                                               
                                               2 
                                             
                                           
                                           + 
                                           
                                             
                                                
                                               
                                                 
                                                   d 
                                                   
                                                     n 
                                                     , 
                                                     
                                                       n 
                                                       + 
                                                       1 
                                                     
                                                   
                                                   c 
                                                 
                                                 + 
                                                 
                                                   
                                                     d 
                                                     
                                                       
                                                         n 
                                                         + 
                                                         1 
                                                       
                                                       , 
                                                       n 
                                                     
                                                   
                                                   ⁡ 
                                                   
                                                     ( 
                                                     
                                                       x 
                                                       + 
                                                       
                                                         d 
                                                         
                                                           n 
                                                           , 
                                                           
                                                             n 
                                                             + 
                                                             1 
                                                           
                                                         
                                                         c 
                                                       
                                                     
                                                     ) 
                                                   
                                                 
                                               
                                                
                                             
                                             2 
                                           
                                         
                                       
                                       
                                         
                                           s 
                                           = 
                                           00 
                                         
                                       
                                     
                                     
                                       
                                         
                                           
                                             
                                               1 
                                               
                                                 2 
                                                 ⁢ 
                                                 
                                                   σ 
                                                   d 
                                                   2 
                                                 
                                               
                                             
                                             ⁢ 
                                             
                                                 
                                             
                                             ⁢ 
                                             
                                               
                                                  
                                                 
                                                   
                                                     d 
                                                     
                                                       n 
                                                       , 
                                                       
                                                         n 
                                                         - 
                                                         1 
                                                       
                                                     
                                                     c 
                                                   
                                                   + 
                                                   
                                                     
                                                       d 
                                                       
                                                         
                                                           n 
                                                           - 
                                                           1 
                                                         
                                                         , 
                                                         n 
                                                       
                                                     
                                                     ⁡ 
                                                     
                                                       ( 
                                                       
                                                         x 
                                                         + 
                                                         
                                                           d 
                                                           
                                                             n 
                                                             , 
                                                             
                                                             n 
                                                             - 
                                                             1 
                                                             
                                                           
                                                           c 
                                                         
                                                       
                                                       ) 
                                                     
                                                   
                                                 
                                                  
                                               
                                               2 
                                             
                                           
                                           + 
                                           
                                             β 
                                             1 
                                           
                                         
                                       
                                       
                                         
                                           s 
                                           = 
                                           01 
                                         
                                       
                                     
                                     
                                       
                                         
                                           
                                             
                                               1 
                                               
                                                 2 
                                                 ⁢ 
                                                 
                                                   σ 
                                                   d 
                                                   2 
                                                 
                                               
                                             
                                             ⁢ 
                                             
                                                 
                                             
                                             ⁢ 
                                             
                                               
                                                  
                                                 
                                                   
                                                     d 
                                                     
                                                       n 
                                                       , 
                                                       
                                                         n 
                                                         + 
                                                         1 
                                                       
                                                     
                                                     c 
                                                   
                                                   + 
                                                   
                                                     
                                                       d 
                                                       
                                                         
                                                           n 
                                                           + 
                                                           1 
                                                         
                                                         , 
                                                         n 
                                                       
                                                     
                                                     ⁡ 
                                                     
                                                       ( 
                                                       
                                                         x 
                                                         + 
                                                         
                                                           d 
                                                           
                                                             n 
                                                             , 
                                                             
                                                             n 
                                                             + 
                                                             1 
                                                             
                                                           
                                                           c 
                                                         
                                                       
                                                       ) 
                                                     
                                                   
                                                 
                                                  
                                               
                                               2 
                                             
                                           
                                           + 
                                           
                                             β 
                                             1 
                                           
                                         
                                       
                                       
                                         
                                           s 
                                           = 
                                           10 
                                         
                                       
                                     
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
             
           
         
       
     
     5. The total energy is then calculated as E(v c )=E 1 (v c )+E 2 (v c )+E 3 (v c )+E 4 (v c ) 
     6. The configuration v c  that gives the least energy E(v c ) over all the candidates is selected as the solution at that site. 
     1.3.1 Iterations and Scanning 
     In practice a number of iterations of the algorithm above are used over the whole image. However, in each iteration over the image, it is advantageous to avoid scanning consecutive pixels. This would reuse neighbourhoods that overlap and it likely to propagate errors. Many alternative scan patterns can be used. A checkerboard scan pattern is preferred here. This is shown in  FIG. 8 . The process terminates when either there is no change of the vector and occlusion solution during an iteration anywhere in the image, or when the iterations exceed a maximum amount. 10 is a preferred maximum number of iterations. 
     In addition, and particularly for offline film postproduction and fluid flow tracking applications, multiple passes over the entire sequence are advantageous. These passes are useful particularly when the temporal smoothness prior as for instance specified in equation 13. 
     1.3.2 Multiresolution 
     This process is repeated at each image resolution level. To initialise motion and occlusion information at a level L given termination at level L−1 it is necessary to upsample the motion and occlusion field by a factor of 2. This is done by zero-order hold, i.e. at a site x in level L, the initial motion information comes from the site x/2 in level L−1, rounded to the nearest pixel. See  FIG. 2  for an indication of the multiresolution creation. This step is denoted block ( 4 ) in  FIG. 4 . 
     1.3.3 Blocks and Pixels 
     The algorithm described here can operate on either a block or pixel basis. All the pixel wise operations disclosed above can be implemented on a block basis instead. Vector differences are then calculated between vectors specified on a block rather than a pixel grid. It is further computationally attractive to postpone the pixel assignment step till the final resolution level L=0. In that case, occlusion information is ignored at previous levels (i.e. s=00 everywhere), and only estimated at level L=0. 
     This is the preferred configuration for this process. It is denoted block ( 3 ) in  FIG. 4 . 
     1.3.4 Ignoring User Specified Regions 
     In the postproduction community it is common to find a situation in which part of the image is known to contain content that is not important for motion estimation. This also occurs in MPEG4 in which for a certain object, the requirement is to estimate the motion of that object, ignoring the motion of the image material around it. In the postproduction scenario the requirement to ignore certain image regions arises particularly when views are to be interpolated between a given set of images representing different camera view angles, or taken at different times. A process called inbetweening. In that scenario it is sometimes necessary to estimate motion of different objects separately, and the user may specify the location of the object manually. In MPEG4 the notion is that each object should have its own associated motion that is compressed separately from the motion of the rest of the objects in the image. 
     In both cases the motion estimation problem is therefore accompanied by some kind of mask information. The mask is an image that is the same size as the images being handled. The values at pixels in the mask are set to 1 where the corresponding image pixel is to be considered and set to 0 where the image pixel is to be ignored. Denote this mask or weights image corresponding to frame n as W n . The value of the pixels in this image are at most 1 and at least 0. Their values may occupy a continuum of values inbetween or be binary. This weight information can be incorporated into the invention disclosed here in order to estimation motion and occlusion only for the user specified regions in the mask. 
     The modification required is to weight the interframe difference measurements in equations 10 and 13 using the values W n−1 , W n−1 , W n−1 . The weights therefore allow interframe differences to be ignored at mask boundaries, in which case the spatial motion and occlusion smoothness constraints will dominate. To be explicit, the energy evaluations disclosed above are replaced with the following. 
     
       
         
           
             
               
                 E 
                 1 
               
               ⁡ 
               
                 ( 
                 
                   v 
                   c 
                 
                 ) 
               
             
             = 
             
               { 
               
                 
                   
                     
                       
                         
                           
                             
                               
                                 
                                   w 
                                   n 
                                 
                                 ⁢ 
                                 
                                   
                                     
                                       w 
                                       
                                         n 
                                         - 
                                         1 
                                       
                                       ′ 
                                     
                                     ⁡ 
                                     
                                       [ 
                                       
                                         
                                           
                                             I 
                                             n 
                                           
                                           ⁡ 
                                           
                                             ( 
                                             x 
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             I 
                                             
                                               n 
                                               - 
                                               1 
                                             
                                           
                                           ⁡ 
                                           
                                             ( 
                                             
                                               x 
                                               + 
                                               
                                                 d 
                                                 
                                                   n 
                                                   , 
                                                   
                                                     n 
                                                     - 
                                                     1 
                                                   
                                                 
                                                 c 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                   
                                   2 
                                 
                               
                               + 
                               
                                 
                                   w 
                                   n 
                                 
                                 ⁢ 
                                 
                                   
                                     
                                       w 
                                       
                                         n 
                                         + 
                                         1 
                                       
                                       ′ 
                                     
                                     ⁡ 
                                     
                                       [ 
                                       
                                         
                                           
                                             I 
                                             n 
                                           
                                           ⁡ 
                                           
                                             ( 
                                             x 
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             I 
                                             
                                               n 
                                               + 
                                               1 
                                             
                                           
                                           ⁡ 
                                           
                                             ( 
                                             
                                               x 
                                               + 
                                               
                                                 d 
                                                 
                                                   n 
                                                   , 
                                                   
                                                     n 
                                                     + 
                                                     1 
                                                   
                                                 
                                                 c 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                       ] 
                                     
                                   
                                   2 
                                 
                               
                             
                             
                               2 
                               ⁢ 
                               
                                 σ 
                                 e 
                                 2 
                               
                             
                           
                           + 
                           
                             
                               β 
                               ⁡ 
                               
                                 ( 
                                 
                                   1 
                                   - 
                                   
                                     
                                       w 
                                       n 
                                     
                                     ⁢ 
                                     
                                       w 
                                       
                                         n 
                                         - 
                                         1 
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                             ′ 
                           
                           + 
                           
                             
                               β 
                               ⁡ 
                               
                                 ( 
                                 
                                   1 
                                   - 
                                   
                                     
                                       w 
                                       n 
                                     
                                     ⁢ 
                                     
                                       w 
                                       
                                         n 
                                         + 
                                         1 
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                             ′ 
                           
                         
                       
                       
                         
                           
                             s 
                             c 
                           
                           = 
                           00 
                         
                       
                     
                     
                       
                         
                           
                             
                               
                                 w 
                                 n 
                               
                               ⁢ 
                               
                                 
                                   
                                     w 
                                     
                                       n 
                                       - 
                                       1 
                                     
                                     ′ 
                                   
                                   ⁡ 
                                   
                                     [ 
                                     
                                       
                                         
                                           I 
                                           n 
                                         
                                         ⁡ 
                                         
                                           ( 
                                           x 
                                           ) 
                                         
                                       
                                       - 
                                       
                                         
                                           I 
                                           
                                             n 
                                             - 
                                             1 
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             x 
                                             + 
                                             
                                               d 
                                               
                                                 n 
                                                 , 
                                                 
                                                   n 
                                                   - 
                                                   1 
                                                 
                                               
                                               c 
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                     ] 
                                   
                                 
                                 2 
                               
                             
                             
                               2 
                               ⁢ 
                               
                                 σ 
                                 e 
                                 2 
                               
                             
                           
                           + 
                           
                             β 
                             ⁡ 
                             
                               ( 
                               
                                 2 
                                 - 
                                 
                                   
                                     w 
                                     n 
                                   
                                   ⁢ 
                                   
                                     w 
                                     
                                       n 
                                       - 
                                       1 
                                     
                                     ′ 
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           
                             s 
                             c 
                           
                           = 
                           01 
                         
                       
                     
                     
                       
                         
                           
                             
                               
                                 w 
                                 n 
                               
                               ⁢ 
                               
                                 
                                   
                                     w 
                                     
                                       n 
                                       + 
                                       1 
                                     
                                     ′ 
                                   
                                   ⁡ 
                                   
                                     [ 
                                     
                                       
                                         
                                           I 
                                           n 
                                         
                                         ⁡ 
                                         
                                           ( 
                                           x 
                                           ) 
                                         
                                       
                                       - 
                                       
                                         
                                           I 
                                           
                                             n 
                                             + 
                                             1 
                                           
                                         
                                         ⁡ 
                                         
                                           ( 
                                           
                                             x 
                                             + 
                                             
                                               d 
                                               
                                                 n 
                                                 , 
                                                 
                                                   n 
                                                   + 
                                                   1 
                                                 
                                               
                                               c 
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                     ] 
                                   
                                 
                                 2 
                               
                             
                             
                               2 
                               ⁢ 
                               
                                 σ 
                                 e 
                                 2 
                               
                             
                           
                           + 
                           
                             β 
                             ⁡ 
                             
                               ( 
                               
                                 2 
                                 - 
                                 
                                   
                                     w 
                                     n 
                                   
                                   ⁢ 
                                   
                                     w 
                                     
                                       n 
                                       + 
                                       1 
                                     
                                     ′ 
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           
                             s 
                             c 
                           
                           = 
                           10 
                         
                       
                     
                     
                       
                         
                           2 
                           ⁢ 
                           β 
                         
                       
                       
                         
                           s 
                           = 
                           11 
                         
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       E 
                       2 
                     
                     ⁡ 
                     
                       ( 
                       
                         v 
                         c 
                       
                       ) 
                     
                   
                 
                 = 
                 
                   
                     Λ 
                     ⁢ 
                     
                       
                         ∑ 
                         
                           
                             
                               p 
                               j 
                             
                             ∈ 
                             N 
                           
                           , 
                           
                             j 
                             = 
                             
                               1 
                               : 
                               8 
                             
                           
                         
                         
                             
                         
                       
                       ⁢ 
                       
                         
                           λ 
                           j 
                         
                         ⁢ 
                         
                           w 
                           n 
                         
                         ⁢ 
                         
                           
                             w 
                             n 
                           
                           ⁡ 
                           
                             ( 
                             
                               p 
                               j 
                             
                             ) 
                           
                         
                         ⁢ 
                         
                           f 
                           ⁡ 
                           
                             ( 
                             
                                
                               
                                 
                                   d 
                                   
                                     n 
                                     , 
                                     
                                       n 
                                       - 
                                       1 
                                     
                                   
                                   c 
                                 
                                 - 
                                 
                                   
                                     d 
                                     
                                       n 
                                       , 
                                       
                                         n 
                                         - 
                                         1 
                                       
                                     
                                   
                                   ⁡ 
                                   
                                     ( 
                                     
                                       p 
                                       j 
                                     
                                     ) 
                                   
                                 
                               
                                
                             
                             ) 
                           
                         
                       
                     
                   
                   + 
                   
                       
                     
                       
                         Λ 
                         ⁢ 
                         
                           
                             ∑ 
                             
                               
                                 
                                   p 
                                   j 
                                 
                                 ∈ 
                                 N 
                               
                               , 
                               
                                 j 
                                 = 
                                 
                                   1 
                                   : 
                                   8 
                                 
                               
                             
                             
                                 
                             
                           
                           ⁢ 
                           
                             
                               λ 
                               j 
                             
                             ⁢ 
                             
                               w 
                               n 
                             
                             ⁢ 
                             
                               
                                 w 
                                 n 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   p 
                                   j 
                                 
                                 ) 
                               
                             
                             ⁢ 
                             
                               f 
                               ⁡ 
                               
                                 ( 
                                 
                                    
                                   
                                     
                                       d 
                                       
                                         n 
                                         , 
                                         
                                           n 
                                           + 
                                           1 
                                         
                                       
                                       c 
                                     
                                     - 
                                     
                                       
                                         d 
                                         
                                           n 
                                           , 
                                           
                                             n 
                                             + 
                                             1 
                                           
                                         
                                       
                                       ⁡ 
                                       
                                         ( 
                                         
                                           p 
                                           j 
                                         
                                         ) 
                                       
                                     
                                   
                                    
                                 
                                 ) 
                               
                             
                             ⁢ 
                             
                               
 
                             
                             ⁢ 
                             
                               
                                 E 
                                 3 
                               
                               ⁡ 
                               
                                 ( 
                                 
                                   v 
                                   c 
                                 
                                 ) 
                               
                             
                           
                         
                       
                       = 
                       
                         
                           Λ 
                           ⁢ 
                           
                             
                               ∑ 
                               
                                 
                                   
                                     p 
                                     j 
                                   
                                   ∈ 
                                   N 
                                 
                                 , 
                                 
                                   j 
                                   = 
                                   
                                     1 
                                     : 
                                     8 
                                   
                                 
                               
                               
                                   
                               
                             
                             ⁢ 
                             
                               
                                 λ 
                                 j 
                               
                               ⁢ 
                               
                                 w 
                                 n 
                               
                               ⁢ 
                               
                                 
                                   w 
                                   n 
                                 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     p 
                                     j 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   
                                     s 
                                     c 
                                   
                                   ≠ 
                                   
                                     s 
                                     ⁡ 
                                     
                                       ( 
                                       
                                         p 
                                         j 
                                       
                                       ) 
                                     
                                   
                                 
                                 ) 
                               
                               ⁢ 
                               
                                 
 
                               
                               ⁢ 
                               
                                 
                                   E 
                                   4 
                                 
                                 ( 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   v 
                                   c 
                                 
                                 ) 
                               
                             
                           
                         
                         = 
                         
                             
                         
                         ⁢ 
                         
                           { 
                           
                               
                           
                           ⁢ 
                           
                             
                               
                                 
                                   
                                     
                                       1 
                                       
                                         2 
                                         ⁢ 
                                         
                                           σ 
                                           d 
                                           2 
                                         
                                       
                                     
                                     ⁢ 
                                     
                                       ( 
                                       
                                         
                                           
                                             w 
                                             n 
                                           
                                           ⁢ 
                                           
                                             w 
                                             
                                               n 
                                               - 
                                               1 
                                             
                                             ′ 
                                           
                                           ⁢ 
                                           
                                             
                                                
                                               
                                                 
                                                   d 
                                                   
                                                     n 
                                                     , 
                                                     
                                                       n 
                                                       - 
                                                       1 
                                                     
                                                   
                                                   c 
                                                 
                                                 + 
                                                 
                                                   
                                                     d 
                                                     
                                                       
                                                         n 
                                                         - 
                                                         1 
                                                       
                                                       , 
                                                       n 
                                                     
                                                   
                                                   ⁡ 
                                                   
                                                     ( 
                                                     
                                                       x 
                                                       + 
                                                       
                                                         d 
                                                         
                                                           n 
                                                           , 
                                                           
                                                             n 
                                                             - 
                                                             1 
                                                           
                                                         
                                                         c 
                                                       
                                                     
                                                     ) 
                                                   
                                                 
                                               
                                                
                                             
                                             2 
                                           
                                         
                                         + 
                                         
                                           
                                             w 
                                             n 
                                           
                                           ⁢ 
                                           
                                             w 
                                             
                                               n 
                                               + 
                                               1 
                                             
                                             ′ 
                                           
                                           ⁢ 
                                           
                                             
                                                
                                               
                                                 
                                                   d 
                                                   
                                                     n 
                                                     , 
                                                     
                                                       n 
                                                       + 
                                                       1 
                                                     
                                                   
                                                   c 
                                                 
                                                 + 
                                                 
                                                   
                                                     d 
                                                     
                                                       
                                                         n 
                                                         + 
                                                         1 
                                                       
                                                       , 
                                                       n 
                                                     
                                                   
                                                   ⁡ 
                                                   
                                                     ( 
                                                     
                                                       x 
                                                       + 
                                                       
                                                         d 
                                                         
                                                           n 
                                                           , 
                                                           
                                                             n 
                                                             + 
                                                             1 
                                                           
                                                         
                                                         c 
                                                       
                                                     
                                                     ) 
                                                   
                                                 
                                               
                                                
                                             
                                             2 
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                   + 
                                   
                                     
                                       
                                         β 
                                         ⁡ 
                                         
                                           ( 
                                           
                                             1 
                                             - 
                                             
                                               
                                                 w 
                                                 n 
                                               
                                               ⁢ 
                                               
                                                 w 
                                                 
                                                   n 
                                                   - 
                                                   1 
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                       ′ 
                                     
                                     ⁢ 
                                     
                                       
                                         β 
                                         ⁡ 
                                         
                                           ( 
                                           
                                             1 
                                             - 
                                             
                                               
                                                 w 
                                                 n 
                                               
                                               ⁢ 
                                               
                                                 w 
                                                 
                                                   n 
                                                   - 
                                                   1 
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                       ′ 
                                     
                                   
                                   + 
                                   
                                     
                                       β 
                                       ⁡ 
                                       
                                         ( 
                                         
                                           1 
                                           - 
                                           
                                             
                                               w 
                                               n 
                                             
                                             ⁢ 
                                             
                                               w 
                                               
                                                 n 
                                                 + 
                                                 1 
                                               
                                             
                                           
                                         
                                         ) 
                                       
                                     
                                     ′ 
                                   
                                 
                               
                               
                                 
                                   s 
                                   = 
                                   00 
                                 
                               
                             
                             
                               
                                 
                                   
                                     
                                       1 
                                       
                                         2 
                                         ⁢ 
                                         
                                           σ 
                                           d 
                                           2 
                                         
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       w 
                                       n 
                                     
                                     ⁢ 
                                     
                                       w 
                                       
                                         n 
                                         - 
                                         1 
                                       
                                       ′ 
                                     
                                     ⁢ 
                                     
                                       
                                          
                                         
                                           
                                             d 
                                             
                                               n 
                                               , 
                                               
                                                 n 
                                                 - 
                                                 1 
                                               
                                             
                                             c 
                                           
                                           + 
                                           
                                             
                                               d 
                                               
                                                 
                                                   n 
                                                   - 
                                                   1 
                                                 
                                                 , 
                                                 n 
                                               
                                             
                                             ⁡ 
                                             
                                               ( 
                                               
                                                 x 
                                                 + 
                                                 
                                                   d 
                                                   
                                                     n 
                                                     , 
                                                     
                                                       n 
                                                       - 
                                                       1 
                                                     
                                                   
                                                   c 
                                                 
                                               
                                               ) 
                                             
                                           
                                         
                                          
                                       
                                       2 
                                     
                                   
                                   + 
                                   
                                     
                                       β 
                                       1 
                                     
                                     ⁡ 
                                     
                                       ( 
                                       
                                         2 
                                         - 
                                         
                                           
                                             w 
                                             n 
                                           
                                           ⁢ 
                                           
                                             w 
                                             
                                               n 
                                               - 
                                               1 
                                             
                                             ′ 
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                               
                                 
                                   s 
                                   = 
                                   01 
                                 
                               
                             
                             
                               
                                 
                                   
                                     
                                       1 
                                       
                                         2 
                                         ⁢ 
                                         
                                           σ 
                                           d 
                                           2 
                                         
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       w 
                                       n 
                                     
                                     ⁢ 
                                     
                                       w 
                                       
                                         n 
                                         + 
                                         1 
                                       
                                       ′ 
                                     
                                     ⁢ 
                                     
                                       
                                          
                                         
                                           
                                             d 
                                             
                                               n 
                                               , 
                                               
                                                 n 
                                                 + 
                                                 1 
                                               
                                             
                                             c 
                                           
                                           + 
                                           
                                             
                                               d 
                                               
                                                 
                                                   n 
                                                   + 
                                                   1 
                                                 
                                                 , 
                                                 n 
                                               
                                             
                                             ⁡ 
                                             
                                               ( 
                                               
                                                 x 
                                                 + 
                                                 
                                                   d 
                                                   
                                                     n 
                                                     , 
                                                     
                                                       n 
                                                       + 
                                                       1 
                                                     
                                                   
                                                   c 
                                                 
                                               
                                               ) 
                                             
                                           
                                         
                                          
                                       
                                       2 
                                     
                                   
                                   + 
                                   
                                     
                                       β 
                                       1 
                                     
                                     ⁡ 
                                     
                                       ( 
                                       
                                         2 
                                         - 
                                         
                                           
                                             w 
                                             n 
                                           
                                           ⁢ 
                                           
                                             w 
                                             
                                               n 
                                               + 
                                               1 
                                             
                                             ′ 
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                               
                                 
                                   s 
                                   = 
                                   10 
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
             
           
         
       
     
     Here w′ n−1 =w n−1 (x+d n,n−1   c ), and w′ n,n−1 =w n+1 (x+d n,n+1   c ). In other words, (•)′ indicates motion compensation in the previous or next frame. 
     Note again that w n  need not contain binary values only. 
     1.4 Hardware Implementation 
     This process can be implemented in hardware using FPGA arrays, and a CPU controller. More interestingly, recognise that it is the interframe differences and intervector differences that consume most of the compute activity in this process. The Graphics Processing Unit (GPU) in a general purpose PC can perform such operations at a much higher rate than the CPU. To exploit the GPU, it is required to export to the GPU memory the image frames, the current motion vector fields, and occlusion information. This data can be held in p-buffers on the GPU. Computational efficiency is achieved by exploiting the checkerboard scan at each iteration of the process. Consider  FIG. 8 . Pixels  1 ,  2 ,  3 ,  4 ,  5 ,  6  can all be processed at the same time since the energy calculations there employ independent and non-overlapping spatial information. After that is done, the other interleaved checkerboard  7 ,  8 ,  9 ,  10  of sites can then be processed simultaneously, and so on. This kind of parallel operation is possible on the GPU by exploiting the vertex and fragment programming facility built into the GPU cores by manufacturers such as ATI and NVIDIA.