Installing OpenCV 3.2.0 on Fedora 25

CEll, Fri 31 March 2017, Snippets

Fedora, OpenCV, Python

Install dependencies

sudo dnf install cmake-gui ffmpeg-devel libpng-devel libjpeg-turbo-devel jasper-devel libtiff-devel tbb-devel eigen3-devel

Clone the OpenCV repos

git clone && cd opencv && git checkout 3.2.0 && cd ..
git clone && cd opencv_contrib && git checkout 3.2.0 && cd ..

Configure the build

cd opencv
cmake-gui .

Set the build path to "build". Make sure WITH_FFMPEG is selected. Also set the OPENCV_EXTRA_MODULES_PATH to the path of opencv_contrib/modules directory. Click "Configure" followed by "Generate".

cd build
make -j8
sudo make install

Create a virtual environment and link the library

python3 -m venv venv
cd venv/lib/python3.5/site-packages
ln -s /usr/local/lib/python3.5/site-packages/

Test that the module is accessible

source venv/bin/activate
python -c "import cv2"