我是靠谱客的博主 伶俐八宝粥,最近开发中收集的这篇文章主要介绍Ubuntu16.04下Python OpenCV with CUDA 安装及配置环境下载安装依赖库编译参考,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
未完成!!!!!!这篇有问题!!!!!不要按这个内容做!!!可以看参考链接里的都不错!!!
环境
- Ubuntu 16.04
- python 2.7(系统自带的!不要用Anaconda装会踩坑详见参考4,但我按参考4的方法调整了还是不行,无奈之下搞了一个新的docker环境来装opencv)
- CUDA 8.0
下载
mkdir opencv_cuda
cd opencv_cuda
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout -b 3.1.0
cd ..
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout -b 3.1.0
安装依赖库
apt-get install software-properties-common python-software-properties
apt-add-repository universe
apt-get update
apt install -y
x264
mesa-utils
libgtk2.0-dev
libxvidcore-dev
yasm
libxine2-dev
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
libv4l-dev
libfaac-dev
libmp3lame-dev
libopencore-amrnb-dev
libtheora-dev
libvorbis-dev
ffmpeg
libpng-dev
libdc1394-22-dev
qt5-default
libtiff5-dev
libeigen3-dev libeigen3-doc
tesseract-ocr
tesseract-ocr-jpn
vtk6
tcl-vtk6
python-vtk6
libgflags-dev
libleptonica-dev
libtesseract-dev
gphoto2
liblapacke-dev
libgoogle-glog-dev
libprotobuf-dev
libprotoc-dev
protobuf-compiler
ccache
libgphoto2-dev
libavresample-dev
libvtk6-dev
libvtk6-qt-dev
libatlas-base-dev
gfortran
sudo apt-get install python-dev python-numpy python-py python-pytest
sudo apt-get install cmake
cd ../opencv
mkdir build
cd build
编译
cmake ..
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/usr/local
-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules
-DBUILD_DOCS=ON
-DBUILD_EXAMPLES=ON
-DWITH_TBB=ON
-DBUILD_TIFF=OFF
-DWITH_GDAL=ON
-DWITH_LIBV4L=ON
-DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python2
-DWITH_CUDA=ON -DWITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES"
-DWITH_OPENCL=OFF
-DWITH_VTK=OFF
-DBUILD_opencv_python2=ON
-DBUILD_opencv_python3=OFF
-DBUILD_opencv_xfeatures2d=OFF
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0
-DCUDA_ARCH_BIN='3.0 3.5 5.0 6.0 6.2'
-DWITH_IPP=ON
-DWITH_EIGEN=ON
这里如果出现ippicv_linux_20151201.tgz下载超时的错误,可以手动下载ippicv_linux_20151201.tgz
下载完后替换opencv-3.1.0/3rdparty/ippicv/downloads/linux-*目录下的同名文件,重新cmake
make -j8
参考
[1] OpenCV官方文档
[2] Build/Compile OpenCV v3.3 on Windows with CUDA 8.0, Intel MKL+TBB and python bindings
[3] Ubuntu16.04+cuda8.0rc+opencv3.1.0+caffe+Theano+torch7搭建教程
[4] ubuntu 18.04编译opencv3.4.3 with python3.6 cuda9.2 gdal
[5] ICV: Downloading ippicv_linux_20151201.tgz 超时
[6] OpenCV使能CUDA加速
最后
以上就是伶俐八宝粥为你收集整理的Ubuntu16.04下Python OpenCV with CUDA 安装及配置环境下载安装依赖库编译参考的全部内容,希望文章能够帮你解决Ubuntu16.04下Python OpenCV with CUDA 安装及配置环境下载安装依赖库编译参考所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复