# Install the basic dependencies:
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Reference: https: //docs.opencv.org/3.2.0/d7/d9f/tutorial_linux_install.html
# Other dependencies:
sudo apt-get -y install libgstreamer-plugins-base1.0-dev
sudo apt-get -y install libgstreamer1.0-dev
sudo apt-get -y install libavresample-dev
sudo apt-get -y install libgphoto2-dev
sudo apt-get install libopenblas-dev
sudo apt-get install doxygen
Reference ~
https://www.jianshu.com/p/259a6140da9d
installation:
sudo apt-get install liblapacke-dev checkinstall
# Opencv download and opencv_contribute
$ wget https://github.com/opencv/opencv/archive/3.2.0.zip
$ wget https://github.com/opencv/opencv_contrib/archive/3.2.0.zip
# Ready to
unpack it in a folder
$ unzip opencv-3.2.0.zip -d ~/opencv
$ unzip opencv_contrib-3.2.0.zip -d ~/opencv
Create a folder compiled
$ cd ~ / OpenCV / OpenCV-3.2.0
$ mkdir Build
$ cd Build /
# 编译
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_opencv_python=OFF \
-D WITH_CUDA=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/home/kandy/opencv/opencv_contrib-3.2.0/modules \
-D OPENCV_ENABLE_NONFREE=OFF \
-D BUILD_EXAMPLES=OFF ..
sudo make
sudo make install
# Common Errors:
1. mindiconda error
ECHO $PATH
/home/kandy/miniconda3/bin:/home/kandy/miniconda3/condabin:/usr/local/cuda-9.0/bin:/home/kandy/miniconda3/bin:/home/kandy/bin:/home/kandy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/kandy/.rvm/bin:/home/kandy/.rvm/bin:/home/kandy/.vimpkg/bin
export PATH=/usr/local/cuda-9.0/bin:/home/kandy/bin:/home/kandy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/kandy/.rvm/bin:/home/kandy/.rvm/bin:/home/kandy/.vimpkg/bin
conda uninstall libtiff
2. Download and install some files:
https://www.520mwx.com/view/66356
https://my.oschina.net/mengyoufengyu/blog/3070868/print
cmake will download some files, but the download speed and network link might be wrong, this time need to manually download and put the appropriate location, the specific operation to see what is wrong, and then search on goole
The above command temporarily change the environment variables
3. make when stuck in a certain position
This time make use of single-threaded command
In addition most of the errors of compilation problems due to the lack of a lead to dependency, in which case you need to download and install appropriate dependent and then recompile it
# Commonly used commands
sudo rm -rf *