这"在比赛中为m,n"做什么?
What does this 'for m,n in matches'?
本文关键字:什么 更新时间:2023-10-16
我需要具体知道for m, n in matches
行所做的事情以在C中实现它。matches
是矩阵,但是m
和n
采用什么值,它们如何移动?<<<<<<<</p>
这是Python代码...
for m, n in matches:
if m.distance < 0.75*n.distance:
good.append([m])
C matches
中的注意是std::vector<DMatch>
,是OPENCV程序。
谢谢!
我猜您正在使用knnmatcher,并在http://docs.opencv.org/3.0-beta/doc/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.matcher.html.html.html.html.html.html..html.html.htmll.3.0-beta/3.0-beta/3.0-beta/div class =
m
和n
是DMatch
对象。返回两个对象,因为
k=2
matches = bf.knnMatch(des1,des2, k=2)
。
如果将k
的值增加到3,则需要
for m,n,p in matches:
捕获结果。
knnmatch的cpp等效返回DMATCH的向量的向量,如下所示
实际上,如果您打印出m.queryIdx, m.trainIdx, n.queryIdx, n.trainIdx
,则会看到类似264 323 264 490
的模式,表明查询图像中相同的索引与训练图像中的其他索引匹配。
m
和 n
是通过 matches
在每次迭代中存在的值。"它们如何移动"取决于matches
的类型以及它提供的迭代类型。如果是元组的列表,那么他们每个人都会按元素直接向下移动列表。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 警告处理为错误这里有什么问题
- 什么时候调用组成单元对象的析构函数
- #定义c-预处理器常量..我做错了什么
- 努力将整数转换为链表。不知道我在这里做错了什么
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 什么时候在C++中返回常量引用是个好主意
- 当在同一名称空间中有两个具有相同签名的函数时,会发生什么
- C++避免重复声明的语法是什么
- c++库的公共头文件中应该包含什么
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- ifstream什么都没读
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- C++从另一个类访问公共静态向量的正确方法是什么
- "throw expression code" 1e7 >返回 d 是什么?投掷标准::overflow_error( "too big" ) : d;意味 着?
- 我应该使用什么来代替void作为变体中的替代类型之一
- 有没有什么方法可以使用一个函数中定义的常量变量,也可以由c++中同一程序中的其他函数使用