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
-
nvgstcapture-1.0 -
Press "j" to capture an image.
-
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
-
nvgstcapture-1.0 -
Press "1" to start recording video.
-
Press "0" to stop recording video.
-
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
-
nvgstcapture-1.0 --camsrc=0 --cap-dev-node=<N> (where N is the /dev/videoN Node) -
Press "j" to capture an image.
-
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
-
nvgstcapture-1.0 --mode=2 --camsrc=0 --cap-dev-node=<N> (where N is the /dev/videoN Node) -
Press "1" to start recording video.
-
Press "0" to stop recording video.
-
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
- The jetson-inference project on GitHub includes camera APIs for Python and C++ that can stream CSI and USB cameras, RTP/RTSP, and video files. For more information, refer to Camera Streaming and Multimedia.
- For a directory of cameras compatible with Jetson, refer to the Jetson Partner-Supported Cameras page.
Was this article helpful?
