|
%!s(int64=2) %!d(string=hai) anos | |
---|---|---|
.. | ||
algorithms | %!s(int64=4) %!d(string=hai) anos | |
videos | %!s(int64=4) %!d(string=hai) anos | |
README.md | %!s(int64=2) %!d(string=hai) anos | |
demo.py | %!s(int64=4) %!d(string=hai) anos | |
requirements.txt | %!s(int64=4) %!d(string=hai) anos |
This repository contains the code for Optical Flow in OpenCV (C++/Python) blogpost.
Before you start the demo of Optical Flow calculation, you need to create a virtual environment in your working directory and install the required libraries:
virtualenv -p python3.7 venv
source venv/bin/activate
pip install -r reqirements.txt
There is a demo lucas_kanade.py
script of Lucas-Kanade algorithm which can be run with this command:
python3 demo.py --algorithm lucaskanade --video_path videos/car.mp4
The wrapper of Dense Optical Flow algorithms dense_optical_flow.py
can run a couple of OpenCV's algorithm implementations:
python3 demo.py --algorithm lucaskanade_dense --video_path videos/people.mp4
python3 demo.py --algorithm farneback --video_path videos/people.mp4
python3 demo.py --algorithm rlof --video_path videos/people.mp4
Before you start the demo of Optical Flow calculation, you need to build the project:
cd algorithms
cmake .
make
There is a demo lucas_kanade.cpp
script of Lucas-Kanade algorithm which can be run with this command:
./OpticalFlow ../videos/car.mp4 lucaskanade
The wrapper of Dense Optical Flow algorithms dense_optical_flow.py
can run a couple of OpenCV's algorithm implementations:
./OpticalFlow ../videos/car.mp4 lucaskanade_dense
./OpticalFlow ../videos/car.mp4 farneback
./OpticalFlow ../videos/car.mp4 rlof
Want to become an expert in AI? AI Courses by OpenCV is a great place to start.