fix box merging

This commit is contained in:
Blake Blackshear 2020-07-26 11:52:40 -05:00
parent b345571a63
commit c1f522ff54

View File

@ -236,7 +236,7 @@ def track_camera(name, config, global_objects_config, frame_queue, frame_shape,
for obj in tracked_objects: for obj in tracked_objects:
x_min, y_min, x_max, y_max = obj['box'] x_min, y_min, x_max, y_max = obj['box']
for m_index, motion_box in enumerate(motion_boxes): for m_index, motion_box in enumerate(motion_boxes):
if area(intersection(obj['box'], motion_box))/area(motion_box) > .5: if intersection_over_union(motion_box, obj['box']) > .2:
used_motion_boxes.append(m_index) used_motion_boxes.append(m_index)
x_min = min(obj['box'][0], motion_box[0]) x_min = min(obj['box'][0], motion_box[0])
y_min = min(obj['box'][1], motion_box[1]) y_min = min(obj['box'][1], motion_box[1])