Stream Live Color Video
SUMMARY
Stream Live Color Video acquires continuous color frames in a loop, returning each frame as an Image ready to convert to NumPy, log, or process. Frame rate is bounded only by the device and any optional processing step. To publish frames to other processes instead, use start_image_stream() with BabyROS.
Available on: IDS, Webcam, Intel RealSense.
The Skill
image = camera.capture_image()Call repeatedly inside a loop. Each call returns the next frame as a datatypes.Image; use image.to_numpy() to get the pixel array.
To publish frames on the camera's BabyROS stream topic instead, call camera.start_image_stream(). It blocks the calling thread until camera.stop_image_stream() is called, so it is normally run on a camera server and controlled remotely. See Publish Video with BabyROS.
Example
IDS
Webcam
Intel RealSense
The Code
"""
Stream live color video from an IDS camera, with parameter tuning before
logging each frame to Rerun.
Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import time
from loguru import logger
import rerun as rr
from telekinesis.medulla.cameras import ids
def main():
camera = ids.IDSU336L0CX(name="my_ids_camera")
try:
rr.init("IDS_Video_Example", spawn=True)
camera.connect(serial_number="4108615854")
camera.set_parameter("OutputPixelFormat", "RGB_8")
camera.set_parameter("ExposureAuto", "Off")
camera.set_parameter("ExposureTime", 30000.0)
camera.set_parameter("AcquisitionFrameRate", 20.0)
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_image()
if image is None:
logger.warning("Image is none")
continue
rr.log("Continuous_Image_Capture", rr.Image(image.to_numpy()))
except Exception as e:
logger.error(f"Unable to stream video. {type(e).__name__}: {e}")
finally:
rr.disconnect()
camera.disconnect()
if __name__ == "__main__":
main()"""
Stream live color video from a webcam, logging each frame to Rerun.
Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import time
from loguru import logger
import rerun as rr
from telekinesis.medulla.cameras import webcam
def main():
camera = webcam.Webcam(name="my_webcam_camera")
try:
rr.init("Webcam_Example", spawn=True)
camera.connect(camera_id=0)
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_image()
rr.log("Continuous_Image_Capture", rr.Image(image.to_numpy()))
except Exception as e:
logger.error(f"Unable to stream video. {type(e).__name__}: {e}")
finally:
rr.disconnect()
camera.disconnect()
if __name__ == "__main__":
main()"""
Stream live color video from a RealSense camera, logging each frame to Rerun.
Run from a terminal to avoid issues with Rerun's spawn mode.
"""
import time
from loguru import logger
import rerun as rr
from telekinesis.medulla.cameras import realsense
from telekinesis.medulla.cameras.realsense import StreamProfile
def main():
camera = realsense.RealSenseD435I(name="my_realsense_camera")
try:
rr.init("RealSense_Video_Example", spawn=True)
camera.connect(serial_number="123456789012")
camera.set_parameter(
"stream_profile",
StreamProfile.from_strings("color", 1280, 720, "bgr8", 30),
)
end_time = time.time() + 10
while time.time() < end_time:
image = camera.capture_image()
if image is None:
logger.warning("Image is none")
continue
rr.log("Continuous_Image_Capture", rr.Image(image.to_rgb().to_numpy()))
except Exception as e:
logger.error(f"Unable to stream video. {type(e).__name__}: {e}")
finally:
rr.disconnect()
camera.disconnect()
if __name__ == "__main__":
main()Running the Example
python capture_video_example.pyA Rerun viewer opens automatically. Frames stream under Continuous_Image_Capture for 10 seconds, then the camera disconnects cleanly.
Parameter Configuration
capture_image() takes no required parameters. An optional undistort=True rectifies each frame with the camera's calibration (the intrinsic matrix and distortion coefficients must be set). The device to open is chosen in connect() — serial_number for IDS and RealSense, camera_id for the Webcam. IDS acquisition settings such as AcquisitionFrameRate and ExposureTime and the RealSense stream_profile are configured separately with set_parameter before the streaming loop starts.
Returns
| Type | Description |
|---|---|
datatypes.Image | Color frame. image.to_numpy() returns an array of shape (H, W, 3), dtype uint8. On RealSense the frame follows the configured stream format (bgr8 above), so call image.to_rgb() first to get RGB order. |
None | IDS and RealSense return None if a frame could not be retrieved for that call (e.g. a transient buffer or protocol error); the caller is expected to skip the frame and try again on the next call. |
Raises
| Exception | Condition |
|---|---|
RuntimeError | The camera is not connected (RealSense, Webcam). |
RuntimeError | Webcam only — a frame could not be read from the OpenCV device. |
RuntimeError | undistort=True was requested but the camera has no calibration. |
IDS does not raise on a capture failure; the error is logged internally and the call returns None instead.
Where to Use the Skill
- Live monitoring — display continuous video for inspection, calibration, or robot teleoperation.
- Vision pipelines that consume video — feed downstream modules such as Cornea with a live feed.
- Local debugging — when remote streaming over BabyROS isn't needed; for that, see Publish Video with BabyROS.