jetson orin nano opencv 编译支持cuda

准备工作

#卸载
sudo apt purge libopencv*
sudo apt autoremove
sudo apt update

#安装依赖
sudo apt install build-essential cmake pkg-config unzip yasm git checkinstall
sudo apt install libjpeg-dev libpng-dev libtiff-dev
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libavresample-dev
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt install libxvidcore-dev x264 libx264-dev libfaac-dev libmp3lame-dev libtheora-dev 
sudo apt install libfaac-dev libmp3lame-dev libvorbis-dev
sudo apt install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt-get install libdc1394-22 libdc1394-22-dev libxine2-dev libv4l-dev v4l-utils

cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd ~

sudo apt-get install libgtk-3-dev
sudo apt-get install python3-dev python3-pip
sudo -H pip3 install -U pip numpy
sudo apt install python3-testresources

sudo apt install webp libwebp-dev

:sudo apt-get install libopenexr-dev

sudo apt-get install libtbb-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install libprotobuf-dev protobuf-compiler
sudo apt-get install libgoogle-glog-dev libgflags-dev
sudo apt-get install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen




下载安装 
 

cd 
mkdir opencv
cd opencv
wget  https://github.com/opencv/opencv/archive/refs/tags/4.5.4.zip
wget   https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.4.zip

#解压 
cd opencv-4.5.4
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE  \
        -D CMAKE_INSTALL_PREFIX=/usr/local  \
        -D BUILD_opencv_python3=ON  \
        -D WITH_FFMPEG=ON \
        -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 \
        -D WITH_TBB=ON \
        -D ENABLE_FAST_MATH=ON \
        -D CUDA_FAST_MATH=ON \
        -D WITH_CUBLAS=ON \
        -D WITH_CUDA=ON  \
        -D BUILD_opencv_cudacodec=OFF \
        -D WITH_CUDNN=ON \
        -D OPENCV_DNN_CUDA=ON  \
        -D CUDA_ARCH_BIN="7.2,8.7" \
        -D WITH_V4L=ON \
        -D WITH_QT=OFF \
        -D WITH_OPENGL=ON \
        -D WITH_GSTREAMER=ON  \
        -D OPENCV_GENERATE_PKGCONFIG=ON \
        -D OPENCV_ENABLE_NONFREE=ON \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.4/modules \
        -D INSTALL_PYTHON_EXAMPLES=OFF  \
        -D INSTALL_C_EXAMPLES=OFF \
        -D BUILD_EXAMPLES=OFF ..

make -j4

sudo make install


 

你可能感兴趣的:(python,opencv,人工智能)