Module src.streaming.stream_controller

Module that links an input stream to an output stream through a frame processor

Classes

class StreamController (interface: Union[int, str], num_hands: int, res: Tuple[int, int], annotate: bool, confidence_settings: Tuple[int, int], sound_control: bool = False)

A controller for stream objects. Input and output stream types need to be defined here. Implements begin, end and iterate_frames public methods

begin and end starts and stops whole program iterate_frames is the main program loop, reading a frame, processing it and drawing it to screen

Args

interface
Either path to videofile or webcam interface number
num_hands
Maximum number of hands to support
res
Resolution of processing on the form (width, height)
annotate
If True, adds annotations to stream
confidence_settings
Confidence threshold for mediapipe model
sound_control
If True, control sound with sliders

Methods

def iterate_frames(self) ‑> NoneType

Iterates over and processes every frame

Starts by initiating specified input and output streams. Frames are then read from the input stream, processed with frame processor and written to the output stream.

Once we stop receiving input frames or it is manually stopped, it will safely quit both input and output streams.