• Stars
    star
    140
  • Rank 260,012 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Scripts for build OpenCV on the NVIDIA Jetson Nano Developer Kit

buildOpenCV

Script for building OpenCV 4 on the NVIDIA Jetson Nano Developer Kit

Building for:

  • Jetson Nano
  • L4T 32.2.1/JetPack 4.2.2
  • OpenCV 4.1.1
  • Packaging Option ( Builds package by default; --no_package does not build package)

Note: The script does not check to see which version of L4T is running before building, understand the script may only work with the stated versions.

Building

This is a long build, you may want to write to a log file, for example:

$ ./buildOpenCV.sh |& tee openCV_build.log

While the build will still be written to the console, the build log will be written to openCV_build.log for later review.

On the Jetson Nano, this is a challenging build. There is not enough memory on the Nano to make with multiple jobs (i.e)

$ make -j4

without using a significant amount of swap file space. With L4T 32.2.1, there is a default swap space. However, if you are using a SD card, this can result in long compile times as both physcial memory and the swap file memory exhaust. Recommend using a USB drive for building. If you use a SD card, consider setting the environment variable NUM_JOBS in the buildOpenCV.sh script to 1. The build time may be longer, but you will not have the same amount of memory/SD card thrashing. If you are using a USB drive, you may want to add a swapfile: https://github.com/JetsonHacksNano/installSwapfile.

Note that if you are building for Python, you most definitely will benefit from building with a swap file and running on a USB drive. See: https://github.com/JetsonHacksNano/installSwapfile

Usage

usage: ./buildOpenCV.sh [[-s sourcedir ] | [-h]]
     -s | --sourcedir Directory in which to place the opencv sources (default $HOME ; this is usually ~/)
     -i | --installdir Directory in which to install opencv libraries (default /usr/local)
     --no_package Do not package OpenCV as .deb file (default is true)
     -h | --help Print help

Build Parameters

OpenCV is a very rich environment, with many different options available. Check the script to make sure that the options you need are included/excluded. By default, the buildOpenCV.sh script selects these major options:

  • CUDA on
  • GStreamer
  • V4L - (Video for Linux)
  • QT - (No gtk support built in)
  • Python 2 bindings
  • Python 3 bindings

Packaging

By default, the build will create a OpenCV package. The package file will be found in:

opencv/build/_CPACK_Packages/Linux/STGZ/OpenCV-4.1.1-<commit>-aarch64.sh

The advantage of packaging is that you can use the resulting package file to install this OpenCV build on other machines without having to rebuild. Whether the OpenCV package is built or not is controlled by the CMake directive CPACK_BINARY_DEB in the script.

Notes

November 2019, Initial Release

  • Jetson Nano
  • L4T 32.2.1/JetPack 4.2.2
  • OpenCV 4.1.1
  • Packaging Option ( Builds package by default; --no_package does not build package)

More Repositories

1

CSI-Camera

Simple example of using a CSI-Camera (like the Raspberry Pi Version 2 camera) with the NVIDIA Jetson Developer Kit
Python
808
star
2

installLibrealsense

Build and install Intel's librealsense for the NVIDIA Jetson Nano Developer Kit
Shell
149
star
3

installSwapfile

Install a swap file on the NVIDIA Jetson Nano Developer Kit. This should help with memory pressure issues.
Shell
142
star
4

rootOnUSB

Set rootfs to be on a USB drive
Shell
123
star
5

buildKernelAndModules

Build the Linux Kernel and Modules on board the NVIDIA Jetson Nano Developer Kit
Shell
85
star
6

installVSCode

Shell
78
star
7

installROS

Install ROS (Robot Operating System) Melodic on NVIDIA Jetson Nano Developer Kit
Shell
76
star
8

ServoKit

Install the Adafruit ServoKit Circuit Python library on the NVIDIA Jetson Nano Developer Kit
Python
59
star
9

UARTDemo

UART Demo Code
Python
50
star
10

installRealSenseROS

Install the realsense-ros library on NVIDIA Jetson Nano Developer Kit.
Shell
36
star
11

resizeSwapMemory

Resize the Zram swapfile on the Jetson Nano
Shell
36
star
12

gpuGraph

Simple moving graph of GPU activity for the Jetson Nano Developer Kit
Python
33
star
13

installArduinoIDE

Install the Arduino IDE on the NVIDIA Jetson Developer Kit.
Shell
25
star
14

SPI-Playground

23
star
15

build_python

Create .deb files for later versions of Python (3.9,3.10,3.11) for Jetson Linux - Ubuntu 18.04 - bionic
Shell
16
star
16

installPiOLED

Install the Adafruit PiOLED 128x32 Monochrome OLED driver
Python
16
star
17

logitech-f710-module

Install a module to enable the Logitech F710 game controller
Shell
2
star