浏览代码

reduce zone filter bouncing

Blake Blackshear 4 年之前
父节点
当前提交
4363623c45
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      frigate/object_processing.py

+ 6 - 4
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