Click or drag to resize
CvInvokeCalcOpticalFlowPyrLK Method (IInputArray, IInputArray, IInputArray, IInputOutputArray, IOutputArray, IOutputArray, Size, Int32, MCvTermCriteria, LKFlowFlag, Double)
http://www.emgu.com
Implements sparse iterative version of Lucas-Kanade optical flow in pyramids ([Bouguet00]). It calculates coordinates of the feature points on the current video frame given their coordinates on the previous frame. The function finds the coordinates with sub-pixel accuracy.

Namespace: Emgu.CV
Assembly: Emgu.CV.World (in Emgu.CV.World.dll) Version: 3.1.0.2282 (3.1.0.2282)
Syntax
public static void CalcOpticalFlowPyrLK(
	IInputArray prevImg,
	IInputArray nextImg,
	IInputArray prevPts,
	IInputOutputArray nextPts,
	IOutputArray status,
	IOutputArray err,
	Size winSize,
	int maxLevel,
	MCvTermCriteria criteria,
	LKFlowFlag flags = LKFlowFlag.Default,
	double minEigThreshold = 0.0001
)

Parameters

prevImg
Type: Emgu.CVIInputArray
First frame, at time t.
nextImg
Type: Emgu.CVIInputArray
Second frame, at time t + dt .
prevPts
Type: Emgu.CVIInputArray
Array of points for which the flow needs to be found.
nextPts
Type: Emgu.CVIInputOutputArray
Array of 2D points containing calculated new positions of input
status
Type: Emgu.CVIOutputArray
Array. Every element of the array is set to 1 if the flow for the corresponding feature has been found, 0 otherwise.
err
Type: Emgu.CVIOutputArray
Array of double numbers containing difference between patches around the original and moved points. Optional parameter; can be NULL
winSize
Type: System.DrawingSize
Size of the search window of each pyramid level.
maxLevel
Type: SystemInt32
Maximal pyramid level number. If 0 , pyramids are not used (single level), if 1 , two levels are used, etc.
criteria
Type: Emgu.CV.StructureMCvTermCriteria
Specifies when the iteration process of finding the flow for each point on each pyramid level should be stopped.
flags (Optional)
Type: Emgu.CV.CvEnumLKFlowFlag
Miscellaneous flags
minEigThreshold (Optional)
Type: SystemDouble
the algorithm calculates the minimum eigen value of a 2x2 normal matrix of optical flow equations (this matrix is called a spatial gradient matrix in [Bouguet00]), divided by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding feature is filtered out and its flow is not processed, so it allows to remove bad points and get a performance boost.
Remarks
Both parameters prev_pyr and curr_pyr comply with the following rules: if the image pointer is 0, the function allocates the buffer internally, calculates the pyramid, and releases the buffer after processing. Otherwise, the function calculates the pyramid and stores it in the buffer unless the flag CV_LKFLOW_PYR_A[B]_READY is set. The image should be large enough to fit the Gaussian pyramid data. After the function call both pyramids are calculated and the readiness flag for the corresponding image can be set in the next call (i.e., typically, for all the image pairs except the very first one CV_LKFLOW_PYR_A_READY is set).
See Also