Skip to content

vision

Autoupload

Bases: Enum

Configures the auto-submitting of images to the Learning Loop

ALL class-attribute instance-attribute

ALL = 'all'

submit all images which are run through the detector

DISABLED class-attribute instance-attribute

DISABLED = 'disabled'

no auto-submitting

FILTERED class-attribute instance-attribute

FILTERED = 'filtered'

only submit images with novel detections and in an uncertainty range (this is the default)

Events

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

CameraProjector

CameraProjector(
    camera_provider: CalibratableCameraProvider,
)

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], PersistentModule

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 a new image is available (argument: image)

ConfigurableCamera

ConfigurableCamera(**kwargs)

Bases: Camera

A generalized interface for adjusting camera parameters like exposure, brightness or fps.

Detector

Detector(*, name: Optional[str] = None)

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.

detect abstractmethod async

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

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

upload abstractmethod async

upload(image: Image, *, tags: list[str] = []) -> None

Uploads the image to the Learning Loop.

The tags are added to the image. If the image has detections, they are also uploaded.

Events

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

DetectorHardware

DetectorHardware(
    *, port: int = 8004, name: Optional[str] = None
)

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.

DetectorSimulation

DetectorSimulation(
    camera_provider: CalibratableCameraProvider,
    *,
    noise: float = 1.0,
    name: Optional[str] = None
)

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.

RtspCameraProvider

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

Bases: CameraProvider[RtspCamera], PersistentModule

This module collects and provides real RTSP streaming cameras.

SimulatedCameraProvider

SimulatedCameraProvider(simulate_failing: bool = False)

Bases: CameraProvider[SimulatedCamera], PersistentModule

This module collects and simulates cameras and generates synthetic images.

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

UsbCameraProvider

UsbCameraProvider()

Bases: CameraProvider[UsbCamera], PersistentModule

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.

camera_objects

camera_objects(
    camera_provider: CalibratableCameraProvider,
    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).