MATLAB File Help: cv.calcOpticalFlowPyrLK Index
cv.calcOpticalFlowPyrLK

Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids

nextPts = cv.calcOpticalFlowPyrLK(prevImg, nextImg, prevPts)
[nextPts, status, err] = cv.calcOpticalFlowPyrLK(...)
[...] = cv.calcOpticalFlowPyrLK(..., 'OptionName', optionValue, ...)

Input

Output

Options

The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See [Bouguet00]. The function is parallelized with the TBB library.

References

[Bouguet00]:

Jean-Yves Bouguet. "Pyramidal Implementation of the Lucas Kanade Feature Tracker. Description of the algorithm", Intel Corporation, 2001.

Example

prevIm = rgb2gray(imread('prev.jpg'));
nextIm = rgb2gray(imread('next.jpg'));
prevPts = cv.goodFeaturesToTrack(prevIm);
nextPts = cv.calcOpticalFlowPyrLK(prevIm, nextIm, prevPts);
See also