Jetson Nano Development Board - NanoCamera library

NanoCamera – A Python GStreamer Based Camera interface for the Jetson Nano

In this project, I developed the NanoCamera library, a simple to use camera interface for the Jetson Nano for working with USB, CSI, IP, and also RTSP cameras or streaming video in Python 3.

Introduction

The Jetson Nano is arguable one of the most promising AI development board launch in 2019. With support for GPU acceleration, the Jetson Nano opens new opportunities for real-time AI inference on the edge.

You can see below some of the cool projects I did with the Jetson Nano. The Jetson Nano is capable of anything, from powered your AI Robot or serving as your drone guide. The application limitation is left to your imagination.

Challenge

Working with the Jetson board is not always that easy ride sometimes especially handling camera-related projects. The Jetson provides various ways of interfacing with cameras (USB or CSI) using the GStreamer API (might be complicated for the average user) or you can always use OPENCV which doesn’t take advantage of the hardware acceleration the board has inbuilt.

Solution

Everyone uses Python nowadays, the logical step is to provide a way to easily interface with various cameras on the Jetson Nano using Python. Based on this and various challenges faced working with cameras in the past projects, I developed the NanoCamera Library.

A Simple program using NanCamera to read from the IP/MJPEG camera and display with OpenCV

The NanoCamera is a simple to use camera interface for the Jetson Nano for working with USB, CSI, IP and also RTSP cameras or streaming video in Python 3.

It currently supports the following types of camera or streaming source:

      • Works with CSI Cameras.
      • Works with various USB cameras.
      • Works with RTSP streaming camera and video with hardware acceleration (only supports H.264 video codec).
      • Works with IP Cameras(JPEG codec) or any MJPEG streaming source (Currently, supports CPU acceleration. TODO: Hardware acceleration)

The library has the following features:

      • It is OpenCV ready. The image file can be called directly with OpenCV imshow
      • The image file is a NumPy RGB array.
      • Support different Camera Flip Mode (Counterclockwise, Rotate 180 degrees, Clockwise – 90 degrees, Horizontal Flip, Vertical Flip)
      • It can be used with multiple cameras.
      • Support Frame rate enforcement. *Only available for USB, RTSP, and IP/MJPEG cameras.
      • Frame rate enforcement ensures the cameras work at the given frame rate using GStreamer video-rate plugin
      • It is based on Accelerated GStreamer Plugins
      • Should work with other Jetson boards like Jetson TX1, TX2 and others (Not tested)
      • Support both Hardware and CPU acceleration.
      • Easily read images as numpy arrays with image = camera.read()
      • Supports threaded read – available to all camera types. To enable a fast threaded read, you will need to enable the enforce_fps: enforce_fps = True

The Library is available on GitHub for download and further contribution. It is also on the PyPi platform, so a simple pip install can install the library on any device.

More information is available on the GitHub page.

Share this post

Add comment

Privacy Preference Center