As a developer, sometimes you need to build OpenCV from source to get the configuration desired. There is a script on the JetsonHacks Github account to help in the process. Looky here:
Background
JetPack can install a CPU and GPU accelerated version of the OpenCV libraries, called OpenCV4Tegra, on the Jetson. OpenCV4Tegra is version 2.4.13 as of this writing. This is great for many applications, especially when you are writing your own apps. However, some libraries require different modules and such that require upstream OpenCV versions.
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/buildOpenCVTX2.git
$ cd buildOpenCVTX2
$ ./buildOpenCV.sh
Once finished building, you are ready to install.
As explained in the video, navigate to the build directory to install the newly built libraries:
$ cd ~/opencv/build
$ 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 you OpenCV library paths correctly.
Notes
- This is meant to be a template for building your own custom version of OpenCV, pick and choose your own modules and options
- Most people do NOT have both OpenCV4Tegra and the source built OpenCV on their system. Some people have noted success using both however, check the forums.
- Sometimes the make tool does not build everything. Experience dictates to go back to the build directory and run make again, just to be sure
- Different modules and setting may require different dependencies, make sure to look for error messages when building.
- After building, you should run the tests. The build script includes the testing options. All tests may not pass.
- The build script adds support for Python 2.7
- The compiler assumes that the Jetson TX2 aarch64 (ARMv8) architecture is NEON enabled, therefore you do not have to enable the NEON flag for the build
The information for this script was gathered from several places:
The post Build OpenCV on the NVIDIA Jetson TX2 appeared first on JetsonHacks.