Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚗 Highway Vehicle Tracking System

Real-time vehicle detection and tracking using OpenCV and Computer Vision


Python OpenCV Status License


📖 Overview

This project demonstrates a real-time highway vehicle detection and tracking system using Computer Vision techniques.

The application processes highway video footage, detects moving vehicles using background subtraction, extracts the Region of Interest (ROI), and tracks every detected vehicle with a unique ID using the Euclidean Distance Tracking Algorithm.

This project showcases practical applications of Computer Vision in Intelligent Traffic Monitoring Systems (ITS).


🎯 Project Demo

🚘 Input Video

Watch the video


🚗 Vehicle Detection

Watch the video


🆔 Vehicle Tracking

Watch the video


✨ Features

  • 🎥 Reads highway video
  • 🚗 Detects moving vehicles
  • 🎯 Region of Interest (ROI) extraction
  • 📦 Draws bounding boxes around vehicles
  • 🆔 Assigns unique IDs to each vehicle
  • ⚡ Real-time multi-object tracking
  • 🖥️ Live visualization
  • 📊 Background subtraction using MOG2

🛠️ Tech Stack

Technology Purpose
Python Programming Language
OpenCV Image Processing
NumPy Numerical Operations
Background Subtractor MOG2 Vehicle Detection
Euclidean Distance Tracker Vehicle Tracking

📂 Project Structure

Highway-Vehicle-Tracking-System/
│
├── assets/
│   ├── input.gif
│   ├── output.gif
│   ├── screenshot1.png
│   └── screenshot2.png
│
├── src/
│   ├── main.py
│   ├── tracker.py
│   └── white_mask.py
│
├── videos/
│   ├── highway.mp4
│   └── output.mp4
│
├── requirements.txt
├── README.md
├── LICENSE
└── .gitignore

⚙️ Installation

Clone the repository

git clone https://github.com/yourusername/Highway-Vehicle-Tracking-System.git

Move into the project

cd Highway-Vehicle-Tracking-System

Install dependencies

pip install opencv-python numpy

▶️ Running the Project

Update the video path inside the script.

video_path = "videos/highway.mp4"

Run

python src/main.py

Press ESC to exit.


🧠 How It Works

Step 1 — Load Video

The system reads highway footage frame-by-frame.

⬇️

Step 2 — Region of Interest (ROI)

Only the road region is processed, reducing unnecessary computations.

⬇️

Step 3 — Background Subtraction

MOG2 removes the static background and extracts moving vehicles.

⬇️

Step 4 — Thresholding

Noise is removed and binary masks are generated.

⬇️

Step 5 — Contour Detection

Contours identify individual vehicle candidates.

⬇️

Step 6 — Vehicle Tracking

The Euclidean Distance Tracker assigns a unique ID to every detected vehicle and tracks its movement across frames.

⬇️

Step 7 — Visualization

Bounding boxes and IDs are drawn in real time.


📈 Applications

  • 🚦 Intelligent Traffic Monitoring
  • 🚓 Smart City Surveillance
  • 🚗 Vehicle Analytics
  • 🚧 Highway Monitoring
  • 🚘 Traffic Flow Analysis
  • 🚨 Traffic Violation Detection
  • 🅿️ Parking Management
  • 🚖 Autonomous Driving Research

🚀 Future Improvements

  • YOLOv8 Vehicle Detection
  • DeepSORT Tracking
  • Vehicle Counting
  • Vehicle Speed Estimation
  • Lane Detection
  • Traffic Density Analysis
  • Vehicle Classification
  • Number Plate Recognition (ANPR)
  • Streamlit Dashboard
  • Real-time Webcam Support

📊 Skills Demonstrated

  • Computer Vision
  • Object Detection
  • Multi-Object Tracking
  • Background Subtraction
  • OpenCV
  • Python
  • ROI Processing
  • Image Thresholding
  • Contour Detection

🤝 Contributing

Contributions are welcome!

Feel free to fork this repository, improve the project, and submit a pull request.


⭐ Support

If you found this project useful, consider giving it a Star ⭐.

It helps others discover the project and supports my learning journey in Computer Vision and Artificial Intelligence.

Releases

Packages

Contributors

Languages