C++
C#
VB
JScript
All

# quad_motion

Copyright (C) 2005 IENT-RWTH Aachen

template<int M,int N,class G> inline typename QuadMotionArray<M,N,const Matrix<G> >::self
quad_motion(const Matrix<G> &X,const Matrix<G> &Y,int l,int m,int n )
template<int M,int N,class G> inline typename QuadMotionArray<M,N,const Matrix<G> >::self
quad_motion(const Matrix<G> &X,const Matrix<G> &Y,int l,int m,int n,int m0, int n0)

Motion Estimation with quad tree predictions

Parameters

X | The first image - Only images of unsigned char are currently accepted
Y | The second image - Only images of unsigned char are currently accepted
l | Number of layers (image layer excluded) The value 0 makes quad_motion equivalent to the motion function.
m | Height of search areas, has to be 8, 16, 32 or 64
n | Width of search areas, has to be 8, 16, 32 or 64
m0 | Height of search areas at first layer, has to be 8, 16, 32 or 64
n0 | Width of search areas at first layer, has to be 8, 16, 32 or 64

Returns

A matrix of indexes representing the motion estimation vectors of each MxN block of X. Positive values mean displacement to the bottom, respectively to the right.

Remarks

The seach areas are not centered at the corresponding searched blocks, their positions are instead recursively estimated from filtered and halfed images. Choose the size of search areas carefully in order to have fair computation time so as a fair motion estimation. Small areas are best for this recursive algorithm (8x8 or 16x16). SSE2 instuctions deal better for 16x16 search areas than MMX/SSE instructions.

Example

    typedef ucharImage::index_type index_type;
    RGBImage Image0=..., Image1=...;
    ucharImage X=first(value_cast<YUV>(Image0)); // Isolates the greyscale component (Y)
    ucharImage Y=first(value_cast<YUV>(Image1));
    DenseMatrix<index_type>::self M = quad_motion<8,8>(X,Y,2,8,8,16,16); // stores all motion vectors

See Also

motion, neighbourhood_motion