环境:

  • NVIDIA DRIVE™ PX 2 (V4L)
  • NVIDIA® Tegra® Linux Driver Package (L4T)
  • Desktop Linux (Ubuntu 14.04 LTS and 16.04 LTS)

下载源码:

git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_extra.git 

安装前提:
CMake 2.8.10 or newer
CUDA toolkit 8.0 (7.0 or 7.5 may also be used)
Build tools (make, gcc, g++)
Python 2.6 or greater

在linux上编译opencv所需要的软件包:

sudo apt-get install \libglew-dev \libtiff5-dev \zlib1g-dev \libjpeg-dev \libpng12-dev \libjasper-dev \libavcodec-dev \libavformat-dev \libavutil-dev \libpostproc-dev \libswscale-dev \libeigen3-dev \libtbb-dev \libgtk2.0-dev \pkg-config
python-dev / python3-dev
python-numpy / python3-numpy
python-py / python3-py
python-pytest / python3-pytest$ sudo apt-get install python-dev python-numpy python-py python-pytest
# And, optionally:
$ sudo apt-get install python3-dev python3-numpy python3-py python3-pytest

准备编译目录:

$ mkdir build
$ cd build

编译前的配置:

Drive PX2 平台的配置如下,注意此配置是针对python2的,如果你只想在python3下配置opencv,需要手动修改下面的BUILD_opencv_python2的值为OFF,BUILD_opencv_python3的值为ON。

cmake \-DCMAKE_BUILD_TYPE=Release \-DCMAKE_INSTALL_PREFIX=/usr \-DBUILD_PNG=OFF \-DBUILD_TIFF=OFF \-DBUILD_TBB=OFF \-DBUILD_JPEG=OFF \-DBUILD_JASPER=OFF \-DBUILD_ZLIB=OFF \-DBUILD_EXAMPLES=ON \-DBUILD_opencv_java=OFF \-DBUILD_opencv_python2=ON \-DBUILD_opencv_python3=OFF \-DENABLE_NEON=ON \-DWITH_OPENCL=OFF \-DWITH_OPENMP=OFF \-DWITH_FFMPEG=ON \-DWITH_GSTREAMER=OFF \-DWITH_GSTREAMER_0_10=OFF \-DWITH_CUDA=ON \-DWITH_GTK=ON \-DWITH_VTK=OFF \-DWITH_TBB=ON \-DWITH_1394=OFF \-DWITH_OPENEXR=OFF \-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \-DCUDA_ARCH_BIN=6.2 \-DCUDA_ARCH_PTX="" \-DINSTALL_C_EXAMPLES=ON \-DINSTALL_TESTS=OFF \-DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \../opencv

针对Linux Desktop的配置:

  • Ubuntu Desktop Linux 14.04 LTS
  • Ubuntu Desktop Linux 16.04 LTS
cmake \-DCMAKE_BUILD_TYPE=Release \-DCMAKE_INSTALL_PREFIX=/usr \-DBUILD_PNG=OFF \-DBUILD_TIFF=OFF \-DBUILD_TBB=OFF \-DBUILD_JPEG=OFF \-DBUILD_JASPER=OFF \-DBUILD_ZLIB=OFF \-DBUILD_EXAMPLES=ON \-DBUILD_opencv_java=OFF \-DBUILD_opencv_python2=ON \-DBUILD_opencv_python3=OFF \-DWITH_OPENCL=OFF \-DWITH_OPENMP=OFF \-DWITH_FFMPEG=ON \-DWITH_GSTREAMER=OFF \-DWITH_GSTREAMER_0_10=OFF \-DWITH_CUDA=ON \-DWITH_GTK=ON \-DWITH_VTK=OFF \-DWITH_TBB=ON \-DWITH_1394=OFF \-DWITH_OPENEXR=OFF \-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \-DCUDA_ARCH_BIN='3.0 3.5 5.0 6.0 6.2' \-DCUDA_ARCH_PTX="" \-DINSTALL_C_EXAMPLES=ON \-DINSTALL_TESTS=OFF \-DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \../opencv

使用make进行编译并安装:

make -j6
sudo make install

CMake 参数指南

Parameter Our Default Value What It Does Notes
BUILD_EXAMPLES ON Governs whether the C/C++ examples are built  
BUILD_JASPER OFF Governs whether the Jasper library (libjasper) is built from source in the 3rdparty directory  
BUILD_JPEG OFF As above, for libjpeg  
BUILD_PNG OFF As above, for libpng  
BUILD_TBB OFF As above, for tbb  
BUILD_TIFF OFF As above, for libtiff  
BUILD_ZLIB OFF As above, for zlib  
BUILD_opencv_java OFF Controls the building of the Java bindings for OpenCV Building the Java bindings requires OpenCV libraries be built for static linking only
BUILD_opencv_nonfree OFF Controls the building of non-free (non-open-source) elements Used only for building 2.4.X
BUILD_opencv_python ON Controls the building of the Python 2 bindings in OpenCV 2.4.X Used only for building 2.4.X
BUILD_opencv_python2 ON Controls the building of the Python 2 bindings in OpenCV 3.1.0 Not used in 2.4.X
BUILD_opencv_python3 OFF Controls the building of the Python 3 bindings in OpenCV 3.1.0 Not used in 2.4.X
CMAKE_BUILD_TYPE Release Selects the type of build (release vs. development) Is generally either Release or Debug
CMAKE_INSTALL_PREFIX /usr Sets the root for installation of the libraries and header files  
CUDA_ARCH_BIN varies Sets the CUDA architecture(s) for which code is compiled Usually only passed for platforms with known specific cards. OpenCV includes a small program that determines the architectures of the system's installed card if you do not pass this parameter. Here, for Ubuntu desktop, the value is a list to maximize card support.
CUDA_ARCH_PTX "" Builds PTX intermediate code for the specified virtual PTX architectures  
CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-8.0 (for Linux) Specifies the location of the CUDA include files and libraries  
ENABLE_NEON ON Enables the use of NEON SIMD extensions for ARM chips Only passed for builds on ARM platforms
ENABLE_PRECOMPILED_HEADERS OFF Enables/disables support for pre-compiled headers Only specified on some of the ARM platforms
INSTALL_C_EXAMPLES ON Enables the installation of the C example files as part of make install  
INSTALL_TESTS ON Enables the installation of the tests as part of make install  
OPENCV_TEST_DATA_PATH ../opencv_extra/testdata Path to the testdatadirectory in the opencv_extrarepository  
WITH_1394 OFF Specifies whether to include IEEE-1394 support  
WITH_CUDA ON Specifies whether to include CUDA support  
WITH_FFMPEG ON Specifies whether to include FFMPEG support  
WITH_GSTREAMER OFF Specifies whether to include GStreamer 1.0 support  
WITH_GSTREAMER_0_10 OFF Specifies whether to include GStreamer 0.10 support  
WITH_GTK ON Specifies whether to include GTK 2.0 support Only given on Linux platforms, not Microsoft Windows
WITH_OPENCL OFF Specifies whether to include OpenCL runtime support  
WITH_OPENEXR OFF Specifies whether to include ILM support via OpenEXR  
WITH_OPENMP OFF Specifies whether to include OpenMP runtime support  
WITH_TBB ON Specifies whether to include Intel TBB support

https://docs.opencv.org/3.2.0/d6/d15/tutorial_building_tegra_cuda.html#tutorial_building_tegra_cuda_testing

Tegra环境下安装OpenCV相关推荐

  1. python连接opencv库_python环境下安装opencv库的方法

    注意:安装opencv之前需要先安装numpy,matplotlib等 一.安装方法 方法一.在线安装 1.先安装opencv-python pip install opencv-python --u ...

  2. python的opencv库_python环境下安装opencv库的方法

    注意:安装opencv之前需要先安装numpy,matplotlib等 一.安装方法 方法一.在线安装 1.先安装opencv-python pip install opencv-python --u ...

  3. Anaconda3 | Ubuntu(python3.6)环境下安装opencv

    Anaconda3 | Ubuntu(python3.6)环境下安装opencv 文章转载自:https://blog.csdn.net/wds2435629591/article/details/7 ...

  4. python3.6安装cv2库_win10 +python3.6环境下安装opencv以及pycharm导入cv2有问题的解决办法...

    一.安装opencv 借鉴的这篇博客已经写得很清楚了--------https://blog.csdn.net/u011321546/article/details/79499598       ,这 ...

  5. linux没有图形界面opcv,关于Linux/ubuntu的环境下安装OpenCV并配置Clion【全套攻略】及关于'Opencv'file not found 的问题...

    1.如何在Linux/ubuntu配置OpenCV 1.1 :进入OpenCV官网下载:(也可进入git Hub 在终端Clone) 等待下载完成 1.2:安装OpenCV: 笔者下载的是Opencv ...

  6. 没有安装opencv的linux系统上运行基于opencv,Linux环境下安装OpenCV

    我使用的是ubuntu10.04系统.其他系统可能有些命令会不同. 由于同学需要在ARM板上移植OPenCV,而我之前有在的经验,他就叫我帮手. 我就试下先在我的ubuntu上安装OpenCV.安装成 ...

  7. 在ubuntu20.04环境下安装opencv教程并测试

    目录 一.安装opencv 二 配置环境 三 实例 四 总结 五参考文献 一.安装opencv 1下载 在虚拟机内打开浏览器输入网址Release OpenCV 3.4.15 · opencv/ope ...

  8. Anaconda环境下安装opencv

    问题: anaconda环境下运行jupyter里面的代码 里面需要调用cv2包. 之前习惯用pip install 安装包 我就习惯性的使用 pip install opencv-python 但是 ...

  9. ubuntu20.04环境下安装opencv教程及测试

    目录 一.安装opencv (1)下载opencv-3.4.15数据包 (2)解压 (3)使用cmake安装opencv (4)使用make创建编译 (5) 安装 二.配置环境 三.实例 (1)打开图 ...

最新文章

  1. 多任务学习,如何设计一个更好的参数共享机制?| AAAI 2020
  2. 业务代码的救星——Java对象转换框架MapStruct
  3. AI理论知识整理(17)-子式,非奇异,可逆
  4. 扁平化界面设计,UI设计师都要会!
  5. WebLogic应用部署之配置不需要应用名直接访问(配置默认应用)
  6. 5.7 tensorflow2实现主成分分析(PCA) ——python实战(下篇)
  7. 如何在FL Studio中对整首歌曲音量进行调整
  8. myloader还原恢复详解
  9. Sublime 常用操作
  10. 远程控制软件老是断线怎么解决?
  11. Qunee For Html5 开发清新、高效的拓扑图组件
  12. 计算机网络英语app,在斑马英语app的详细软件功能介绍
  13. 关于2020年各省市GDP和各省人均GDP的探索
  14. unity如何实现图片透视_实战 | 自己实现扫描全能王
  15. python3中的@abstractmethod的用法
  16. 媒体专访 | 许彬教授:我们离元宇宙Big Bang有多近?
  17. 最新最快的HTTP代理服务器,国内外HTTP代理服务器,游戏代理服务器,Q代理服务器,代理IP...
  18. 计算机开机的四个画面,电脑系统开机时的欢迎使用四个漂亮字如何修改
  19. 音频转文字怎么转?这些方法值得一试
  20. ui设计岗位招聘要求有哪些?

热门文章

  1. 压电陶瓷超声波换能器设计
  2. 联想企业网盘正式入驻阿里云市场
  3. 运筹学的松弛变量和影子价格或者对偶价格
  4. 实战用法:A表的数据插入到B表,B表存在
  5. 从内存中加载并运行exe
  6. 功能安全----自动驾驶
  7. abe.jar工具,解决提示Don‘t know how to process version 5
  8. NXP i.MX 8M Plus工业开发板硬件说明书--上册( 四核ARM Cortex-A53 + 单核ARM Cortex-M7,主频1.6GHz)
  9. 第四届江西省高校网络安全技能大赛 决赛 MISC
  10. 手机程序员常说的webview到底是个啥东西