Загрузка страницы

OpenCV GPU-CUDA installation on Ubuntu

After watching that video, you will be able to use OpenCV accelerated by GPU. You can also use this tutorial for Nvidia Jetson Developer Computers.
#Nvidia #Cuda #OpenCV
Thanks for watching.

This method is tested on my laptop, Jetson TX2, and Jetson Xavier NX
Taken from: https://github.com/AastaNV/JEP/tree/acb3b34b4a3f39b3acd2000ac93abe86518df333
Improved by me :)

1- First, install requirements:

sudo apt 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 python-dev python-numpy
sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y curl
sudo apt-get install -y libboost-all-dev

2- Then, download Open-cv files, unzip them, and create a build file

curl -L https://github.com/opencv/opencv/archive/3.4.1.zip -o opencv-3.4.1.zip
unzip opencv-3.4.1.zip
cd opnecv-3.4.1
mkdir build && cd build

3- Create build files
For CUDA_ARCH_BIN="x.x" , you must to the correct gpu compute capabilities of the system on: https://developer.nvidia.com/cuda-gpus (Xavier nx 7.2)

cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="6.2" -D CUDA_ARCH_PTX="" -D WITH_GSTREAMER=ON -D WITH_LIBV4L=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 ..

4- And then, compile the library.
To speed up the compile of the library, we need to specify the number of CPU cores in our system, otherwise, you can just use 1 core with no problems.
For example, I have 8 cores.

nproc
-: 8
make -j8

This step is where you face the errors, usually a quick google search and a re-build fixes most of the errors.

5- Finally, install Opec-CV 3.4.1

sudo make install
Errors:
fatal error: dynlink_nvcuvid.h: No such file or directory
#include (dynlink_nvcuvid.h)

Solution:
Replace step 3 with:
cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="6.2" -D CUDA_ARCH_PTX="" -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -DBUILD_opencv_cudacodec=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..

And remember to use the appropriate CUDA_ARCH_BIN value for your GPU.

Видео OpenCV GPU-CUDA installation on Ubuntu канала Robotics and Perception Team
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
13 августа 2021 г. 22:00:12
00:08:04
Яндекс.Метрика