我使用for循环从opencv knnFlann matcher过滤匹配,但是我需要优化它
代码:
def orb_calc_matches(matches, distance_range=0.65):
good_matches = []
queried_matches = []
for i in range(len(matches)):
if len(matches[i]) == 2:
if ((matches[i][0].trainIdx not in queried_matches) and (matches[i][0].distance < distance_range * matches[i][1].distance)):
good_matches.append(matches[i][0])
queried_matches.append(matches[i][0].trainIdx)
return good_matches
索姆博迪能提出一些更有效的方法吗?你知道吗
使
queried_matches
成为set
。使用for m in matches:
而不是索引循环,因为不需要索引。你知道吗相关问题 更多 >
编程相关推荐