download these packages to ~/opencv/
- opencv-3.3.1.zip
- opencv_contrib-3.3.1.zip
and execute commands below.
# 1. set up python virtual einvironment.
python3 -m venv tutorial
cd tutorial
source bin/activate
pip install numpy
# 2. install developer packages.
sudo dnf install cmake-gui ffmpeg-devel libpng-devel libjpeg-turbo-devel jasper-devel libtiff-devel tbb-devel eigen3-devel
# 3. build and install.
cd ~/opencv/
unzip opencv-3.3.1.zip opencv_contrib-3.3.1.zip
mkdir build-3.3.1
cd build-3.3.1
cmake -DCMAKE_BUILD_TYPE=RELEASE -DWITH_TBB=ON -DBUILD_opencv_python3=ON -DOPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib-3.3.1/modules -DCMAKE_INSTALL_PREFIX:PATH=$HOME/opencv/3.3.1 ~/opencv/opencv-3.3.1
make install
ln -s ~/opencv/3.3.1/lib/python3.6/site-packages/cv2.cpython-36m-x86_64-linux-gnu.so ${VIRTUAL_ENV}/lib64/python3.6/site-packages
try executing this command. if you succeeded in building and installing opencv, it prints '3.3.1'.
python -c 'import cv2; print(cv2.__version__)'