From 9b0b77278629c133032aab5371d67b0bd07d959d Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Thu, 20 Oct 2022 21:00:17 +0200 Subject: [PATCH] refactor: minor clean --- camera/depthai.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/camera/depthai.py b/camera/depthai.py index 6f99338..af8a2b1 100644 --- a/camera/depthai.py +++ b/camera/depthai.py @@ -14,9 +14,9 @@ import events.events_pb2 logger = logging.getLogger(__name__) -NN_PATH = "/models/mobile_object_localizer_192x192_openvino_2021.4_6shave.blob" -NN_WIDTH = 192 -NN_HEIGHT = 192 +_NN_PATH = "/models/mobile_object_localizer_192x192_openvino_2021.4_6shave.blob" +_NN_WIDTH = 192 +_NN_HEIGHT = 192 class ObjectProcessor: @@ -200,11 +200,11 @@ class PipelineController: logger.debug("wait for new frame") # Wait for frame - in_rgb = _get_as_imgframe(q_rgb) # blocking call, will wait until a new data has arrived + in_rgb: dai.ImgFrame = q_rgb.get() # blocking call, will wait until a new data has arrived frame_msg, now = self._frame_processor.process(in_rgb) # Read NN result - in_nn = _get_as_nndata(q_nn) + in_nn: dai.NNData = q_nn.get() self._object_processor.process(in_nn, frame_msg.id, now) def stop(self): @@ -214,15 +214,6 @@ class PipelineController: """ self._stop = True - -def _get_as_nndata(queue: dai.DataOutputQueue) -> dai.NNData: - return queue.get() - - -def _get_as_imgframe(queue: dai.DataOutputQueue) -> dai.ImgFrame: - return queue.get() - - def _bbox_to_object(bbox: np.array, score: float) -> events.events_pb2.Object: obj = events.events_pb2.Object() obj.type = events.events_pb2.TypeObject.ANY