Skip to content

vision

CameraProjector

CameraProjector(camera_provider: CameraProvider)

The camera projector computes a grid of projected image points on the ground plane.

It is mainly used for visualization purposes.

CameraProvider

CameraProvider()

Bases: Generic[T]

A camera provider holds a dictionary of cameras and manages additions and removals.

The camera dictionary should not be modified directly but by using the camera provider's methods. This way respective events are emitted and consistency can be taken care of.

The camera provider also creates an HTTP route to access camera images.

Events

Name Description
CAMERA_ADDED a new camera has been added (argument: camera)
CAMERA_REMOVED a camera has been removed (argument: camera id)
NEW_IMAGE an new image is available (argument: image)

Detector

Detector()

Bases: ABC

A detector allows detecting objects in images.

It also holds an upload queue for sending images with uncertain results to an active learning infrastructure like the Zauberzeug Learning Loop.

Events

Name Description
NEW_DETECTIONS detection on an image is completed (argument: image)

DetectorHardware

DetectorHardware(*, port: int = 8004)

Bases: Detector

This detector communicates with a YOLO detector via Socket.IO.

It automatically connects and reconnects, submits and receives detections and sends images that should be uploaded to the Zauberzeug Learning Loop.

detect async

detect(
    image: Image,
    autoupload: Autoupload = Autoupload.FILTERED,
    tags: list[str] = [],
) -> None

Runs detections on the image. Afterwards the image.detections property is filled.

DetectorSimulation

DetectorSimulation(
    camera_provider: CameraProvider, *, noise: float = 1.0
)

Bases: Detector

This detector simulates object detection.

It requires a camera provider in order to check visibility using the cameras' calibrations. Individual camera IDs can be added to a set of blocked_cameras to simulate occlusions during pytests. A list of simulated_objects can be filled to define what can be detected. An optional noise parameter controls the spatial accuracy in pixels.

MultiCameraProvider

MultiCameraProvider(*camera_providers: CameraProvider)

Bases: CameraProvider

A multi-camera provider combines multiple camera providers into one.

This is useful if another module requires a single camera provider but the robot has multiple camera sources like USB and WiFi cameras.

RtspCameraProviderHardware

RtspCameraProviderHardware(
    *, frame_rate: int = 6, jovision_profile: int = 0
)

Bases: CameraProvider

This module collects and provides real RTSP streaming cameras.

UsbCameraProviderHardware

UsbCameraProviderHardware()

Bases: CameraProvider

This module collects and provides real USB cameras.

Camera devices are discovered through video4linux (v4l) and accessed with openCV. Therefore the program v4l2ctl and openCV (including python bindings) must be available.

UsbCameraProviderSimulation

UsbCameraProviderSimulation()

Bases: CameraProvider

This module collects and simulates USB cameras and generates synthetic images.

In the current implementation the images only contain the camera ID and the current time.

camera_objects

camera_objects(
    camera_provider: CameraProvider,
    camera_projector: CameraProjector,
    *,
    px_per_m: float = 10000,
    debug: bool = False
)

Bases: Group

This module provides a UI element for displaying cameras in a 3D scene.

It requires a camera provider as a source of cameras as well as a camera projector to show the current images projected on the ground plane. The px_per_m argument can be used to scale the camera frustums. With debug=True camera IDs are shown (default: False).