Add camera level processing for birdseye

This commit is contained in:
Nick Mowen 2022-04-11 08:16:42 -06:00
parent 58c32857d3
commit 893000dd28

View File

@ -190,14 +190,19 @@ class BirdsEyeFrameManager:
channel_dims,
)
def camera_active(self, object_box_count, motion_box_count):
if self.mode == BirdseyeModeEnum.continuous:
def camera_active(self, camera_config, object_box_count, motion_box_count):
if camera_config:
mode = camera_config.mode
else:
mode = self.mode
if mode == BirdseyeModeEnum.continuous:
return True
if self.mode == BirdseyeModeEnum.motion and motion_box_count > 0:
if mode == BirdseyeModeEnum.motion and motion_box_count > 0:
return True
if self.mode == BirdseyeModeEnum.objects and object_box_count > 0:
if mode == BirdseyeModeEnum.objects and object_box_count > 0:
return True
def update_frame(self):
@ -310,11 +315,14 @@ class BirdsEyeFrameManager:
return True
def update(self, camera, object_count, motion_count, frame_time, frame) -> bool:
def update(self, camera, camera_config, object_count, motion_count, frame_time, frame) -> bool:
# don't process if birdseye is disabled for this camera
if camera_config and not camera_config.enabled:
return False
# update the last active frame for the camera
self.cameras[camera]["current_frame"] = frame_time
if self.camera_active(object_count, motion_count):
if self.camera_active(camera_config, object_count, motion_count):
self.cameras[camera]["last_active_frame"] = frame_time
now = datetime.datetime.now().timestamp()
@ -425,6 +433,7 @@ def output_frames(config: FrigateConfig, video_output_queue):
):
if birdseye_manager.update(
camera,
config.cameras[camera].birdseye,
len([o for o in current_tracked_objects if not o["stationary"]]),
len(motion_boxes),
frame_time,