This project uses the optical flow algorithm, specifically the Lucas-Kanade tracker, to estimate vehicle speeds from mono camera (CCTV) footage.
- Python 3.x
- Required libraries:
opencv-python
,numpy
-
Clone the Repository
git clone https://github.com/swhan0329/vehicle_speed_estimation.git cd vehicle_speed_estimation
-
Install Dependencies
pip install -r requirements.txt
-
With an Input Video
python main.py [input video name]
Replace
[input video name]
with the path to your video file. -
Without an Input Video The script will automatically use the webcam on your computer.
python main.py
- main.py: The main script to run the vehicle speed estimation.
- video.py: Contains functions to handle video input and processing.
- common.py: Includes common functions and utilities used across the project.
- tst_scene_render.py: Test and render scenes for visualization.
To run the speed estimation on a sample video:
python main.py sample_video.mp4
To use the webcam for live speed estimation:
python main.py
- Ensure that your video has a clear view of the road and vehicles for accurate speed estimation.
- Adjust parameters in
common.py
if needed to fit specific requirements or to improve performance.