agx编译cuda版opencv4.5.2
作者:互联网
参考https://github.com/mdegans/nano_build_opencv
1、下载opencv和opencv_contrib包
2、卸载原先opencv
sudo apt-get purge libopencv*
3、安装依赖
sudo apt-get install build-essential pkg-config libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt-get install qtbase5-dev
sudo apt-get install qtdeclarative5-dev
4、拷贝opencv_contrib到opencv目录下
5、cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/ -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -D CUDA_ARCH_BIN='7.2' -D WITH_CUDA=1 -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D OPENCV_GENERATE_PKGCONFIG=1 -D WITH_GTK_2_X=ON ..
需要根据实际情况修改contrib路径OPENCV_EXTRA_MODULES_PATH
可以参考以下配置进行选择
sudo apt-get install -y \
build-essential \
cmake \
git \
gfortran \
libatlas-base-dev \
libavcodec-dev \
libavformat-dev \
libavresample-dev \
libcanberra-gtk3-module \
libdc1394-22-dev \
libeigen3-dev \
libglew-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-good1.0-dev \
libgstreamer1.0-dev \
libgtk-3-dev \
libjpeg-dev \
libjpeg8-dev \
libjpeg-turbo8-dev \
liblapack-dev \
liblapacke-dev \
libopenblas-dev \
libpng-dev \
libpostproc-dev \
libswscale-dev \
libtbb-dev \
libtbb2 \
libtesseract-dev \
libtiff-dev \
libv4l-dev \
libxine2-dev \
libxvidcore-dev \
libx264-dev \
pkg-config \
python-dev \
python-numpy \
python3-dev \
python3-numpy \
python3-matplotlib \
qv4l2 \
v4l-utils \
v4l2ucp \
zlib1g-dev
cmake
-D BUILD_EXAMPLES=OFF
-D BUILD_opencv_python2=ON
-D BUILD_opencv_python3=ON
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=${PREFIX}
-D CUDA_ARCH_BIN=5.3,6.2,7.2
-D CUDA_ARCH_PTX=
-D CUDA_FAST_MATH=ON
-D CUDNN_VERSION='8.0'
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3
-D ENABLE_NEON=ON
-D OPENCV_DNN_CUDA=ON
-D OPENCV_ENABLE_NONFREE=ON
-D OPENCV_EXTRA_MODULES_PATH=/tmp/build_opencv/opencv_contrib/modules
-D OPENCV_GENERATE_PKGCONFIG=ON
-D WITH_CUBLAS=ON
-D WITH_CUDA=ON
-D WITH_CUDNN=ON
-D WITH_GSTREAMER=ON
-D WITH_LIBV4L=ON
-D WITH_OPENGL=ON"
..
如果编译时下载很慢,可以手动下载boost_desc那些文件并拷贝到opencv/build/download/xfeature2d下面
6、sudo make -j4
7、sudo make install
标签:sudo,OPENCV,opencv4.5,dev,opencv,CUDA,agx,get,cuda 来源: https://blog.csdn.net/qq_17127427/article/details/115860038