The Jetson Nano’s CSI camera interface supports MIPI CSI-2 cameras at much higher bandwidth than USB webcams. Setting up a CSI camera on Jetson Nano requires the right driver, libargus configuration, and GStreamer pipeline. This tutorial covers compatible cameras, driver installation, testing with nvgstcapture, and writing Python code using OpenCV and Jetson.Utils for real-time AI inference on camera feeds.
Table of Contents
- Jetson Nano CSI Interface Explained
- Compatible CSI Cameras
- Driver Installation
- GStreamer Pipeline for CSI Camera
- OpenCV Python Code for CSI Camera
- Using Jetson.Utils for AI Inference
- Troubleshooting Common Issues
- FAQ
Jetson Nano CSI Interface Explained
The Jetson Nano has two CSI connectors: CAM0 (15-pin) and CAM1 (15-pin), both MIPI CSI-2 2-lane. Maximum supported data rate is 1.5 Gbps per lane. CSI cameras bypass USB overhead and connect directly to Jetson’s ISP (Image Signal Processor) – part of the Tegra SoC. The ISP handles auto-exposure, white balance, and noise reduction in hardware, freeing CPU cycles for inference. Important note: CSI cameras for Raspberry Pi use the same physical connector but may have different pin assignments – always verify pinout compatibility before connecting.
Compatible CSI Cameras
Waveshare IMX219-77 Camera for Jetson Nano
IMX219-based camera specifically tested with Jetson Nano. 77-degree FOV, 8MP resolution. Works out of the box with JetPack 4.6+ – no custom driver required. CSI connector compatible with Jetson Nano CAM0/CAM1.
Waveshare IMX219-160 Wide Angle for Jetson Nano
IMX219 with 160-degree FOV, compatible with Jetson Nano. Wide angle ideal for robotics and surveillance applications. Driver included in JetPack 4.6+ kernel.
Driver Installation
IMX219 and IMX477 drivers are included in JetPack 4.6 and later. Verify driver is loaded:
# Check if CSI camera is detected
ls /dev/video*
# Should show /dev/video0 (CAM0) and /dev/video1 (CAM1)
# Check driver is loaded
dmesg | grep imx219
# Expected output:
# [ 2.345678] imx219 9-0010: imx219 detected at address 0x10
# If not detected, check cable connection (blue side faces away from board on Jetson Nano)
# Verify JetPack version
sudo apt-cache show nvidia-jetpack | grep Version
GStreamer Pipeline for CSI Camera
The Jetson Nano uses GStreamer with nvarguscamerasrc for CSI cameras. Test with nvgstcapture:
# Test CSI camera capture (CAM0)
nvgstcapture-1.0 --sensor-id=0
# GStreamer pipeline for display
gst-launch-1.0 nvarguscamerasrc sensor-id=0 !
'video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12,framerate=30/1' !
nvvidconv ! nvegltransform ! nveglglessink -e
# GStreamer pipeline for 720p display
gst-launch-1.0 nvarguscamerasrc sensor-id=0 !
'video/x-raw(memory:NVMM),width=1280,height=720,framerate=60/1' !
nvvidconv ! nvegltransform ! nveglglessink -e
OpenCV Python Code for CSI Camera
OpenCV cannot directly access CSI cameras – use GStreamer pipeline as input source:
import cv2
def gstreamer_pipeline(
sensor_id=0, capture_width=1280, capture_height=720,
display_width=640, display_height=480, framerate=30, flip_method=0
):
return (
f'nvarguscamerasrc sensor-id={sensor_id} ! '
f'video/x-raw(memory:NVMM), width=(int){capture_width}, height=(int){capture_height}, '
f'framerate=(fraction){framerate}/1 ! '
f'nvvidconv flip-method={flip_method} ! '
f'video/x-raw, width=(int){display_width}, height=(int){display_height}, format=(string)BGRx ! '
f'videoconvert ! video/x-raw, format=(string)BGR ! appsink'
)
cap = cv2.VideoCapture(gstreamer_pipeline(), cv2.CAP_GSTREAMER)
if not cap.isOpened():
print('Failed to open camera. Check cable and driver.')
exit()
print('CSI camera opened successfully')
while True:
ret, frame = cap.read()
if not ret:
print('Failed to read frame')
break
cv2.imshow('CSI Camera', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Using Jetson.Utils for AI Inference
For AI projects, Jetson-Inference library’s jetson.utils gives GPU-accelerated camera access:
import jetson.utils
import jetson.inference
# Open CSI camera with jetson.utils
camera = jetson.utils.videoSource('csi://0', argv=['--input-flip=none'])
display = jetson.utils.videoOutput('display://0')
# Load classification network (runs on GPU)
net = jetson.inference.imageNet('googlenet')
while display.IsStreaming():
img = camera.Capture()
class_idx, confidence = net.Classify(img)
class_desc = net.GetClassDesc(class_idx)
print(f'Classified: {class_desc} ({confidence:.1%})')
display.Render(img)
display.SetStatus(f'{class_desc} | {confidence:.1%} | {net.GetNetworkFPS():.0f} FPS')
Arducam IMX219 Camera Module
IMX219 sensor compatible with both Jetson Nano and Raspberry Pi. Solid choice if you work across both platforms. 8MP resolution, good dynamic range for outdoor robotics projects in India.
Troubleshooting Common Issues
No /dev/video device: Check cable – the blue side of the FPC ribbon should face away from the Jetson Nano board. Reboot after reconnecting the cable.
nvarguscamerasrc fails: Kill any other processes using the camera: sudo fuser -k /dev/video0. Only one process can access the CSI camera at a time.
Green/purple tint in image: Add nvvidconv to the pipeline with proper format conversion. Also verify the format string is BGRx not BGR before the final videoconvert step.
Low frame rate: Reduce capture resolution. At 1920×1080, CSI camera is limited to 30 FPS. Use 1280×720 for 60 FPS or 640×480 for 120 FPS on IMX219.
FAQ
Can I use Raspberry Pi Camera Module 3 on Jetson Nano?
Raspberry Pi Camera Module 3 uses IMX708 sensor which is NOT supported by Jetson Nano drivers. Use Camera Module 2 (IMX219) or Arducam/Waveshare IMX219 cameras that have Jetson Nano drivers.
How do I use both CSI cameras simultaneously?
Create two VideoCapture objects with different sensor_id values (0 and 1) using the gstreamer_pipeline function. Run in separate threads for parallel capture.
What is the maximum resolution on Jetson Nano CSI?
With IMX219: 3280×2464 at 21 FPS in still capture mode. For video: 1920×1080 at 30 FPS or 1280×720 at 60 FPS.
Can I use USB webcam instead of CSI?
Yes, USB webcams work fine with cv2.VideoCapture(0). CSI cameras are preferred for AI projects as they use the hardware ISP and can connect to the hardware video encoder for efficient H.264 recording.
Add comment