Optical Flow with OpenCV

From JoBaPedia
Revision as of 14:40, 9 May 2021 by Joachim (talk | contribs) (Created page with "= Optical Flow = == Resources == * https://learnopencv.com/optical-flow-in-opencv/ * https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html * https://github.com/s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Optical Flow

Resources

Install

To test python examples from the git repo directory learnopencv/Optical-Flow-in-OpenCV in a conda environment is easy

git clone https://github.com/spmallick/learnopencv.git
cd learnopencv/Optical-Flow-in-OpenCV/
conda create -n optical-flow
conda activate optical-flow
pip install -r reqirements.txt

To run the c++ examples is a bit more involved. The Opensuse packages of opencv do not include all prerequisites and you get an error:

fatal error: opencv2/optflow.hpp: No such file or directory

To get rid of this, use a self compiled version of opencv with contrib part

wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/master.zip
unzip opencv.zip
unzip opencv_contrib.zip
mkdir -p build && cd build
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules ../opencv-master
CMAKE_BUILD_PARALLEL_LEVEL=8 cmake --build .

Execute Examples