Skip to main content
The lerobot-find-cameras command detects OpenCV and Intel RealSense cameras, displays their capabilities, and captures test images.

Command

Location: src/lerobot/scripts/lerobot_find_cameras.py

Overview

This utility helps you:
  • Detect all connected cameras (OpenCV and RealSense)
  • View camera capabilities (resolution, FPS, format)
  • Identify camera indices and serial numbers
  • Capture test images from all cameras
  • Verify camera functionality before recording

Key Options

str
Optional filter: opencv or realsense. If omitted, shows all cameras.
str
default:"outputs/captured_images"
Directory to save test images.
float
default:"6.0"
Duration in seconds to capture test images.

Usage Examples

Detect All Cameras

This displays all OpenCV and RealSense cameras with their metadata:
  • Camera type and index/serial number
  • Default resolution and FPS
  • Video format (MJPG, YUYV, etc.)
  • USB connection type

Detect Only OpenCV Cameras

Example output:

Detect Only RealSense Cameras

Example output:

Capture Test Images

This:
  1. Detects all cameras
  2. Connects to each camera
  3. Captures images for 10 seconds
  4. Saves images to ./camera_test/
Output files are named: {camera_type}_{camera_id}.png Example:

Filter and Capture

Captures images only from OpenCV cameras for 5 seconds.

Camera Information

OpenCV Cameras

For each OpenCV camera, displays:
  • Type: Always “OpenCV”
  • Id: Camera index (0, 1, 2…) or device path (/dev/video4)
  • Backend: Video capture backend (V4L2, MSMF, etc.)
  • Default stream profile:
    • Width and height (pixels)
    • FPS (frames per second)
    • Format (MJPG, YUYV, H264, etc.)

RealSense Cameras

For each RealSense camera, displays:
  • Type: Always “RealSense”
  • Id: Camera serial number
  • Name: Camera model (e.g., “Intel RealSense D405”)
  • Firmware version: Current firmware version
  • USB type descriptor: USB connection type
  • Default stream profile:
    • Color stream resolution and FPS
    • Depth stream resolution and FPS (if available)

Common Use Cases

Identify Camera Indices for Recording

Before recording a dataset:
Use the displayed indices in your recording configuration:

Find RealSense Serial Numbers

Use the serial number in your configuration:

Verify Camera Functionality

Test cameras before a long recording session:
Check the saved images in ./test/ to verify:
  • All cameras are detected
  • Image quality is acceptable
  • No USB bandwidth issues
  • Correct camera orientation

Debug Camera Issues

If cameras aren’t detected:
  1. Run without filter to see all devices:
  2. Check if the camera appears but can’t connect:
    Look for connection errors in the output.
  3. Try specific camera type:

Troubleshooting

No Cameras Detected

OpenCV cameras:
  • Check USB connections
  • Verify camera permissions (Linux: add user to video group)
  • Try different USB ports
  • Close other applications using cameras
RealSense cameras:
  • Ensure pyrealsense2 is installed: pip install pyrealsense2
  • On Linux, install udev rules: sudo apt install librealsense2-dkms
  • Use USB 3.0 ports for best performance
  • Update firmware using Intel RealSense Viewer

Camera Found But Can’t Capture Images

  • Camera may be in use by another application
  • Insufficient USB bandwidth (try disconnecting other USB devices)
  • Driver issues (update camera drivers)
  • Wrong USB port (use USB 3.0 for high-resolution cameras)

Wrong Camera Index

On Linux, camera indices can change. Use device paths instead:
Or create udev rules for stable paths (see Camera Support).

Permission Denied (Linux)

Programmatic Usage

See Also