lerobot-find-cameras command detects OpenCV and Intel RealSense cameras, displays their capabilities, and captures test images.
Command
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
Optional filter:
opencv or realsense. If omitted, shows all cameras.Directory to save test images.
Duration in seconds to capture test images.
Usage Examples
Detect All Cameras
- Camera type and index/serial number
- Default resolution and FPS
- Video format (MJPG, YUYV, etc.)
- USB connection type
Detect Only OpenCV Cameras
Detect Only RealSense Cameras
Capture Test Images
- Detects all cameras
- Connects to each camera
- Captures images for 10 seconds
- Saves images to
./camera_test/
{camera_type}_{camera_id}.png
Example:
Filter and Capture
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:Find RealSense Serial Numbers
Verify Camera Functionality
Test cameras before a long recording session:./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:-
Run without filter to see all devices:
-
Check if the camera appears but can’t connect:
Look for connection errors in the output.
-
Try specific camera type:
Troubleshooting
No Cameras Detected
OpenCV cameras:- Check USB connections
- Verify camera permissions (Linux: add user to
videogroup) - Try different USB ports
- Close other applications using cameras
- Ensure
pyrealsense2is 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:Permission Denied (Linux)
Programmatic Usage
See Also
- Camera Support - Camera configuration and usage
- lerobot-record - Record datasets with cameras
- Robot API - Robot and camera integration