Skip to content

bikz05/object-tracker

Repository files navigation

object-tracker

Image

Real-Time Object Tracker written in Python using dlib and OpenCV | Video 1 Video 2


Quick Links

Dependencies

Starting the code

Tracking can either be done using a live video from a webcam or using a video file.

Tracking using Video File

To run the code using a video file use the following command line argument --

python object-tracker-single.py -v <path-2-video-file>

For example, you can use the demo video provided with this code as --

python object-tracker-single.py -v demo-video-single.avi

Tracking using Live Video

To run the code using live video use the following command line argument --

python object-tracker-single.py -d <device-id>

For example, on most systems device id 0 is the webcam attached.

python object-tracker-single.py -v docs/demo-single-video.avi

Use the -l or `--dispLoc' command line option to display the locations of the tracked object as show below -

python object-tracker-single.py -v docs/demo-single-video.avi -l

NOTE -- If you want to do multi object tracking code, use the file object-tracker-multi.py instead of object-tracker-single.py. This is a hack to do multi-object tracking and hence the code slows down.

How to perform tracking

Once the code starts, it will start the video file or the live stream. To select the objects to be tracked, pause the video by pressing the p key.The next step is to create a bounding box around the object(s) to be tracked. Press the mouse to select the top-left pixel location of the object to be tracked and then release the mouse on the bottom-right location of the object to be tracked. Once, this is done press p to start the tracking. Also, if you want to discard the object, press the d key. In SINGLE OBJECT TRACKING MODE, you can only select one object but in MULTI OBJECT TRACKING MODE, you can select as many objects you want but at the cost of speed. Press esc anytime to gracefully quit the code.

About

Object Tracker written in Python using dlib and OpenCV

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages