NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Adjust motion calibration to be more dynamic (#8250)
Nicolas Mowen0c2f3a97022b
diff --git a/frigate/motion/improved_motion.py b/frigate/motion/improved_motion.pyindex b9d72da29b..603d8fda4c 100644--- a/frigate/motion/improved_motion.py+++ b/frigate/motion/improved_motion.py@@ -1,3 +1,5 @@+import logging+import cv2import imutilsimport numpy as np@@ -6,6 +8,8 @@ from scipy.ndimage import gaussian_filterfrom frigate.config import MotionConfigfrom frigate.motion import MotionDetector+logger = logging.getLogger(__name__)+class ImprovedMotionDetector(MotionDetector):def __init__(@@ -138,8 +142,8 @@ class ImprovedMotionDetector(MotionDetector):self.motion_frame_size[0] * self.motion_frame_size[1])- # once the motion drops to less than 1% for the first time, assume its calibrated- if pct_motion < 0.01:+ # once the motion is less than 5% and the number of contours is < 4, assume its calibrated+ if pct_motion < 0.05 and len(motion_boxes) <= 4:self.calibrating = False# if calibrating or the motion contours are > 80% of the image area (lightning, ir, ptz) recalibrate