简体   繁体   English

如何使用 L2 范数(python)在描述符中查找匹配项?

[英]How to find matches in descriptors using L2 norm (python)?

I need some clarification in order to understand how image matching work.我需要一些说明以了解图像匹配的工作原理。 Basically, I calculated keypoints (keypoints1, keypoints2) of img1 and img2.基本上,我计算了img1和img2的关键点(keypoints1,keypoints2)。 After I calculated descriptors (desc1, desc2).在我计算了描述符(desc1,desc2)之后。 After that I used cdist function from scipy library to calculate the L2 norm of those descriptors.之后,我使用 scipy 库中的 cdist 函数来计算这些描述符的 L2 范数。 Now I do not understand how to find the matches using distances calculated.现在我不明白如何使用计算的距离找到匹配项。 I don't understand how to find appropriate indexes that match.我不明白如何找到匹配的适当索引。 If possible can you show in python vector examples?如果可能,您可以在 python 向量示例中显示吗? (Like desc1 = [[1,2],[3,4]] and desc2 = [[5,6],[0.9, 2.1]]. Clearly here desc1[0] and desc2[1] has the minimum distance.) (例如 desc1 = [[1,2],[3,4]] 和 desc2 = [[5,6],[0.9, 2.1]]。很明显这里 desc1[0] 和 desc2[1] 具有最小距离。 )

Do you mean something along those lines?你的意思是这样吗?

scores=scipy.spatial.distance.cdist(desc1,desc2)

matches=scores.argsort(1)

In the snippet above, scores[i,j] contains the matching score between desc1[i] and desc2[j] , and在上面的代码片段中, scores[i,j]包含desc2[j] desc1[i]desc2[j]之间的匹配分数,以及

matches[i]=[index_1, ..., index_k] 

is such that desc2[index_1] is the closest match to desc1[i] , desc2[index_2] is the second best match to desc1[i] and so on.是这样的, desc2[index_1]是最匹配desc1[i] desc2[index_2]是与第二最佳匹配desc1[i]等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Python广播的内存高效L2规范 - Memory Efficient L2 norm using Python broadcasting 在python中使用L2范数的LAD? (sklearn) - LAD with L2 norm in python? (sklearn) 如何在 Pytorch 的 CNN 中访问卷积层的权重和 L2 范数? - How to access weight and L2 norm of conv layers in a CNN in Pytorch? 如何使用 Sklearn 在 Python 中对列表列表进行 L2 规范化 - How to L2 Normalize a list of lists in Python using Sklearn python sklearn:“ sklearn.preprocessing.normalize(X,norm ='l2')”和“ sklearn.svm.LinearSVC(penalty ='l2')”之间有什么区别 - python sklearn: what is the different between “sklearn.preprocessing.normalize(X, norm='l2')” and “sklearn.svm.LinearSVC(penalty='l2')” Keras lambda层为l2范数 - Keras lambda layer for l2 norm numpy.linalg.norm VS L2 规范的 scipy cdist - numpy.linalg.norm VS scipy cdist for L2 norm 如何在 LU 分解中找到“L + U”的范数 - How to find the norm for 'L + U' in LU decomposition 有没有办法在python中一次计算多个二维矩阵的L2范数? - is there any way to calculate L2 norm of multiple 2d matrices at once, in python? 是否有 Python function 来计算 2 个矩阵之间的最小 L2 范数,直到列排列? - Is there a Python function to compute minimal L2 norm between 2 matrices up to column permutation?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM