Pass to constructor

This commit is contained in:
Josh Hawkins 2022-04-16 07:52:26 -05:00
parent e072788f35
commit e4852821ec
2 changed files with 3 additions and 5 deletions

View File

@ -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 = []

View File

@ -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)