AFL.automation.vision.PiCameraDriver#

A server-facing driver for Raspberry Pi cameras using Picamera2.

Classes

Driver(name[, defaults, overrides, ...])

ImageProcessing()

Provide circular ROI, RGB, background, and turbidity processing.

Path(*args, **kwargs)

PurePath subclass that can make system calls.

PiCameraDriver([camera, overrides, name, ...])

Capture still images from a Raspberry Pi camera.

datetime(year, month, day[, hour[, minute[, ...)

The year, month and day arguments are required.

timezone

Fixed offset from UTC implementation of tzinfo.

class AFL.automation.vision.PiCameraDriver.PiCameraDriver(camera=None, overrides=None, name='PiCameraDriver', initialize_driver=True)[source]#

Capture still images from a Raspberry Pi camera.

picamera2 is loaded only when a real camera is constructed, so this module can be imported on development machines and in test environments without Raspberry Pi camera support. A camera-like object may be supplied to the constructor for testing; it must provide capture_array and/or capture_file.

defaults = {'image_format': 'jpg', 'output_dir': 'camera_images', 'resolution': [1920, 1080], 'stream_address': '127.0.0.1:8000', 'stream_bitrate': 10000000, 'warmup_seconds': 1.0}#
__init__(camera=None, overrides=None, name='PiCameraDriver', initialize_driver=True)[source]#

Create the driver and initialize a real Picamera2 when needed.

capture(save=False, filename=None)[source]#

Take one image, optionally saving it to the configured output directory.

When save is false, the captured image is placed in the driver’s dropbox and the returned image_uid can be retrieved through the API server. When save is true, Picamera2 writes the image directly and the returned path identifies the saved file.

start_streaming(address=None)[source]#

Start an H.264 TCP stream listener at address.

When omitted, address uses the configured stream_address (127.0.0.1:8000 by default). It must be host:port (for example 0.0.0.0:8000). The driver listens immediately, and begins streaming only after one client connects. It does not start automatically during driver setup.

stop_streaming()[source]#

Stop the active video stream listener and disconnect its client.

close()[source]#

Stop and close a camera created by this driver.

status()[source]#

Return cheap, serializable camera state.