From e4852821ec19c93c885b966ca572387fea80c491 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sat, 16 Apr 2022 07:52:26 -0500 Subject: [PATCH] Pass to constructor --- frigate/motion.py | 4 ++-- frigate/video.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frigate/motion.py b/frigate/motion.py index d426d681d..7219db93f 100644 --- a/frigate/motion.py +++ b/frigate/motion.py @@ -5,7 +5,7 @@ from frigate.config import MotionConfig class MotionDetector: - def __init__(self, frame_shape, config: MotionConfig): + def __init__(self, frame_shape, config: MotionConfig, improve_contrast_enabled): self.config = config self.frame_shape = frame_shape self.resize_factor = frame_shape[0] / config.frame_height @@ -24,7 +24,7 @@ class MotionDetector: ) self.mask = np.where(resized_mask == [0]) self.save_images = False - self.improve_contrast = self.config.improve_contrast + self.improve_contrast = improve_contrast_enabled.value def detect(self, frame): motion_boxes = [] diff --git a/frigate/video.py b/frigate/video.py index b3e40fbdb..f6960414d 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -354,7 +354,7 @@ def track_camera( objects_to_track = config.objects.track object_filters = config.objects.filters - motion_detector = MotionDetector(frame_shape, config.motion) + motion_detector = MotionDetector(frame_shape, config.motion, improve_contrast_enabled) object_detector = RemoteObjectDetector( name, labelmap, detection_queue, result_connection, model_shape ) @@ -494,8 +494,6 @@ def process_frames( logger.info(f"{camera_name}: frame {frame_time} is not in memory store.") continue - motion_detector.improve_contrast = improve_contrast_enabled.value - # look for motion motion_boxes = motion_detector.detect(frame)