Taking Your First Photo with a CSI or USB Camera

This guide walks through using CSI and USB cameras on Jetson, including previewing, capturing images, and recording video. It also explains how to access cameras from within Docker containers.

Supported Cameras

The Jetson Developer Kit has multiple interfaces for connecting cameras, including USB, Ethernet, and MIPI CSI-2. Popular cameras are supported out of the box, and the Jetson ecosystem partners support a wide range of add-on cameras.

Popular cameras supported out of the box include the IMX219 camera module (such as the Raspberry Pi Camera Module V2), Intel Realsense, and StereoLabs Zed 3D cameras, as well as standard USB webcams.

CSI Camera

For information on how to connect the ribbon cable for MIPI CSI-2 cameras, refer to the Jetson Nano 2GB Developer Kit User Guide.

Start Capturing and Previewing on the Screen

To check if the CSI camera is working properly, you can run the following command, which will start capturing and previewing the display on the screen.

nvgstcapture-1.0

This example command rotates the image 180 degrees (vertically flipped):

nvgstcapture-1.0 --orientation 2

Taking Photos and Saving to Disk

Runtime Command-Line Options

  1. nvgstcapture-1.0
    
  2. Press "j" to capture an image.

  3. Press "q" to exit.

Automatic Command-Line Options

nvgstcapture-1.0 --automate --capture-auto

Use "nvgstcapture-1.0 --help" to refer to the supported command-line options.

Capturing Videos and Saving to Disk

Runtime Command-Line Options

  1. nvgstcapture-1.0
    
  2. Press "1" to start recording video.

  3. Press "0" to stop recording video.

  4. Press "q" to exit.

Automatic Command-Line Options

bash

nvgstcapture-1.0 --mode=2 --automate --capture-aut

Use "nvgstcapture-1.0 --help" to refer to the supported command-line options.

Using the Camera in Docker

The commands are the same; you just need to add this option to the command line when starting the container with "docker run":

--volume /tmp/argus_socket:/tmp/argus_socket

USB Camera

Start Capturing and Previewing on the Screen

You need to tell nvgstcapture where to find your USB camera device (instead of the default CSI camera).

# V4L2 USB camera (where <N> is the /dev/videoN node)
nvgstcapture-1.0 --camsrc=0 --cap-dev-node=<N>

Taking Photos and Saving to Disk

Runtime Command-Line Options

  1. nvgstcapture-1.0 --camsrc=0 --cap-dev-node=<N> (where N is the /dev/videoN Node)
    
  2. Press "j" to capture an image.

  3. Press "q" to exit.

Automatic Command-Line Options

nvgstcapture-1.0 --camsrc=0 --cap-dev-node=<N> --automate --capture-auto (where N is the /dev/videoN Node)

Use "nvgstcapture-1.0 --help" to refer to the supported command-line options.

Capturing Videos and Saving to Disk

Runtime Command-Line Options

  1. nvgstcapture-1.0 --mode=2 --camsrc=0 --cap-dev-node=<N> (where N is the /dev/videoN Node)
    
  2. Press "1" to start recording video.

  3. Press "0" to stop recording video.

  4. Press "q" to exit.

Automatic Command-Line Options

nvgstcapture-1.0 --mode=2 --camsrc=0 --cap-dev-node=<N> --automate --capture-auto (where N is the /dev/videoN Nod

Using the Camera in Docker

When you start the container with "docker run", mount the corresponding /dev/video* device by adding the following option to the command line:

--device /dev/video0

The above assumes your V4L2 USB camera is /dev/video0.

Useful Resources

Was this article helpful?

TOP