mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-01-07 00:06:57 +01:00
implement birdseye modes
This commit is contained in:
parent
94c21a6363
commit
9c5b0d4138
@ -76,6 +76,7 @@ class BroadcastThread(threading.Thread):
|
||||
class BirdsEyeFrameManager:
|
||||
def __init__(self, config, frame_manager: SharedMemoryFrameManager):
|
||||
self.config = config
|
||||
self.mode = config.birdseye.mode
|
||||
self.frame_manager = frame_manager
|
||||
width = config.birdseye.width
|
||||
height = config.birdseye.height
|
||||
@ -134,10 +135,20 @@ class BirdsEyeFrameManager:
|
||||
|
||||
copy_yuv_to_position(position, self.frame, self.layout_dim, frame, channel_dims)
|
||||
|
||||
def camera_active(self, object_box_count, motion_box_count):
|
||||
if self.mode == "continuous":
|
||||
return True
|
||||
|
||||
if self.mode == "motion" and object_box_count + motion_box_count > 0:
|
||||
return True
|
||||
|
||||
if self.mode == "objects" and object_box_count > 0:
|
||||
return True
|
||||
|
||||
def update_frame(self):
|
||||
# determine how many cameras are tracking objects within the last 30 seconds
|
||||
now = datetime.datetime.now().timestamp()
|
||||
# TODO: this needs to be based on the "mode" from the config
|
||||
|
||||
active_cameras = set(
|
||||
[
|
||||
cam
|
||||
@ -236,7 +247,7 @@ class BirdsEyeFrameManager:
|
||||
def update(self, camera, object_count, motion_count, frame_time, frame) -> bool:
|
||||
|
||||
# update the last active frame for the camera
|
||||
if object_count > 0:
|
||||
if self.camera_active(object_count, motion_count):
|
||||
last_active_frame = self.cameras[camera]["last_active_frame"]
|
||||
# cleanup the old frame
|
||||
if last_active_frame != 0.0:
|
||||
|
Loading…
Reference in New Issue
Block a user