Ensure motion is correctly set when adjusting masks

This commit is contained in:
Nicolas Mowen 2025-12-11 21:34:57 -07:00
parent 4b3c0b019d
commit edeab2f491
2 changed files with 7 additions and 0 deletions

View File

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

View File

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