def __init__(self, input_key: str, output_key: str): self.input: Latest[Frame] = Latest(key=input_key, trigger=True) self.keyboard: Buffer[KeyboardEvent] = Buffer(key=EventBasedKeyboardHandler.KEYBOARD_EVENT) self.output: Output[Frame] = Output(key=output_key) self.debug_output: Output[Frame] = Output(key=OPENCV_FRAME_EVENT) self._horizontal_flip_enabled = True self._vertical_flip_enabled = False
def __init__(self, layout: KeyboardLayout): """ :param layout: Use layout created by the `layout_from_args` method of the `KeyboardConfigurator` created for that concrete `KeyboardHandler` """ super().__init__(layout) self.keyboard = Output(self.KEYBOARD_EVENT) self.text = Output(self.KEYBOARD_EVENT) self.capture_trigger = Latest(self.CAPTURE_TEXT_TRIGGER)
def __init__(self, game): self.game = game self.node = 'start' self.selection = 0 self.keyboard = Buffer(EventBasedKeyboardHandler.KEYBOARD_EVENT, trigger=True) # type: Buffer[KeyboardEvent] self.text = Output('text') self.choices = Output('choices')
def __init__(self): self.source = Latest('source', trigger=True) # type: Latest[Frame] self.people = Latest('people') # type: Latest[List[Person]] self.output = Output('display') self.debug = Output(event.OPENCV_FRAME_EVENT) self.mouse = Buffer( EventBasedMouseHandler.MOUSE_EVENT) # type: Buffer[MouseEvent] self.mouse_move = LatestBy( EventBasedMouseHandler.MOUSE_MOVEMENT, lambda m: m.region.name) # type: LatestBy[MouseMovement]
def __init__(self): self.source = Latest('source', trigger=True) # type: Latest[Frame] self.output = Output('display') self.overlay = Output('overlay') self.mouse_movement = Buffer( EventBasedMouseHandler.MOUSE_MOVEMENT, trigger=True) # type: Buffer[MouseMovement] self.clear_canvas = Latest('trigger.clear_canvas', trigger=True) self.debug = Output(event.OPENCV_FRAME_EVENT) self._canvas = None self._last_position = None
def __init__(self, config: VideoSourceConfig, key: str = 'source'): """ :param config: Can be generated via `VideoSourceConfigurator` :param key: Event key of video output """ self._path = config.path self._target_fps = config.fps self.output = Output(key) self.debug_output = Output(event.OPENCV_FRAME_EVENT) self._executor = ThreadPoolExecutor(max_workers=1) self._resolution = config.resolution self._resolution_verified = False self._capture: cv2.VideoCapture = None
def __init__(self, source, projector, debug): self._background: cv2.BackgroundSubtractor = cv2.createBackgroundSubtractorMOG2( ) self._calibration_cycle_i = 0 self._initialize_pattern() self.source: Latest[Frame] = Latest(source, trigger=True) self.projector = Output(projector) if debug: self.debug = Output(event.OPENCV_FRAME_EVENT) else: self.debug = None self._last_calibrated = 0 self._transformation_matrix = None
def __init__(self, source): super().__init__(source) self.mouse_event: Buffer[MouseEvent] = Buffer( EventBasedMouseHandler.MOUSE_EVENT) self.reset_calibration = Output( ProjectorDriver2d.RESET_CALIBRATION_TRIGGER) self.clear_canvas = Output('trigger.clear_canvas') self._menu = Menu([ Label('Menu'), Button('Calibrate', self.calibrate), Button('Clear Canvas', self.clear), ], position=(1, 0))
def __new__(cls, *args, **kwargs): if cls.__name__ not in cls.__count: cls.__count[cls.__name__] = 0 __instance = super().__new__(cls) __instance._numeric_id = cls.__count[cls.__name__] __instance.logger = logwood.get_logger(__instance.id) __instance.__shutdown = Output(SHUTDOWN_EVENT) cls.__count[cls.__name__] += 1 return __instance
def __init__( self, source: str, overlay: str, projector: str = 'projector', config: ProjectorDriver2dConfiguration = ProjectorDriver2dConfiguration( )): """ :param source: Key of the video stream input. Needs to provide events with `Frame` payload. :param overlay: Key of the overlay input. Needs to provide events with `Frame` payload. :param projector: Key of projector output. `Frame` events are pushed to this output. :param config: Can be generated via `ProjectorDriver2dConfigurator` """ self._calibrator = _ProjectorCalibrator2d(source, projector, config.debug) super().__init__([self._calibrator]) self.overlay: Latest[Frame] = Latest(overlay, trigger=True) self.projector = Output(projector) self.reset = Latest(self.RESET_CALIBRATION_TRIGGER, trigger=True) self._calibration_started = False
def __init__(self): self.output = Output('sample')
def __init__(self, input_key: str, output_key: str): self.input: Latest[Frame] = Latest(key=input_key, trigger=True) self.output: Output[Frame] = Output(key=output_key) self.debug_output: Output[Frame] = Output(key=OPENCV_FRAME_EVENT) self.hog = cv2.HOGDescriptor() self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
def __init__(self, input_, output): self.input = Latest(input_, trigger=True) self.output = Output(output)
def __init__(self) -> None: super().__init__() self.output = Output('trigger')
def __init__(self, input_key: str, output_key: str): self.input: Latest[Frame] = Latest(key=input_key, trigger=True) self.output: Output[Frame] = Output(key=output_key) self.debug_output: Output[Frame] = Output(key=OPENCV_FRAME_EVENT)
def __init__(self): self.input: Latest[Frame] = Latest(key='source', trigger=True) self.debug_output: Output[Frame] = Output(key=OPENCV_FRAME_EVENT)
def __init__(self, in_key, out_key): self.input: Latest[Frame] = Latest(in_key, trigger=True) self.output: Output[Frame] = Output(out_key)
def __init__(self): self.item_source = Buffer('item_source', trigger=True) self.label = Latest('label') self.output = Output('sink')
def __init__(self): self._regions: List[MouseRegion] = [] self.event = Output(self.MOUSE_EVENT) self.movement = Output(self.MOUSE_MOVEMENT) self._last_region: MouseRegion = None self._last_position = (-1, -1)
def __init__(self, layout: KeyboardLayout): super().__init__(layout) self.state = Output('state') self.name = Output('name') self._name = 'World'
def __init__(self): self.source: Latest[Frame] = Latest('source', trigger=True) self.faces = Latest('faces') self.output: Output[Frame] = Output('terminator') self.debug_output: Output[Frame] = Output(OPENCV_FRAME_EVENT)
def __init__(self, data, name='sample'): self.output = Output(name) self.data = data.copy()
def __init__(self): self.input = Buffer('sample', trigger=True) self.output = Output('sample') self.log = []
def __init__(self): self.source = Latest('source', trigger=True) # type: Latest[Frame] self._hog = cv2.HOGDescriptor() self._hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) self.output = Output('people')
def __init__(self, input_, output): self.input = Latest(input_) self.output = Output(output)
def __init__(self): self.output = Output('item_source')
def __init__(self): self.source: Latest[Frame] = Latest('source', trigger=True) self.face_cascade = cv2.CascadeClassifier(self.FACE_CASCADE) self.output = Output('faces')
def __init__(self): self.output = Output('label')