Sync stationary object checks for all objects on a camera

This commit is contained in:
Nick Mowen 2023-10-19 09:35:11 -06:00
parent 91f7d67c5e
commit ecc5555e5d

View File

@ -532,6 +532,7 @@ def process_frames(
fps_tracker.start() fps_tracker.start()
startup_scan = True startup_scan = True
stationary_frame_counter = 0
region_min_size = get_min_region_size(model_config) region_min_size = get_min_region_size(model_config)
@ -585,16 +586,16 @@ def process_frames(
# check every Nth frame for stationary objects # check every Nth frame for stationary objects
# disappeared objects are not stationary # disappeared objects are not stationary
# also check for overlapping motion boxes # also check for overlapping motion boxes
if stationary_frame_counter == detect_config.stationary.interval:
stationary_frame_counter = 0
stationary_object_ids = []
else:
stationary_frame_counter += 1
stationary_object_ids = [ stationary_object_ids = [
obj["id"] obj["id"]
for obj in object_tracker.tracked_objects.values() for obj in object_tracker.tracked_objects.values()
# if it has exceeded the stationary threshold # if it has exceeded the stationary threshold
if obj["motionless_count"] >= detect_config.stationary.threshold if obj["motionless_count"] >= detect_config.stationary.threshold
# and it isn't due for a periodic check
and (
detect_config.stationary.interval == 0
or obj["motionless_count"] % detect_config.stationary.interval != 0
)
# and it hasn't disappeared # and it hasn't disappeared
and object_tracker.disappeared[obj["id"]] == 0 and object_tracker.disappeared[obj["id"]] == 0
# and it doesn't overlap with any current motion boxes when not calibrating # and it doesn't overlap with any current motion boxes when not calibrating