Track objects in real-time using multiple OpenCV legacy trackers.
This project demonstrates object tracking through a layered approach:
- A basic single-tracker demo
- Tracker-specific test modules
- Side-by-side multi-tracker comparison
- π¦ Modular tracker scripts (CSRT, KCF, BOOSTING, etc.)
- π₯ Video output with bounding boxes & FPS overlays
- π Visual comparison of tracker performance
- βοΈ Easy to extend with new videos or trackers
object-tracking-opencv/
β
βββ assets/
β βββ banner.png
β βββ sample_output.png
β
βββ main/ # Initial Demo & Tracker Comparison
β βββ intro_demo.py
β βββ comparison.py
β
βββ trackers/ # Different types of trackers
β βββ boosting_tracker.py
β βββ csrt_tracker.py
β βββ kcf_tracker.py
β βββ medianflow_tracker.py
β βββ mil_tracker.py
β βββ mosse_tracker.py
β βββ tld_tracker.py
β
βββ utils/
β βββ helper_functions.py
β
βββ input/ β place input .mp4 videos here
β βββ race_car.mp4
β
βββ output/ β auto-saves results
β βββ comparison_output.mp4 (More demo videos are available inside this folder)
β βββ kcf_output.mp4
β
βββ requirements.txt
βββ .gitignore
βββ LICENSE
βββ README.md
python main/intro_demo.py
python trackers/csrt_tracker.py
python main/comparison.py
Results will be saved inside the output/
folder as .mp4
videos.
- BOOSTING
- CSRT
- KCF
- MEDIANFLOW
- MIL
- MOSSE
- TLD
All use OpenCVβs cv2.legacy
API and run in real-time.
Tracker | π Speed | π― Accuracy | βοΈ Robustness | π Best For | Notes |
---|---|---|---|---|---|
BOOSTING | π Slow | π΄ Low | π΄ Weak | Basic demos, low-demand tasks | Based on AdaBoost; outdated |
MIL | π‘ Medium | π‘ Medium | π‘ Okay | Less jittery than BOOSTING | Handles occlusion better than BOOSTING |
KCF | π’ Fast | π’ Good | π Not for scale changes | High-speed, consistent tracking | Efficient but fails on scale/rotation |
TLD | π΄ Very Slow | π‘ Medium | π Fragile | Academic experiments | Learns online, prone to drift |
MEDIANFLOW | π‘ Medium | π’ High | π΄ Weak on occlusion | Short sequences with smooth motion | Fails on fast motion |
MOSSE | π’β‘ Fastest | π Lower | π Fragile | Real-time apps, fast motion | Great FPS, low robustness |
CSRT | π΄ Slowest | π’β Best | π’ Strong | High accuracy tasks, low-FPS OK | Most accurate, but slowest |
π Tracker comparison is based on documented benchmarks, developer experience, and OpenCV literature
pip install -r requirements.txt
βFrom bounding boxes to beauty β watch your object come alive through tracking.β
π More demo videos are available in the output/
folder.
MIT License Β© 2025 Heleena Robert.
Youβre free to use, modify, and share with β€οΈ
Heleena Robert
GitHub