neighbourhood_motion
template<int M,int N,class G> inline typename NeighbourhoodMotionArray<M,N,const Matrix<G> >::self
neighbourhood_motion(const Matrix<G> &X,const Matrix<G> &Y,int m,int n)
Motion Estimation with neigbourhood 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 |
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. Positive values mean displacement to the bottom, respectively to the right.
Remarks
The seach areas are not centered at the corresponding searched blocks, they are instead translated with previouly computed motion vectors of neighboor blocks (if already computed). 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 = neigbourhood_motion<8,8>(X,Y,16,16); // stores all motion vectors
See Also