ubuntu 16.04 安装编译opencv3.3

ubuntu 16.04 安装编译opencv3.3

步骤一:先安装如下依赖包

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 build-essential qt5-default ccache libv4l-dev libavresample-dev libgphoto2-dev libopenblas-base libopenblas-dev doxygen openjdk-8-jdk pylint libvtk6-dev

sudo apt-get install pkg-config

步骤二:下载好opencv-3.3.1 和 opencv_contrib-3.3.1

到如下网址下载opencv-3.3.1

https://github.com/opencv/opencv/archive/3.3.1.zip

到如下网址下载opencv_contrib-3.3.1

https://github.com/opencv/opencv_contrib/archive/3.3.1.zip

解压下载的包

sudo unzip opencv-3.3.1.zip
sudo unzip opencv_contrib-3.3.1.zip

解压完后需要将opencv_contrib.zip提取到opencv目录下,同时在该目录下新建一个文件夹build

sudo cp -r opencv_contrib-3.3.1 opencv-3.3.1 #复制opencv_contrib到opencv目录下 
cd opencv-3.3.1 
sudo mkdir build #新建文件夹build 

步骤三:开始编译opencv

cd build
sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/home/files/opencv-3.3.1/opencv_contrib-3.3.1/modules/ ..

sudo cmake -DENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_BUILD_TYPE=Release -DBUILD_TIFF=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/home/airobot/opencv-3.4.3/opencv_contrib-3.4.3/modules/ ..

sudo make
sudo make install

要注意opencv_contrib 的路径要对

 

可能出现的问题:

编译时,卡在 ippicv_linux_20151201.tgz下载

解决:手动下载好该包,

http://www.http.com//download.csdn.net/detail/fjx812/9750727

并放到

opencv-3.1.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e 

这个路径底下,再重新编译

 

编译时,出现onlineMIL.hpp 的sign 的错误

解决方法:把opencv_contrib-3.0.0-beta/modules/tracking/include/opencv2/tracking/onlineMIL.hpp

中所有的sign 函数改成msign,

把opencv_contrib-3.0.0-beta/modules/tracking/src/onlineMIL.cpp 中的所有sign 函数

改成msign

你可能感兴趣的:(ubuntu)