Configuring A Jetson Nano with the Stereo Labs Zed Camera

Zed camera with Jetson Nano

GETTING STARTED

1. Hardware Setup

Since we’ll be using our Nano with the ZED camera, we’ll want to make sure we’ve got enough juice to power the both of them. We ran into some initial issues from powering the Nano from its USB port using a 2A power adapter, but this wasn’t enough and would shut down as soon as we turned on the camera.

As seen above, it was recommended that you use the open header pins which allows up to 6A, or the 5.5×2.1mm barrel plug which allows up to 4A. JetsonHacks has a detailed writeup on the various ways to power your board.

For our setup, we used this 5V @ 5A Power Supply from Amazon that costs only $13.99. In order for the board to accept this power, you need to jumper the pins on J48. 

Now onto the fun stuff…

Install J48 jumper to enable power from the barrel or header pins.

2. Prepping the OS

Following the Getting Started instructions over at NVIDIA, we installed the Jetson Nano Developer Kit SD Card Image onto a 32GB microSD Card (16GB UHS-1 minimum). If you’re on a Mac like we are, you could use Etcher to write your image onto the uSD card. When your uSD card is ready, insert it into the Nano and boot it up. 

Note: the card slot may not be as obvious at first, but it’s under the heat sink in between the two boards. See image below. You know the Nano is on when the green LED next to the usb port is lit. 

 

3. Baseline

This is your opportunity to make sure you have all of your updates taken care of and set up your baseline. You should have configured all the basic system settings by now and you’ll have a good starting point.

The image comes with NVIDIA’s JetPack 4.2 which is based off of Ubuntu 18.04 (LTS Kernel 4.9) and has the NVIDIA drivers installed along with the following packages:

  • TensorRT
  • cuDNN
  • CUDA Toolkit
  • VisionWorks
  • GStreamer
  • and OpenCV

4. Installing ZED SDK

The Jetson Nano will need an Internet connection to install the ZED SDK as it downloads a number of dependencies.

Download the ZED SDK for Jetson Nano and install it by running this command and following the instructions that appear:

>chmod +x ZED_SDK*

>./ZED_SDK_JNANO_BETA_v2.7.1.run.

Once installed, you can test it by running the ZED Explorer application. This app will let you play around with the settings and view the two cameras. To run it, enter the following commands:

>cd /usr/local/zed/tools/

>./’ZED Explorer’

6. Installing ZED Python API

We want to play around with the ZED using Python, so we’ll be installing the Python API. The ZED SDK needs to already be installed. Then we can proceed to install the remainder of the pre-requisites.

Prerequisites

  • ZED SDK 2.8 and its dependency CUDA
  • Python 3.5+ (x64). (Windows installer)
  • C++ compiler (VS2015 recommended)
  • Cython 0.26
  • Numpy 1.13.1

Instructions to installing the ZED Python API can be found here:

The Python install script is located on Windows in C:\Program Files (x86)\ZED SDK\ (make sure you have admin access to run it in the Program Files folder). On Linux it is located in /usr/local/zed/

$ cd "/usr/local/zed/"
$ python get_python_api.py

    # The script displays the detected platform versions
    CUDA 10.0
    Platform ubuntu18
    ZED 3.1
    Python 3.7
    # Downloads the whl package
    Downloading python package from https://download.stereolabs.com/zedsdk/3.1/ubuntu18/cu100/py37 ...

    # Gives instruction on how to install the downloaded package
    File saved into pyzed-3.1-cp37-cp37m-linux_x86_64.whl
    To install it run :
      python3 -m pip install pyzed-3.1-cp37-cp37m-linux_x86_64.whl

Change directories to the newly cloned folder and install the required dependencies.

$ python3 -m pip install pyzed-3.1-cp37-cp37m-linux_x86_64.whl

    Processing ./pyzed-3.1-cp37-cp37m-linux_x86_64.whl
    Installing collected packages: pyzed
    Successfully installed pyzed-3.1

If everything installed without errors, then you can go ahead and run the examples which will be our starting point for our next project.

We ran the Live Camera example, which is what we’ll be pulling into our next project for facial recognition + proximity sensing.

python examples/live_camera.py

Some Potential Issues

Jetson nano shuts off when turning on the camera: Not enough power will cause a shutdown/power off. example using USB power adapter that may only be 1-2A capable

Viewing zed explorer through vnc causes color issues and some console errors. 

Next project: Face detection + proximity sensor using the ZED camera (based off Adam Geitgey’s Example + ZED Python API Live Camera Sample)

2 comments

  1. mucahid

    Hello,
    I get the error when I run these commands.

    python3: can’t open file ‘setup.py’: [Errno 2] No such file or directory

    python3 setup.py build
    python3 setup.py install

    Could you please tell me the solution?

    1. suprnrdy

      Hi Mucahid,

      Looks like they updated how to install the scripts for Python API. If you go here: https://github.com/stereolabs/zed-python-api. I’ll make sure to update the page, thanks! The instructions to install are as follows:


      $ cd "/usr/local/zed/"
      $ python get_python_api.py

      # The script displays the detected platform versions
      CUDA 10.0
      Platform ubuntu18
      ZED 3.1
      Python 3.7
      # Downloads the whl package
      Downloading python package from https://download.stereolabs.com/zedsdk/3.1/ubuntu18/cu100/py37 ...

      # Gives instruction on how to install the downloaded package
      File saved into pyzed-3.1-cp37-cp37m-linux_x86_64.whl
      To install it run :
      python3 -m pip install pyzed-3.1-cp37-cp37m-linux_x86_64.whl

Leave a Reply

Your email address will not be published. Required fields are marked *