- Description: This project is a vehicle tracking system using OpenCV and VOLOv5 designed to work with video streams or pre saved videos.
- This program is designed to detect a vehicle in a video stream and track it using OpenCV by subtracting the background and assigning groups of pixels to an object then given a unique ID. The coordinates are used to take a picture of the object and ask the YOLOv5 model to predict the object's class. If it is a vehicle the object is then tracked across the frame. If the vehicle moves enough the objects speed and direction is calculated and displayed on the frame as well as saved to a file. Direction is calculated using the length of a straight line from the objects center point at the beginning of detection, to the center point at the end of detection divided by the number of pixels per meter. Speed is calculated using the distance between the two points in space.
Beta 0.1 at night
Beta 0.1 during the day after some tuning
- Clone the repository:
git clone https://github.com/nathen418/Vehicle-Tracking-Using-OpenCV-and-VOLOv5
- Install the dependencies:
pip install -r requirements.txt
- Run the program:
python main.py
- Profit!
- To be a drop in solution to detect and track the passage of vehicles on a highway or other road with accuracy such that the operator can get useful data about traffic flow for use in other applications.
- Object ID, X position, Y position, Unix timestamp
- Nate Goldsborough: Personal Website
- Kunal Garg : Inspiration Repository
- GNU General Public License v3.0