This is a rough estimation of traffic flow using OpenCV library. It was tested by Python 3.9 and OpenCV 4.0
Make sure you have installed the following requirements:
- Python3.9
- OpenCV 4.0
- numpy, imutils, argparse
git clone https://github.com/saeid-h/Traffic-Tracker.git
# If you do not have python3.9, install it.
# It might be working with other version of Python, but it's not tested before.
# Make virtual environment
virtualenv -p /usr/bin/python3.9 venv
# Activate the environment
source venv/bin/activate
pip install <libraries>
Try the main.py
python main.py --video-file $YOURVIDEO
You may turn off the layer by adding the following switches:
python main.py --video-file $YOURVIDEO --no-speed-check
python main.py --video-file $YOURVIDEO --no-heatmap
python main.py --video-file $YOURVIDEO --no-car-detection
There hyper paramers that you can change them:
--blur-window <int>
--threshold <int>
--object-area <int>
--invalid-length <int>
--dilation-kernel <int>
--dilation-iter <int>
--heatmap-threshold <int>
--speed-limit <int>
You may also download a sample video here