ubuntu16.04+opencv3.1安装

本文提供了一步一步指导如何在Ubuntu16.04上安装OpenCV3.1的方法,包括安装依赖项、配置环境、解决常见问题等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ubuntu16.04+opencv3.1安装

 

安装依赖项:

sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

optional:

sudo apt-get install checkinstall yasm libtiff5-dev libjpeg-dev libjasper-dev libdc1394-22-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils libeigen3-dev

 

1.进入opencv官网,选择opencv3.1版本:https://opencv.org/releases.html

 

2.将下载的压缩包移至指定位置解压,比如home下,终端执行:

cd opencv-3.1.0

mkdir build

cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

make -j8 

sudo make install

无报错,则结束

其中,opencv可能的报错

 

报错1:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:

解决方法参考https://blog.youkuaiyun.com/u014613745/article/details/78310916

报错2:

nvcc fatal   : Unsupported gpu architecture 'compute_11'

解决方法:

终端输入:

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -D BUILD_EXAMPLES=ON -D CUDA_GENERATION=Auto -D BUILD_NEW_PYTHON_SUPPORT=ON ..

报错3:

解决方法:

打开opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp文件,并修改:

#include "precomp.hpp"
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)

为:

#include "precomp.hpp"

#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)

如图为改后的

验证:

验证如下,则安装完成:

 

 

参考:

https://blog.youkuaiyun.com/jhszh418762259/article/details/52957495

https://blog.youkuaiyun.com/sysuwuhongpeng/article/details/45485719

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值