Dynamically update masks and zones for cameras (#18359)

* Include config publisher in api

* Call update topic for passed topics

* Update zones dynamically

* Update zones internally

* Support zone and mask reset

* Handle updating objects config

* Don't put status for needing to restart Frigate

* Cleanup http tests

* Fix tests
This commit is contained in:
Nicolas Mowen
2025-08-16 10:20:33 -05:00
committed by Blake Blackshear
parent dc187eee1c
commit 4dc526761c
16 changed files with 100 additions and 118 deletions
+9 -6
View File
@@ -35,12 +35,7 @@ class ImprovedMotionDetector(MotionDetector):
self.avg_frame = np.zeros(self.motion_frame_size, np.float32)
self.motion_frame_count = 0
self.frame_counter = 0
resized_mask = cv2.resize(
config.mask,
dsize=(self.motion_frame_size[1], self.motion_frame_size[0]),
interpolation=cv2.INTER_AREA,
)
self.mask = np.where(resized_mask == [0])
self.update_mask()
self.save_images = False
self.calibrating = True
self.blur_radius = blur_radius
@@ -236,6 +231,14 @@ class ImprovedMotionDetector(MotionDetector):
return motion_boxes
def update_mask(self) -> None:
resized_mask = cv2.resize(
self.config.mask,
dsize=(self.motion_frame_size[1], self.motion_frame_size[0]),
interpolation=cv2.INTER_AREA,
)
self.mask = np.where(resized_mask == [0])
def stop(self) -> None:
"""stop the motion detector."""
pass