From 8ab6cba5213b15612cdbc7feb156188f44c25483 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Thu, 4 Nov 2021 09:25:17 -0500 Subject: [PATCH] check for overlapping motion boxes --- frigate/video.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frigate/video.py b/frigate/video.py index 8a66f9f6c..774b6fc91 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -411,8 +411,7 @@ def reduce_boxes(boxes): def intersects_any(box_a, boxes): for box in boxes: if box_overlaps(box_a, box): - continue - return True + return True return False @@ -506,12 +505,18 @@ def process_frames( # get stationary object ids # check every Nth frame for stationary objects # disappeared objects are not stationary + # also check for overlapping motion boxes stationary_object_ids = [ obj["id"] for obj in object_tracker.tracked_objects.values() + # if there hasn't been motion for 10 frames if obj["motionless_count"] >= 10 + # and it isn't due for a periodic check and obj["motionless_count"] % detect_config.stationary_interval != 0 + # and it hasn't disappeared and object_tracker.disappeared[obj["id"]] == 0 + # and it doesn't overlap with any current motion boxes + and not intersects_any(obj["box"], motion_boxes) ] # get tracked object boxes that aren't stationary