TX2安装opencv3.4.0
安装步骤
### Remove all old opencv stuffs installed by JetPack (or OpenCV4Tegra)
$ sudo apt-get purge libopencv*
### I prefer using newer version of numpy (installed with pip), so
### I'd remove this python-numpy apt package as well
$ sudo apt-get purge python-numpy
### Remove other unused apt packages
$ sudo apt autoremove
### Upgrade all installed apt packages to the latest versions (optional)
$ sudo apt-get update
$ sudo apt-get dist-upgrade
### Update gcc apt package to the latest version (highly recommended)
$ sudo apt-get install --only-upgrade g++-5 cpp-5 gcc-5
### Install dependencies based on the Jetson Installing OpenCV Guide
$ sudo apt-get install build-essential make cmake cmake-curses-gui \g++ libavformat-dev libavutil-dev \libswscale-dev libv4l-dev libeigen3-dev \libglew-dev libgtk2.0-dev
### Install dependencies for gstreamer stuffs
$ sudo apt-get install libdc1394-22-dev libxine2-dev \libgstreamer1.0-dev \libgstreamer-plugins-base1.0-dev
### Install additional dependencies according to the pyimageresearch
### article
$ sudo apt-get install libjpeg8-dev libjpeg-turbo8-dev libtiff5-dev \libjasper-dev libpng12-dev libavcodec-dev
$ sudo apt-get install libxvidcore-dev libx264-dev libgtk-3-dev \libatlas-base-dev gfortran
$ sudo apt-get install libopenblas-dev liblapack-dev liblapacke-dev
### Install Qt5 dependencies
$ sudo apt-get install qt5-default
### Install dependencies for python3
$ sudo apt-get install python3-dev python3-pip python3-tk
$ sudo pip3 install numpy
$ sudo pip3 install matplotlib
### Modify matplotlibrc (line #41) as 'backend : TkAgg'
$ sudo vim /usr/local/lib/python3.5/dist-packages/matplotlib/mpl-data/matplotlibrc
### Also install dependencies for python2
### Note that I install numpy with pip, so that I'd be using a newer
### version of numpy than the apt-get package
$ sudo apt-get install python-dev python-pip python-tk
$ sudo pip2 install numpy
$ sudo pip2 install matplotlib
### Modify matplotlibrc (line #41) as 'backend : TkAgg'
$ sudo vim /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/matplotlibrc
Before downloading and building opencv-3.4.0, I’d first do some modifications according to this post, in order to fix OpenGL related compilation problems . More specifically, I’d modify /usr/local/cuda/include/cuda_gl_interop.h and fix the symbolic link of libGL.so.
$ sudo vim /usr/local/cuda/include/cuda_gl_interop.h
$ cd /usr/lib/aarch64-linux-gnu/
$ sudo ln -sf tegra/libGL.so libGL.so
Here’s how the relevant lines (line #62~68) of cuda_gl_interop.h look like after the modification.
//#if defined(__arm__) || defined(__aarch64__)
//#ifndef GL_VERSION
//#error Please include the appropriate gl headers before including cuda_gl_interop.h
//#endif
//#else#include <GL/gl.h>
//#endif
Next, download opencv-3.4.0 source code, cmake and compile. Note that opencv_contrib modules (cnn/dnn stuffs) would cause problem on pycaffe, so after some experiments I decided not to include those modules at all.
### Download opencv-3.4.0 source code
$ mkdir -p ~/src
$ cd ~/src
$ wget https://github.com/opencv/opencv/archive/3.4.0.zip \-O opencv-3.4.0.zip
$ unzip opencv-3.4.0.zip
### Build opencv (CUDA_ARCH_BIN="6.2" for TX2, or "5.3" for TX1)
$ cd ~/src/opencv-3.4.0
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \-D WITH_CUDA=ON -D CUDA_ARCH_BIN="6.2" -D CUDA_ARCH_PTX="" \-D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON \-D ENABLE_NEON=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF \-D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF \-D WITH_QT=ON -D WITH_OPENGL=ON ..
$ make -j4
$ sudo make install
To verify the installation:
$ ls /usr/local/lib/python3.5/dist-packages/cv2.*
/usr/local/lib/python3.5/dist-packages/cv2.cpython-35m-aarch64-linux-gnu.so
$ ls /usr/local/lib/python2.7/dist-packages/cv2.*
/use/local/lib/python2.7/dist-packages/cv2.so
$ python3 -c 'import cv2; print(cv2.__version__)'
3.4.0
$ python2 -c 'import cv2; print(cv2.__version__)'
3.4.0
TX2安装opencv3.4.0相关推荐
- 安装opencv3.3.0碰到的问题及解决方法
安装opencv3.3.0碰到的问题及解决方法 参考文章: (1)安装opencv3.3.0碰到的问题及解决方法 (2)https://www.cnblogs.com/kean0048/p/11046 ...
- ubuntu16.04源码安装opencv3.4.0
ubuntu16.04源码安装opencv3.4.0 opencv下载地址:https://opencv.org/releases/page/3/ 1.下载安装包 2.安装依赖 sudo apt-ge ...
- ubuntu16.04安装opencv3.1.0(包含opencv_contrib模块)
整理自http://blog.csdn.net/yehuohan/article/details/51327465 1.安装依赖库 sudo apt-get install build-essenti ...
- 安装opencv3.4.0报错
安装 opencv-3.4.0报错: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory 解决办法: 1. 查找该 ...
- ubuntu16.04+cuda10.1安装opencv-3.3.0
目录 1.系统环境 2.安装一些基础命令 2.1更新包 2.2安装依赖项 3.下载OpenCV 和 OpenCV_contrib 源码包 3.1下载地址 3.2解压并移动opencv_contrib- ...
- ubuntu 16.0.4安装Opencv3.2.0
OpenCV安装 此安装在ubuntu16上实验,为C++版本的安装,安装Python版本的没有这么复杂,只需要pip安装即可.注意的是安装之前保证sudo apt-get install libgt ...
- 在装有Ubuntu16.04的VMware虚拟机下安装OpenCV3.2.0
引言 最近因为学习需要,要在VMware虚拟机下安装OpenCV,在网上查了一下OpenCV3.3.0目前已经出来了,但是考虑到稳定性问题,决定先装一个3.2.0版本的.需要注意的是,pip可以安装的 ...
- cv2 python3.5 linux,ubuntu 16.04 安装 opencv3.2.0 with python 3.5
我的简书地址.http://www.jianshu.com/p/5274c9eef9e9 安装的过程无非是装各种依赖库,设置各种路径,各种依赖库不用解释,都是必须D.直接上过程. 依次按顺序执行就OK ...
- python卸载opencv包_Ubuntu16.04卸载opencv2.4.9并安装opencv3.2.0+contrib
本文为作者原创,转载请注明出处(http://www.cnblogs.com/mar-q/)by 负赑屃 需要用到opencv中的surf和sift算法,机器上只有opencv3.2,没有扩展包,于是 ...
最新文章
- DevOps 工具链可推动你的创新计划!
- [置顶] C语言实验:输入任意一个日期的年、月、日的值,求出从公元1年1月1日到这一天总共有多少天,并求出这一天是星期几。...
- Js结束,项目进行中
- Go 语言编程 — 高级数据类型 — Slice 切片
- SAP中国首个基于SAP HANA的Business One Analytics项目初试锋芒
- 第三方登录接入-qq,weibo-java
- java 函数式编程 示例_功能Java示例 第8部分–更多纯函数
- linux文件传输到另一台linux,使用scp将文件/目录拷贝到另一台Linux主机上
- 词嵌入:探索解释和利用
- Struts2文件上传超出配置大小的解决办法
- ural 1012K-based Numbers. Version 2 1013. K-based Numbers. Version 3
- IDL 解析葵花8Himawari-8标准数据(HSD),辐射定标、重投影、裁剪
- python笔记-爬取豆瓣Top250排行
- excel字符串和单元格拼接_单元格引用问题(引用的单元格与字符串变量连接)...
- 支付宝支付接口开通流程
- Chrome插件安装及程序包无效的解决方法
- Can I debug relocated code at source-level with DS-5 Debugger?
- 机器学习之十一(读书笔记)
- 用Python学《微积分B》(Taylor公式与曲线拟合)
- 悲欢离合是红尘,坎坎坷坷是人生