首先安装依赖项:
1 [compiler] sudo apt-get install build-essential
2 [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3 [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
然后在官网下载3.0安装包https://github.com/opencv/opencv/archive/3.0.0.zip解压
cd ~/opencv-3.0.0
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
其中在make时会报错,
解决方法:
打开/home/yhy/opencv-3.0.0/modules/cudalegacy/src/graphcuts.cpp
把此处改为:
#include "precomp.hpp"
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) ||(CUDART_VERSION>=8000)
其中 ||(CUDART_VERSION>=8000)为后增加的内容
再次make,就不会报错
安装完后,修改环境变量:
sudo
gedit /etc/ld.so.conf.d/opencv.conf