How does KLT work in OpenCV?

ra bes picture ra bes · Sep 18, 2013 · Viewed 15.9k times · Source

I am curious about the logic behind KLT in openCV.

From what I have known so far, the images sent to find optical flow in OpenCV is firstly converted to grayscale.

What I am curious is that, when running the algorithm, we need set of features for computation. What are the features used in finding optical flow method in openCV?

Thank you :)

Answer

sgarizvi picture sgarizvi · Sep 18, 2013

There are 2 types of optical flow. Dense and sparse. Dense finds flow for all the pixels while sparse finds flow for the selected points.

The selected points may be user specified, or calculated automatically using any of the feature detectors available in OpenCV. Most common feature detectors include GoodFeaturesToTrack which finds corners using cornerHarris or cornerMinEigenVal

The feature list is then passed to the KLT Tracker calcOpticalFlowPyrLK.

Feature can be any point in the image. Most common features are corners and edges.