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.
- 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."
-
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.
- 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.
- Language: Python 3.9+
- Computer Vision: OpenCV (Contrib)
- Math & Physics: NumPy (Matrix operations for EKF)
- Visualization: Matplotlib (Performance analysis)
The system addresses three critical tracking failures:
- Stiffness: Solved via Elastic Scaling.
- Glitches: Solved via Mahalanobis Gating.
- 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) |
-
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 -
Install Dependencies
pip install -r requirements.txt
-
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.
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.