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:
objectContainer 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.
-
-
class
VideoSourceConfig(path, fps, resolution=None)¶ Bases:
objectConfiguration for the
VideoSourcecomponent-
fps= None¶ Type: int Frames per second
-
resolution= None¶ Type: Tuple[int, int] Resolution (width, height)
-
-
class
VideoSourceConfigurator¶ Bases:
async2v.cli.ConfiguratorConfigurator for the
VideoSourcecomponent-
static
config_from_args(args)¶ Get configuration from argparse output
Return type: VideoSourceConfig
-
static
-
class
VideoSource(config, key='source')¶ Bases:
async2v.components.base.IteratingComponentOpenCV 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
Frameobjects. Supports full command line configuration viaVideoSourceConfigurator.Parameters: - config (
VideoSourceConfig) – Can be generated viaVideoSourceConfigurator - key (
str) – Event key of video output
-
static
configurator()¶ Convenience method to create a matching configurator
Return type: VideoSourceConfigurator
- config (
-
class
SimpleDisplaySink(input_key)¶ Bases:
async2v.components.base.EventDrivenComponentSimple OpenCV-based display
Uses
cv2.imshowto display frames. When the display has focus, pressingESCAPEtriggers shutdown of the application.Parameters: input_key ( str) – Event key of the input. Needs to provideFrameevents to display.