Skip to content

BilalSi20/Object-Tracking-Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Single Object Tracker (SOT) - OpenCV

This project aims to perform real-time object tracking using different Single Object Tracking (SOT) algorithms provided by OpenCV. The user selects the object to be tracked in the first frame captured from the camera, and tracking begins with the selected algorithm.

Project Features

  • Real-time object tracking with Python (OpenCV)
  • ROI (Region of Interest) selection from the user
  • Display of FPS and algorithm name on the screen
  • Warning message if tracking fails
  • Can run from camera or video file

Used SOT Algorithms

I have tested and experienced the following OpenCV SOT algorithms:

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

Usage

  1. Install the required packages:

    pip install opencv-contrib-python
    
  2. Run the Single Object Tracker.py file:

    python Single\ Object\ Tracker.py
    
  3. When the program starts, select the object you want to track and confirm.

  4. During tracking, the FPS and the selected algorithm name will be displayed on the screen.

  5. Press q to exit tracking.

Notes

  • You can change the algorithm by modifying the tracker_type variable in the code.
  • Make sure the opencv-contrib-python package is installed.
  • The performance of the algorithms may vary depending on your hardware and the characteristics of the object being tracked.

Multi-Object Tracking

This project also includes a simple real-time Multi-Object Tracker (MOT) using OpenCV’s built-in MultiTracker class. Users can press the s key during video playback to select and add multiple objects for tracking simultaneously. The tracker updates all bounding boxes frame by frame and displays them in real-time.

Features:

  • Track multiple objects using selected bounding boxes
  • Add new objects dynamically by pressing s and selecting a new ROI
  • Supports multiple OpenCV trackers (BOOSTING, MIL, KCF, TLD, etc.)
  • Displays tracking success or failure for each frame
  • Works with webcam or video input

You can change the tracker algorithm in the code by switching to: cv2.legacy.TrackerKCF_create(), cv2.legacy.TrackerCSRT_create() etc.

Example Key Commands:

  • Press s: Select and add a new object to track
  • Press q: Quit tracking and close the video window

About

Real-time single object tracking using OpenCV with multiple algorithms to test different algorithm success

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages