filmov
tv
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
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
cd opnecv-3.4.1
mkdir build && cd build
3- Create build files
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.
#Nvidia #Cuda #OpenCV
Thanks for watching.
This method is tested on my laptop, Jetson TX2, and Jetson Xavier NX
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
cd opnecv-3.4.1
mkdir build && cd build
3- Create build files
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.
Комментарии