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

Install Medulla — see Installation. No additional drivers or vendor SDKs are required for USB webcams.

Getting Started

Connect your USB webcam and capture an image:

python
from telekinesis.medulla.cameras import webcam

camera = webcam.Webcam(name="my_webcam_camera", camera_id=0)
camera.connect()
image = camera.capture_color_image()
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

SkillDescription
Capture Color ImageCapture one color image and visualize with Rerun
Stream Live Color VideoStream continuous frames to a Rerun viewer
Publish Video with BabyROSStream and remotely control the camera over BabyROS topics