Skip to content

SamXavii902/KalmanFilter-Robot-Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

🎯 Adaptive Hybrid Tracking & Drone Control System

Python OpenCV Status

📖 Overview

This project implements a robust Hybrid Tracking System designed for mobile robotics and autonomous drone navigation. It fuses a fast correlation filter (CSRT) with a custom Adaptive Extended Kalman Filter (EKF) to solve common tracking failures like occlusion, scale variation, and sensor noise.

The system features a Virtual Drone Controller that autonomously follows the tracked subject in a 3D simulation environment, validating the stability of the estimated trajectory.

🚀 Key Features

1. Hybrid Vision Engine

  • Smart Object Learner: Automatically switches between Color Histogram Tracking (for vibrant objects) and Structural Tracking (for rigid bodies).
  • Elastic Box Smoothing: Uses Exponential Moving Average (EMA) to prevent bounding box jitter and "stiffness."

2. Advanced State Estimation (EKF)

  • Non-Linear Motion Model: Predicts complex robot trajectories ($x, y, \psi, v, \omega$).
  • Mahalanobis Gating: Acts as a "statistical bouncer," rejecting false positives and glitches (jumps > 9.0 sigma).
  • Adaptive Noise Scaling: Dynamically adjusts the Measurement Noise Matrix ($R$) based on tracking confidence.

3. Tactical Control Interface

  • Sci-Fi HUD: Real-time visualization of tracking error, control velocity, and system status.
  • Ghost Path Projection: Visualizes the EKF's future position prediction (1s horizon).
  • Virtual Drone: A PID-controlled drone simulation that chases the target to prove control loop stability.

🛠️ Technology Stack

  • Language: Python 3.9+
  • Computer Vision: OpenCV (Contrib)
  • Math & Physics: NumPy (Matrix operations for EKF)
  • Visualization: Matplotlib (Performance analysis)

📊 Performance Analysis

The system addresses three critical tracking failures:

  1. Stiffness: Solved via Elastic Scaling.
  2. Glitches: Solved via Mahalanobis Gating.
  3. Blindness: Solved via Adaptive Noise Scaling.
Metric Standard Tracker Hybrid EKF System
Occlusion Handling Fails immediately Coasts (Predicts Path)
Jitter (RMSE) High (>50px) Low (<10px)
FPS (CPU) ~25 FPS ~60+ FPS (Optimized)

🔧 Installation & Usage

  1. Clone the Repository

    git clone [https://github.com/SamXavii902/KalmanFilter-Robot-Tracker.git](https://github.com/SamXavii902/KalmanFilter-Robot-Tracker.git)
    cd KalmanFilter-Robot-Tracker
  2. Install Dependencies

    pip install -r requirements.txt
  3. Run the System

    python main.py
    • Draw a bounding box around the target and press SPACE to start tracking.
    • Use the sliders to tune the drone's control gains ($K_v$, $K_w$) in real-time.

📈 Results

The system generates a trajectory analysis report upon termination:

  • Green Line: Raw, noisy measurements.
  • Red Line: Smooth, EKF-filtered trajectory.

Project developed for the Advanced Digital Signal Processing (ADSP) coursework.

About

"A real-time hybrid tracking system fusing CSRT with an Adaptive Extended Kalman Filter (EKF) to track agile targets. Features a physics-based virtual drone controller and a 60 FPS multi-threaded telemetry HUD."

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages