ubuntu14.04 64位 opencv3.20 和 opencv_contrib-3.2.0编译安装

在项目中因为要用到opencv扩展模块opencv_contrib(opencv3版本,将部分不稳定功能放在opencv_contrib里),因此在ubuntu14.04下进行安装。原本已经安装了opencv3.2,再安装opencv_contrib时,安装到最后总会出错,因此卸掉已有安装的opencv3.2,重新进行安装编译。

1.下载源码:

opencv3.2 下载地址 :

https://github.com/opencv/opencv/archive/3.2.0.tar.gopencv_contrib-3.2.0下载地:https://github.com/opencv/opencv_contrib/archive/3.2.0.zip


下载的两个包分别为opencv-3.2.0和opencv_contrib-3.2.0,将opencv_contrib-3.2.0包移动到opencv-3.2.0下

2.安装依赖项

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

3.编译

cd opencv-3.2.0

mkdir build && cd build

开始cmake:

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.2.0/modules/ ..

cmake没错误,完成后执行 make -j7

sudo make install

在make -j7过程中,我出现如下错误:

ubuntu14.04 64位 opencv3.20 和 opencv_contrib-3.2.0编译安装_第1张图片

解决方法是打开opencv_contrib-3.2.0/modules/rgbd/src/odometry.cpp文件,将#include 改为#include (首先确保你的/usr/local/include/eigen3文件夹存在,不存在的话sudo cp -r usr/include/eigen3/unsported  usr/local/include/,因为sudo apt-get install libeigen3-dev  //默认安装路径是:/usr/include/eigen3

问题解决参考:http://answers.opencv.org/question/7666/build-failure-244-unsupportedeigenmatrixfunctions/






 

你可能感兴趣的:(编程知识点)