Ubuntu16.04下安装opencv3.3和opencv_contrib(命令行及cmake-gui安装)及卸载

下载opencv3.3.1及opencv-3.3.contrib

opencv3.3.1

https://github.com/opencv/opencv/releases/tag/3.3.1
选择source code(tar.gz)

opencv_contrib

https://github.com/opencv/opencv_contrib/releases/tag/3.3.1
选择source code(tar.gz)

安装相关依赖包

CTRL+T打开终端,在解压opencv之前输入以下命令,安装相关依赖包,一般装前三个命令就行,一定要确认GTK2.0已经装好

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

注意

这儿一定要确定pkg-config和libgtk2.0-dev已经装上,不然后续写程序用了imshow会报错,查了一下只能重装opencv才能解决咯

解压,编译

解压opencv3.3.1及opencv-3.3.contrib
并将opencv3.3.1放到opencv目录下,将opencv-3.3.contrib放到opencv-3.3.1目录下
最后在opencv3.3.1目录下创建一个build文件夹


cd opencv-3.3.1

sudo mkdir build                              #新建文件夹build

进入build目录

执行cmake生成makefile文件

cd build  

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

OPENCV_EXTRA_MODULES_PATH就是你 opencv_contrib-3.3.1下面的modules目录,且后面有两个…不能缺少

生成完毕之后,提示如下:

--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /home/user/opencv-3.3.1/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
--
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值