|
2 anni fa | |
---|---|---|
.. | ||
algorithms | 4 anni fa | |
videos | 4 anni fa | |
README.md | 2 anni fa | |
demo.py | 4 anni fa | |
requirements.txt | 4 anni fa |
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.