motion
template<int M,int N,class G> inline typename MotionArray<M,N,const Matrix<G> >::self
motion(const Matrix<G> &X,const Matrix<G> &Y,int m,int n)
Motion Estimation
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. |
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. |
Returns
A matrix of indexes representing the motion estimation vectors of each MxN block of X. Motion vectors are in the range [-m/2 ... m/2-1] for vertical shifting and [-n/2...n/2-1] for horizontal shifting. Positive values mean displacement to the bottom, respectively to the right.
Remarks
The seach areas are centered at the corresponding searched blocks. Choose the size of search areas carefully in order to have fair computation time so as a fair motion estimation. SSE2 instuctions deal better for 16x16 and bigger 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 = motion<8,8>(X,Y,16,16); // stores all motion vectors cout << motion<8,8>(X,Y,32,32)(5,5) << endl; // computes only one motion vector, for block at position (5,5)
See Also
^neigbourhood_motion^, quad_motion