Jetson Nano编译安装带cuda的opencv4.x 和opencv_contrib4.x

1. 卸载自带的opencv

#通过dpkg -l查看所安装的opencv库
 
dpkg -l | grep -i opencv
#看到相关的opencv就可以用apt-get来卸载了
#移除相关libopencv库
 
sudo apt-get remove libopencv*

2. 下载opencv和opencv_contrib

git clone https://gitee.com/mirrors/opencv.git
git clone https://gitee.com/mirrors/opencv_contrib.git

3. 安装依赖库

sudo apt-get update
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy
sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y curl

4. 编译安装opencv

mkdir release
cd release/
cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j3
sudo make install

5. 安装python-opencv

sudo apt-get install -y python-opencv python3-opencv

 

编译报错解决办法:

1. fatal error: boostdesc_bgm.i: 没有那个文件或目录

https://www.cnblogs.com/zhang-hongbo/p/12859405.html

你可能感兴趣的:(linux,python,opencv,深度学习,神经网络)