You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def distance_rule_match(end2end_indexes, end2end_bboxes, master_indexes, master_bboxes):
"""
Get matching between no-match end2end bboxes and no-match master bboxes.
Use min distance to match.
This rule will only run (no-match end2end nums > 0) and (no-match master nums > 0)
It will Return master_bboxes_nums match-pairs.
:param end2end_indexes:
:param end2end_bboxes:
:param master_indexes:
:param master_bboxes:
:return: match_pairs list, e.g. [[0,1], [1,2], ...]
"""
min_match_list = []
for j, master_bbox in zip(master_indexes, master_bboxes):
min_distance = np.inf
min_match = [0, 0] # i, j
for i, end2end_bbox in zip(end2end_indexes, end2end_bboxes):
x_end2end, y_end2end = end2end_bbox[0], end2end_bbox[1]
x_master, y_master = master_bbox[0], master_bbox[1]
end2end_point = (x_end2end, y_end2end)
master_point = (x_master, y_master)
dist = cal_distance(master_point, end2end_point)
if dist < min_distance:
min_match[0], min_match[1] = i, j
min_distance = dist
min_match_list.append(min_match)
return min_match_list
About this function, the output may contain several matches [i, *] for one i. But you want to find only one match for a specific i, should we change order of the two loops here?
The text was updated successfully, but these errors were encountered:
About this function, the output may contain several matches [i, *] for one i. But you want to find only one match for a specific i, should we change order of the two loops here?
The text was updated successfully, but these errors were encountered: