Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何访问DMatch(OpenCV)对象的每个成员?_Python_Opencv_Flann - Fatal编程技术网

Python 如何访问DMatch(OpenCV)对象的每个成员?

Python 如何访问DMatch(OpenCV)对象的每个成员?,python,opencv,flann,Python,Opencv,Flann,我正在使用OpenCV开发一个基于FLANN的匹配器,出于特定的原因,我需要访问匹配对象(DMatch)的每对坐标。良好匹配过滤器的结果存储在嵌套列表中:即良好匹配=[] 当我试图访问第一个对象(打印良好匹配[0])时,我得到了一个内存指针:即 这个对象的结构在python中是什么样子,以及如何访问它,有什么线索吗 ratio_thresh = 0.70 good_matches = [] for m,n in knn_matches: if m.distance

我正在使用OpenCV开发一个基于FLANN的匹配器,出于特定的原因,我需要访问匹配对象(DMatch)的每对坐标。良好匹配过滤器的结果存储在嵌套列表中:即良好匹配=[]

当我试图访问第一个对象(打印良好匹配[0])时,我得到了一个内存指针:即

这个对象的结构在python中是什么样子,以及如何访问它,有什么线索吗

ratio_thresh = 0.70
    good_matches = []
    for m,n in knn_matches:
        if m.distance < ratio_thresh * n.distance:
            good_matches.append(m)
 print good_matches[0]    
ratio\u thresh=0.70
好匹配=[]
对于knn_匹配中的m,n:
如果m.距离<比值_阈值*n.距离:
良好的匹配。追加(m)
打印正确的匹配项[0]

假设每个图像关键点的坐标是:(u_1,v_1)和(u_2,v_2)。所以我可以访问每个匹配对的坐标,然后以某种方式计算它们

请参见我对这个问题的回答:


长话短说,关键点不存储在DMatch中,而是存储在其他列表中。DMatch对象仅存储匹配关键点的索引、它们的距离和图像的索引。你可以通过这个索引从另一个列表中获取关键点。

我得出了相同的结论,但是,我找到了这篇文章:[link],让我怀疑我走的方向是否正确。