From 4363623c4531bec19066bc12312d173be8fccd88 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Tue, 13 Oct 2020 07:50:14 -0500 Subject: [PATCH] reduce zone filter bouncing --- frigate/object_processing.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 71ecb20a1..4b2f2f8d8 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -181,10 +181,12 @@ class CameraState(): # check each zone for name, zone in self.config['zones'].items(): contour = zone['contour'] - # check if the object is in the zone and not filtered - if (cv2.pointPolygonTest(contour, bottom_center, False) >= 0 - and not zone_filtered(obj, zone.get('filters', {}))): - current_zones.append(name) + # check if the object is in the zone + if (cv2.pointPolygonTest(contour, bottom_center, False) >= 0): + # if the object passed the filters once, dont apply again + if name in obj.get('zones', []) or not zone_filtered(obj, zone.get('filters', {})): + current_zones.append(name) + obj['zones'] = current_zones # maintain best objects