Webcam
SUMMARY
The Webcam class provides a Python interface for USB webcams, supporting single-image capture, continuous video streaming, and remote control over BabyROS. It wraps OpenCV's VideoCapture to handle device connection, frame acquisition, and safe teardown.
Requirements: A USB webcam connected to your PC. No additional drivers or vendor SDKs are required.
Installation
- Install Medulla as described in the overview.
- Connect your USB webcam.
Getting Started
Connect your USB webcam and capture an image:
python
from medulla.cameras import webcam
camera = webcam.Webcam(name="my_webcam", camera_id=0)
camera.connect()
image = camera.capture_single_color_frame()
camera.disconnect()The camera_id is the integer index of the device as reported by the OS — 0 for the first camera, 1 for the second, and so on.
Examples
| Example | Description |
|---|---|
| Capture Single Image | Capture one color frame and visualize with Rerun |
| Stream Live Video | Stream continuous frames to a Rerun viewer |
| Publish Live Video with BabyROS | Control streaming remotely via BabyROS topics |

