Skip to content

swhan0329/vehicle_speed_estimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vehicle Speed Estimation

Overview

This project uses the optical flow algorithm, specifically the Lucas-Kanade tracker, to estimate vehicle speeds from mono camera (CCTV) footage.

Prerequisites

  • Python 3.x
  • Required libraries: opencv-python, numpy

Setup

  1. Clone the Repository

    git clone https://github.com/swhan0329/vehicle_speed_estimation.git
    cd vehicle_speed_estimation
  2. Install Dependencies

    pip install -r requirements.txt

Usage

  1. With an Input Video

    python main.py [input video name]

    Replace [input video name] with the path to your video file.

  2. Without an Input Video The script will automatically use the webcam on your computer.

    python main.py

File Descriptions

  • 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.

Example

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

Additional Notes

  • 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.

Running Tests

Execute the unit tests with Python's built-in test runner:

python -m unittest discover -s tests

About

Vehicle speed estimation using the optical flow algorithm from a mono camera(CCTV)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages