mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Adjust motion calibration to be more dynamic (#8250)
* Adjust motion calibration to be more dynamic * isort
This commit is contained in:
parent
a3c0e30502
commit
0c2f3a9702
@ -1,3 +1,5 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import imutils
|
import imutils
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -6,6 +8,8 @@ from scipy.ndimage import gaussian_filter
|
|||||||
from frigate.config import MotionConfig
|
from frigate.config import MotionConfig
|
||||||
from frigate.motion import MotionDetector
|
from frigate.motion import MotionDetector
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ImprovedMotionDetector(MotionDetector):
|
class ImprovedMotionDetector(MotionDetector):
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -138,8 +142,8 @@ class ImprovedMotionDetector(MotionDetector):
|
|||||||
self.motion_frame_size[0] * self.motion_frame_size[1]
|
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
|
# once the motion is less than 5% and the number of contours is < 4, assume its calibrated
|
||||||
if pct_motion < 0.01:
|
if pct_motion < 0.05 and len(motion_boxes) <= 4:
|
||||||
self.calibrating = False
|
self.calibrating = False
|
||||||
|
|
||||||
# if calibrating or the motion contours are > 80% of the image area (lightning, ir, ptz) recalibrate
|
# if calibrating or the motion contours are > 80% of the image area (lightning, ir, ptz) recalibrate
|
||||||
|
Loading…
Reference in New Issue
Block a user