From 01e2c8ce16f70e3b62e40ee56ddf07d1a0b20ef7 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Sun, 28 Jan 2024 17:51:14 +0100 Subject: [PATCH] fix stereo filters --- camera/cli.py | 2 +- camera/oak_pipeline.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/camera/cli.py b/camera/cli.py index fe7b201..7357897 100644 --- a/camera/cli.py +++ b/camera/cli.py @@ -251,7 +251,7 @@ def execute_from_command_line() -> None: extended_disparity=args.stereo_mode_extended_disparity, subpixel=args.stereo_mode_subpixel, lr_check=args.stereo_mode_lr_check, - *stereo_filters), + stereo_filters=stereo_filters), disparity_processor=disparity_processor) def sigterm_handler(signum: int, frame: typing.Optional[ diff --git a/camera/oak_pipeline.py b/camera/oak_pipeline.py index 1172932..d8c3db9 100644 --- a/camera/oak_pipeline.py +++ b/camera/oak_pipeline.py @@ -6,8 +6,8 @@ import datetime import logging import pathlib import time -import typing from dataclasses import dataclass +from typing import List, Any import cv2 import depthai as dai @@ -97,7 +97,7 @@ class FrameProcessor: self._mqtt_client = mqtt_client self._frame_topic = frame_topic - def process(self, img: dai.ImgFrame) -> typing.Any: + def process(self, img: dai.ImgFrame) -> Any: """ Publish camera frames :param img: image read from camera @@ -421,7 +421,7 @@ class DepthSource(Source): extended_disparity: bool = False, subpixel: bool = False, lr_check: bool = True, - *filters: StereoDepthPostFilter + stereo_filters: List[StereoDepthPostFilter] = [] ) -> None: """ # Closer-in minimum depth, disparity range is doubled (from 95 to 190): @@ -456,10 +456,10 @@ class DepthSource(Source): self._depth.setSubpixel(subpixel) self._depth.disparity.link(self._xout_disparity.input) - if len(filters) > 0: + if len(stereo_filters) > 0: # Configure post-processing filters config = self._depth.initialConfig.get() - for filter in filters: + for filter in stereo_filters: filter.apply(config) self._depth.initialConfig.set(config) @@ -509,8 +509,8 @@ class MqttSource(Source): @staticmethod # pylint: disable=unused-argument - def _on_connect(client: mqtt.Client, userdata: MqttConfig, flags: typing.Any, - result_connection: typing.Any) -> None: + def _on_connect(client: mqtt.Client, userdata: MqttConfig, flags: Any, + result_connection: Any) -> None: # if we lose the connection and reconnect then subscriptions will be renewed. client.subscribe(topic=userdata.topic, qos=userdata.qos)