码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu 16.04 安装opencv 3.4.0

时间:2018-01-23 23:18:43      阅读:1034      评论:0      收藏:0      [点我收藏+]

标签:ip命令   pypy   option   doc   gtk2   电脑配置   .com   gtk   UI   

官网手册中的说明基本上是比较全的,这里主要记录下安装过程,以及编译选项 多看官方手册,少走弯路 官网安装说明:https://docs.opencv.org/3.4.0/d7/d9f/tutorial_linux_install.html

环境: Ubuntu 16.04 64bit ,openCV 3.4.0

一、安装opencv依赖包

GCC 4.4.x or later CMake 2.8.7 or higher Git GTK+2.x or higher, including headers (libgtk2.0-dev) pkg-config Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy) ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev [optional] libtbb2 libtbb-dev [optional] libdc1394 2.x [optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev, libdc1394-22-dev [optional] CUDA Toolkit 6.5 or higher The packages can be installed using a terminal and the following commands or by using Synaptic Manager:

[compiler] sudo apt-get install build-essential [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

二、安装numpy(如果需要python使用)

这里用的使用python3,所以是pip3命令,如果用python2,直接改为pip命令即可

pip3 install numpy

三、下载opencv3.4.0

需要下载opencv和opencv_contrib(后者会在cmake配置的时候用到),这是因为opencv3以后SIFT和SURF之类的属性被移到了contrib中 下载地址:

https://opencv.org/releases.html

https://github.com/opencv/opencv_contrib/tree/3.4.0

四、安装opencv3.4.0

1.配置选项

cd opencv-3.4.0/

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_PYTHON_EXAMPLES=ON
-D INSTALL_C_EXAMPLES=ON
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules
-D PYTHON_EXECUTABLE=/usr/bin/python3
-D BUILD_EXAMPLES=ON ..

2.编译

make -j4

-j4表示四核运算,可根据电脑配置选择 如果出现错误,改为单核执行

make clean

make

3.安装

sudo make install

ubuntu 16.04 安装opencv 3.4.0

标签:ip命令   pypy   option   doc   gtk2   电脑配置   .com   gtk   UI   

原文地址:https://www.cnblogs.com/snowinglx/p/8338005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!