Build and Install OpenCV 4.5.3 with CUDA 6.5 Enable on Jetson TK1
After previously we are successfully upgrade Ubuntu 14.04 to Ubuntu 16.04 on Jetson TK1 in here. I want to show you how to build OpenCV 4.5.3 (latest version when this tutorial created) with CUDA 6.5 enable. Just imagine a lot of new OpenCV feature that potentially able to run on top of Jetson TK1, like G-API, newer OpenCV DNN, newer CUDA module, etc.
Sadly, we can’t use OpenCV DNN with backend CUDA which requires cuDNN 7.5 or higher (last version cuDNN supported in Jetson TK1 in version 2.0). In addition some modules need to be turned off like cudastereo
, cudaimproc
and apps
. But the rest of remaining feature still available to use.
Prerequisites
- Upgrade your Jetson TK1 to Ubuntu 16.04 by following this tutorial,
- Ensure you can compile CUDA program using
nvcc
by following this tutorial,
- [Optional] Install OpenCL 1.2 (via PoCL 1.3) on Jetson TK1 by following this tutorial,
- [Optional] Install Ceres-Solver 2.0.0 + Eigen 3.3 on Jetson TK1 by following this tutorial,
- Remove all old opencv installed by JetPack (OpenCV4Tegra),
sudo apt-get purge libopencv*
sudo apt-get autoremove
Download & Build OpenCV 4.5.3
- Download this script as
build_opencv_4.5.3.sh
,
- Then run on Jetson TK1 terminal,
cd ~
sudo chmod +x build_opencv_4.5.3.sh
./build_opencv_4.5.3.sh
- Build process will take several hours to complete,
- Above script will automatically installing dependency libraries, configuring OpenCV using
cmake
, building & installing. - If you take a look into above
cmake
configuration on script, beside using CUDA, there is also use TBB for threading, OpenCL (quite useful if you want to use T-API in OpenCV), BLAS package (OpenBLAS, LAPACK, etc.), gstreamer , etc.
Troubleshooting Note
- If you are experiencing with this error,
Linking CXX executable ../../bin/opencv_version ../../lib/libopencv_core.so.4.5.3: undefined reference to "cv::erro(..."
- Just download
opencv_version
and other file form this drive,
- Then copying all that file into
build_opencv/opnecv/build/bin/
directories in Jetson TK1.