JetsonHacks

Build OpenCV on the NVIDIA Jetson TX1

OpenCV Jetson TX1

Note: This article has been superseded. Please see Build OpenCV 3.4 with CUDA on NVIDIA Jetson TX1.

With the deprecation of OpenCV4Tegra in L4T 28.1, developers may want to build OpenCV from source for their applications. There is a script on the JetsonHacks Github account to help in the process. Looky here:

Background

For some applications it makes sense to build OpenCV from source. OpenCV is a rich environment with many options. For example, the OpenCV libraries in the Ubuntu repositories currently do not include GPU acceleration for aarch64 machines. For the Jetson, with its built in GPU, it makes sense to build GPU support into the OpenCV library.

An earlier NVIDIA supplied version of OpenCV4Tegra provided a variety of optimizations for the OpenCV library. Over the course of the last couple of years these optimizations have migrated upstream. That means that the optimizations are now available in the public OpenCV library.

Installation

The community has gathered the recipe(s) for building OpenCV for version later than OpenCV 3.0. There is a repository on the JetsonHacks Github account which contains a build script to help in the process.

To download the source and build OpenCV:

$ git clone https://github.com/jetsonhacks/buildOpenCVTX1.git
$ cd buildOpenCVTX1
$ ./buildOpenCV.sh

Once finished building, you are ready to install.

Navigate to the build directory to install the newly built libraries:

$ cd ~/opencv/build

Note: As discussed in the video, due to the nature of the multi-processor make process, some files may not be compiled. It’s a good idea to run make again after switching to the build directory:

$ make

This takes an extra few minutes, but will round up any stragglers and save headaches down the road.

Now install:

$ sudo make install

Once you have generated the build files, you can use the ccmake tool to examine the different options and modules available.

Remember to setup your OpenCV library paths correctly after installation.

Notes

The information for this script was gathered from several places: