opencv_videocapture

OpenCV VideoCapture camera backend.

This module defines an OpenCV VideoCapture camera wrapper implementing the RGB camera interface. It provides a lightweight backend for webcams and video files, with configurable resolution and frame rate, and conversion utilities for consistent image formats used across robotblockset. The module is primarily intended for development, testing, and interface validation without specialized camera hardware.

Key functionalities include: - OpenCV VideoCapture integration through the RGBCamera interface. - Support for webcam devices and video-file input streams. - Configurable capture resolution and target frame-rate settings. - RGB image retrieval in float and uint8 formats via shared converters. - Optional intrinsics matrix support for calibration-aware workflows. - Context-managed resource handling for clean camera release.

class robotblockset.cameras.opencv_videocapture.OpenCVVideoCapture(video_capture_args: Tuple[Any] = (0,), intrinsics_matrix: ndarray | None = None, resolution: Tuple[int, int] = (640, 480), fps: int = 30)[source]

Bases: RGBCamera

Wrapper around OpenCV’s VideoCapture so we can test the camera interface without external cameras.

Initialize the base object state.

Returns:

This constructor initializes the object name and verbosity level.

Return type:

None

RESOLUTION_1080 = (1920, 1080)
RESOLUTION_720 = (1280, 720)
RESOLUTION_768 = (1024, 768)
RESOLUTION_480 = (640, 480)
property fps: int

The frames per second of the camera.

property resolution: Tuple[int, int]

The resolution of the camera, in pixels.

intrinsics_matrix() ndarray[source]

Obtain the intrinsics matrix of the camera.

Raises:

RuntimeError – You must explicitly pass an intrinsics object to the constructor.:

Returns:

CameraIntrinsicsMatrixType

Return type:

The intrinsics matrix.

Classes

OpenCVVideoCapture([video_capture_args, ...])

Wrapper around OpenCV's VideoCapture so we can test the camera interface without external cameras.