Filter objects out of ratio bounds

Issue: #2948
This commit is contained in:
Nick 2022-03-13 11:33:55 -04:00
parent fd6db32b38
commit dd3bfa9e64
2 changed files with 10 additions and 1 deletions

View File

@ -346,7 +346,7 @@ def zone_filtered(obj: TrackedObject, object_config):
if obj_settings.min_ratio > obj.obj_data["ratio"]: if obj_settings.min_ratio > obj.obj_data["ratio"]:
return True return True
# if the object is not proportionally narrow enough # if the object is proportionally too wide
if obj_settings.max_ratio < obj.obj_data["ratio"]: if obj_settings.max_ratio < obj.obj_data["ratio"]:
return True return True

View File

@ -41,6 +41,7 @@ def filtered(obj, objects_to_track, object_filters):
object_score = obj[1] object_score = obj[1]
object_box = obj[2] object_box = obj[2]
object_area = obj[3] object_area = obj[3]
object_ratio = obj[4]
if not object_name in objects_to_track: if not object_name in objects_to_track:
return True return True
@ -62,6 +63,14 @@ def filtered(obj, objects_to_track, object_filters):
if obj_settings.min_score > object_score: if obj_settings.min_score > object_score:
return True return True
# if the object is not proportionally wide enough
if obj_settings.min_ratio > object_ratio:
return True
# if the object is proportionally too wide
if obj_settings.max_ratio < object_ratio:
return True
if not obj_settings.mask is None: if not obj_settings.mask is None:
# compute the coordinates of the object and make sure # compute the coordinates of the object and make sure
# the location isn't outside the bounds of the image (can happen from rounding) # the location isn't outside the bounds of the image (can happen from rounding)