【问题标题】:How to access to each member of a DMatch(OpenCV) object?如何访问 DMatch(OpenCV) 对象的每个成员?
【发布时间】:2020-08-14 03:24:49
【问题描述】:

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

当我尝试访问第一个对象 ( print good_matches[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]    

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

【问题讨论】:

    标签: python opencv flann


    【解决方案1】:

    查看我对这个问题的回答:How to get the positions of the matched points with Brute-Force Matching / SIFT Descriptors

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-30
    • 1970-01-01
    • 2011-04-07
    • 1970-01-01
    • 1970-01-01
    • 2015-05-09
    • 1970-01-01
    相关资源
    最近更新 更多