现在我有 N 张图像,选取第 1 张图像作为 reference image,剩下的图像都要跟第 1 张图像做 feature matching。一共做 N-1 次 feature matching。每次 feature matching 之后,都能得到两个输出,分别是 参与 匹配的两张图像对应的匹配点kp0_numpy, kp1_numpy。
N-1 次 feature matching,就会得到两个 list,input1 跟 input2,分别对应N-1个kp0_numpy跟N-1个kp1_numpy。
现在我需要找到 N-1 个 kp0_numpy 共有的 keypoints,以及这些keypoints 在 每个 kp1_numpy 对应的 keypoints。 下面的 FindCommonUV 函数可以做到。
CombineFeaturePointArrays 函数则是实现将 N-1 个 kp0_numpy 共有的 keypoints,以及这些keypoints 在 每个 kp1_numpy 对应的 keypoints 拼凑成 一个 [2*N, num_feature ] 形状的 np.darray。其中 num_feature 是 公共 keypoints的数目,N 是 图像数目。
函数 FindCommonUV 的输入 input1 跟 input2 是两个 keypoints 的 list。 input1 对应 reference image
def CombineFeaturePointArrays(common_points, matched_points_list):
# 将common_points和matched_points_list中的数组转置
transposed_common_points = common_points.T
transposed_matched_points = [feature_array.T for feature_array in matched_points_list]
result_array = np.vstack([transposed_common_points, *transposed_matched_points])
return result_array
def FindCommonUV(input1, input2):
common_points = None
matched_points_list

文章介绍了如何对N张图像进行特征匹配,找出第一张图像作为参考,然后找出剩余图像与参考图像之间的公共关键点。通过FindCommonUV函数处理匹配点列表,结合FilterKeypoints函数筛选出有效关键点。
最低0.47元/天 解锁文章
761

被折叠的 条评论
为什么被折叠?



