async2v.components.opencv.video module

Summary

Classes:

Frame Container for a OpenCV video frame
SimpleDisplaySink Simple OpenCV-based display
VideoSource OpenCV video source component
VideoSourceConfig Configuration for the VideoSource component
VideoSourceConfigurator Configurator for the VideoSource component

Reference

class Frame(image, source)

Bases: object

Container for a OpenCV video frame

Next to the image, this class includes some convenience methods and the name of the video source.

image = None
Type:numpy.ndarray

OpenCV image

source = None
Type:str

Name of the source. For frames emitted by builtin components, this is the component id.

width

Width of image

Return type:int
height

Height of image

Return type:int
channels

Number of channels of image

Return type:int
class VideoSourceConfig(path, fps, resolution=None)

Bases: object

Configuration for the VideoSource component

path = None
Type:Union[str, int]

Path to video file (str) or camera index (int)

fps = None
Type:int

Frames per second

resolution = None
Type:Tuple[int, int]

Resolution (width, height)

class VideoSourceConfigurator

Bases: async2v.cli.Configurator

Configurator for the VideoSource component

static config_from_args(args)

Get configuration from argparse output

Return type:VideoSourceConfig
class VideoSource(config, key='source')

Bases: async2v.components.base.IteratingComponent

OpenCV video source component

Reads from a video file or a camera at a given framerate. The frames are pushed to the provided event key wrapped in Frame objects. Supports full command line configuration via VideoSourceConfigurator.

Parameters:
static configurator()

Convenience method to create a matching configurator

Return type:VideoSourceConfigurator
class SimpleDisplaySink(input_key)

Bases: async2v.components.base.EventDrivenComponent

Simple OpenCV-based display

Uses cv2.imshow to display frames. When the display has focus, pressing ESCAPE triggers shutdown of the application.

Parameters:input_key (str) – Event key of the input. Needs to provide Frame events to display.