Jump to content

OpenCV: Difference between revisions

1,189 bytes added ,  11 May 2020
Line 14: Line 14:


You need to compile [https://github.com/opencv/opencv OpenCV] from source alongside [https://github.com/opencv/opencv_contrib OpenCV-contrib].
You need to compile [https://github.com/opencv/opencv OpenCV] from source alongside [https://github.com/opencv/opencv_contrib OpenCV-contrib].
{{hidden | Compile opencv-contrib-python |
You can build a wheel to install which includes NONFREE modules as follows:
* Install all dependencies listed in [https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html the build tutorial]
<syntaxhighlight lang="bash">
sudo apt install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt install -y libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
sudo apt install -y libpng-dev libjpeg-dev libopenexr-dev libtiff-dev libwebp-dev libjasper-dev
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install -y libjasper1 libjasper-dev
sudo apt install -y tesseract-ocr* liblept5 leptonica-progs libleptonica-dev
</syntaxhighlight>
* Setup a build environment
<syntaxhighlight lang="bash">
conda create -n opencvbuild python=3.6
conda activate opencvbuild
conda install -c conda-forge pyqt=4
</syntaxhighlight>
* Make a wheel
<syntaxhighlight lang="bash">
git clone --recurse-submodules [email protected]:skvark/opencv-python.git
cd opencv-python
export ENABLE_CONTRIB=1
export CMAKE_ARGS=-DOPENCV_ENABLE_NONFREE=ON
python setup.py bdist_wheel
</syntaxhighlight>
}}
{{hidden | Compilation Instructions |
{{hidden | Compilation Instructions |
See [https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu/ https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu] for instructions.
See [https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu/ https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu] for instructions.