Skip to content

Implementation of Lucas-Kanade tracker algorithm to track a moving car, face of a baby and running Usain Bolt

Notifications You must be signed in to change notification settings

anubhavparas/lucas-kanade-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Optical Flow and object tracker using Lucas-Kanade Algorithm

The Lucas-Kanade method is used for optical flow estimation, to track desired features in a video. The project aims to implement the Lucas-Kanade (LK) template tracker.

  • The LK tracker that is implemented here is used to track:
    • A car moving on a road,
    • Face of a baby fighting with a dragon,
    • Usain Bolt running on a track, respectively in three video sequences.

Approach and Implementation:

  • To initialize the tracker a template is defined by drawing a bounding box around the object to be tracked in the first frame of the video.
  • For each of the subsequent frames the tracker updates an affine transform that warps the current frame so that the template in the first frame is aligned with the warped current frame.
  • At the core of the algorithm is a function affineLKtracker(img, tmp, rect, pprev).
  • This function gets as input a grayscale image of the current frame (img), the template image (tmp), the bounding box (rect) that marks the template region in tmp, and the parameters pprev of the previous warping.
  • The function iteratively (gradient descent) computes the new warping parameters pnew, and returns these parameters.
  • The algorithm computes the affine transformations from the template to every frame in the sequence and draws the bounding boxes of the rectangles warped from the first frame.
  • Elaborate explanation about the approach and the pipeline can be found in the report

Output:

Tracking moving car (video here):

alt text

Tracking baby face (video here):

alt text

Tracking running Bolt (video here):

alt text

Instructions to run the code:

Input dataset required for the code is present in:

Go to directory: cd 'Code/

  • To run the car tracker run:

    • $ python trackCar.py
  • To run the baby face tracker run:

    • $ python trackBaby.py
  • To run the Bolt tracker run:

    • $ python trackBolt.py

References:

About

Implementation of Lucas-Kanade tracker algorithm to track a moving car, face of a baby and running Usain Bolt

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages