Skip to content

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

  1. Install Medulla as described in the overview.
  2. 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

ExampleDescription
Capture Single ImageCapture one color frame and visualize with Rerun
Stream Live VideoStream continuous frames to a Rerun viewer
Publish Live Video with BabyROSControl streaming remotely via BabyROS topics