O'Reilly logo

Computer Vision with Python 3 by Saurabh Kapur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lucas Kanade Tracker (LK Tracker)

The LK Tracker works on the principle that the motion of objects in two consecutive images is approximately constant relative to the given object. Unlike for the KCF Tracker, for the LK Tracker, we will select the points to follow by extracting key points from a given image and we will only follow these key points in the given sequence of images. The reason we do this is--first, it makes the computation faster as we only have to worry about fewer points in the image. Second, tracking the key points in an image is similar to tracking the entire object because of the rigidity of the object.

The following code is an implementation of the LK Tracker:

import numpy as npimport cv2cap = cv2.VideoCapture(0)# params ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required