From bb960243af9a605594f60e06f2dd0c0604e01608 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 19 Jun 2023 17:23:02 -0600 Subject: [PATCH] Apply zone filter before intertia --- frigate/object_processing.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 6d31c3cdd..22b07b141 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -188,15 +188,16 @@ class TrackedObject: zone_score = self.zone_presence.get(name, 0) # check if the object is in the zone if cv2.pointPolygonTest(contour, bottom_center, False) >= 0: - self.zone_presence[name] = zone_score + 1 + # if the object passed the filters once, dont apply again + if name in self.current_zones or not zone_filtered( + self, zone.filters + ): + self.zone_presence[name] = zone_score + 1 - # an object is only considered present in a zone if it has a zone inertia of 3+ - if zone_score >= zone.inertia: - # if the object passed the filters once, dont apply again - if name in self.current_zones or not zone_filtered( - self, zone.filters - ): + # an object is only considered present in a zone if it has a zone inertia of 3+ + if zone_score >= zone.inertia: current_zones.append(name) + if name not in self.entered_zones: self.entered_zones.append(name) else: