Build & Install OpenCV3.4.5 CUDA Enable on Jetson TK1 From Source

There are two option for installing OpenCV in Jetson TK1. First, is prebuild OpenCV library for L4T (OpenCV4Tegra). OpenCV4Tegra is a CPU & GPU optimized version of OpenCV, available as a prebuilt library in JetPack or as separate .deb packages (available for L4T rel-19 and L4T rel-21). Second, is building OpenCV from public release to get latest version OpenCV.

Prerequisites

  • Install Python3.7 on Jetson TK1 by referring to this article,
  • Install Git,
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
  • Remove all old opencv installed by JetPack (OpenCV4Tegra),
sudo apt-get purge libopencv*
sudo apt-get autoremove
  • Install Numpy package,
python3.7 -m pip install numpy --user

Build & Install OpenCV 3.4.5

  • Clone Jetson TK1 Learn Repository,
mkdir ~/Github
cd ~/Github
git clone https://github.com/Muhammad-Yunus/Jetson-TK1-Learn
cd Jetson-TK1-Learn/1_Install_OpenCV
  • Build & Install Jetson TK1,
sudo ./build_opencv_py3.7.sh
  • Wait until build & install process completed, it takes a few hours to complete.

Test OpenCV 3.4.5

  • Run OpenCV Build info,
cd ~/Jetson-TK1-Learn/1_Install_OpenCV
python3.7 opencv_buildinfo.py
  • The output should look like this,
  • After that we can play with other example inside ~/Jetson-TK1-Learn

Source

IoT Engineer, Software Developer & Machine Learning Enthusiast