Book Image

Mastering OpenCV Android Application Programming

Book Image

Mastering OpenCV Android Application Programming

Overview of this book

Table of Contents (16 chapters)
Mastering OpenCV Android Application Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
6
Working with Image Alignment and Stitching
Index

The Kanade-Lucas-Tomasi tracker


Having seen local and global motion estimation, we will now take a look at object tracking. Tracking objects is one of the most important applications of computer vision. The Kanade-Lucas-Tomasi (KLT) tracker implements an optical flow to track objects in videos. The steps to implement the algorithm are explained as follows:

  1. Detect Harris corners in the first frame of the video.

  2. For each detected Harris corner, compute the motion between consecutive frames using the optical flow (translator) and local affine transformation (affine).

  3. Now link these motion vectors from frame-to-frame to track the corners.

  4. Generate new Harris corners after a specific number of frames (say, 10 to 20) to compensate for new points entering the scene or to discard the ones going out of the scene.

  5. Track the new and old Harris points.

Checking out the KLT tracker on OpenCV

As we have seen earlier, the KLT tracker is one of the best algorithms available to track objects in videos. For this...