The next steps can be performed independently. From now on, we work with three images, one for each track/lane.
Applying a new perspective to linearize object detection. It makes tracking and speed calculation easier and more reliable.
Apply Foreground Mask to highlight pixels that have changed from previous frames.
Apply Eroded Mask to remove noise.
Apply Dilated Mask to highlight the vehicle/object
Apply convex hull to smooth edges.
In order to calculate the vehicle speed we use the center points and frame quantity.
git clone https://github.com/brochj/SpeedTCC.git
cd SpeedTCC
python -m venv .venv
source .venv/bin/activate
.venv\Scripts\activate.bat
.venv\Scripts\Activate.ps1
pip install -r requirements.txt