GCC 4.4.x or later
CMake 2.6 or higher
Git
GTK+2.x or higher, including headers (libgtk2.0-dev) # 控制opencv GUI
pkg-config
Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy)
ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev
[optional] libtbb2 libtbb-dev
[optional] libdc1394 2.x
[optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev, libdc1394-22-dev
$ sudo apt-get install build-essential
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
$ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev # 处理图像所需的包
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
$ sudo apt-get install libxvidcore-dev libx264-dev # 处理视频所需的包
$ sudo apt-get install libatlas-base-dev gfortran # 优化opencv功能
$ sudo apt-get install ffmpeg
Install the dependencies yourself
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Similar problems and solutions:
Problem: /sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.6 is not a symbol link
sudo ldconfig -v
found this line error: libcudnn.so.6 -> libcudnn.so.6.0.21
ctrl+shift+F under ubuntu can find the content displayed in the command window
or with the command:
dpkg -S /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.6
Problem solving code:
sudo ln -sf /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.4.0.21 /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.6
Download address: https://opencv.org/releases.html
Go to the downloaded and unzipped folder and create a new folder:
mkdir build
cd build
cmake -D:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
Compile + install:
sudo make #make -j4 means quad-core parallel installation
sudo make install
Add opencv's library to your local path:
Add content to sudo gedit /etc/ld.so.conf.d/opencv.conf
file: /usr/local/lib
Method 2:
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc /ld.so.conf.d/opencv.conf'
sudo ldconfig
Installation complete test:
cd ~/opencv-3.2.0/samples/cpp/tutorial_code/introduction/display_image
./display_image ~/opencv-3.2.0/samples/data/lena.jpg
References:
https://blog.csdn.net/yudiemiaomiao/article/details/72780790
https://blog.csdn.net/qq_24626557/article/details/70173399
https://blog.csdn.net/langb2014/article /details/54376716