Skip to content

🎯 Multiple object tracking algorithms (CSRT, KCF, MOSSE, MedianFlow, etc.) implemented with OpenCV. Includes demo scripts, comparison tool, and sample outputs.

License

Notifications You must be signed in to change notification settings

HeleenaRobert/object-tracking-opencv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 Object Tracking with OpenCV DNN

Object Tracking Banner

Python OpenCV License: MIT Made with Love By HeleenaRobert


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

✨ Key Features

  • πŸ“¦ 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

🏑 Folder Structure

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

πŸš€ How It Works

πŸ”Ή Single Tracker Demo

python main/intro_demo.py

πŸ”Ή Tracker-Specific Run

python trackers/csrt_tracker.py

πŸ”Ή Multi-Tracker Comparison

python main/comparison.py

Results will be saved inside the output/ folder as .mp4 videos.


πŸ“‹ Tracker Modules Available

  • BOOSTING
  • CSRT
  • KCF
  • MEDIANFLOW
  • MIL
  • MOSSE
  • TLD

All use OpenCV’s cv2.legacy API and run in real-time.


πŸ”’ Tracker Comparison Table

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


πŸ“¦ Installation

pip install -r requirements.txt

πŸ–Ό Output Examples

β€œFrom bounding boxes to beauty β€” watch your object come alive through tracking.” output_sample


Sample Demos (click to download)

πŸ‘‰ More demo videos are available in the output/ folder.


πŸ“„ License

MIT License Β© 2025 Heleena Robert.
You’re free to use, modify, and share with ❀️


πŸ‘©β€πŸ’» Author

Heleena Robert
GitHub

About

🎯 Multiple object tracking algorithms (CSRT, KCF, MOSSE, MedianFlow, etc.) implemented with OpenCV. Includes demo scripts, comparison tool, and sample outputs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages