网上对Opencv的安装教程一大片,不过我发现能真正安装起来的几乎没有,于是乎在不断探索之后,自己写一个吧,一下就是我从源码编译和安装的结果,先来看一下啊:
特别说明:此教程会同时在Ubuntu16.04默认安装的Python2.7和python3.5配置好Opencv3.4.0
大道至简,Start my show:
1.更新系统
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
2.安装依赖
# Build tools:
sudo apt-get install -y build-essential cmake
# GUI (if you want to use GTK instead of Qt, replace 'qt5-default' with 'libgtkglext1-dev' and remove '-DWITH_QT=ON' option in CMake):
sudo apt-get install -y qt5-default libvtk6-dev
# Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev
# Video I/O:
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
# Parallelism and linear algebra libraries:
sudo apt-get install -y libtbb-dev libeigen3-dev
# Python:
sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy
这里特别地说一下,最后执行以下命令,否则可能会造成重启无法进入系统的情况,请点击链接查看
http://blog.csdn.net/gpwner/article/details/79178832
3.下载源码
如果你的网可以的话,你也可以自己到Github上下载,点击链接下载
4.解压zip包配置
我是将源码放在根目录下的:
cd ~
cd opencv3.4.0
mkdir build
cd build
sudo cmake ../
正常的话应该是能看到以下的信息的:
5.编译
在终端输入sudo make
这个过程可能会有点久,耐心等待,成功了会看到以下信息:
6.安装
cd ~/opencv3.4.0/build/
sudo make install
7.测试
以上就是整个安装流程