diff --git a/frigate/motion/improved_motion.py b/frigate/motion/improved_motion.py index 77eae26a9..b081d3791 100644 --- a/frigate/motion/improved_motion.py +++ b/frigate/motion/improved_motion.py @@ -239,6 +239,12 @@ class ImprovedMotionDetector(MotionDetector): ) self.mask = np.where(resized_mask == [0]) + # Reset motion detection state when mask changes + # so motion detection can quickly recalibrate with the new mask + self.avg_frame = np.zeros(self.motion_frame_size, np.float32) + self.calibrating = True + self.motion_frame_count = 0 + def stop(self) -> None: """stop the motion detector.""" pass diff --git a/frigate/video.py b/frigate/video.py index 05ddf0f62..a139c25f1 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -771,6 +771,7 @@ def process_frames( camera_enabled = camera_config.enabled if "motion" in updated_configs: + motion_detector.config = camera_config.motion motion_detector.update_mask() if (