Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/135.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
C++ OpenCV drawMatches--queryIdx和trainIdx_C++_Image Processing_Opencv_Computer Vision - Fatal编程技术网

C++ OpenCV drawMatches--queryIdx和trainIdx

C++ OpenCV drawMatches--queryIdx和trainIdx,c++,image-processing,opencv,computer-vision,C++,Image Processing,Opencv,Computer Vision,这是OpenCV的功能: void drawMatches(Mat img1, vector<KeyPoint> keypoints1, Mat img2, vector<KeyPoint> keypoints2, vector<DMatch> matches, Mat outImg) //want keypoints1[i] = keypoints2[ma

这是OpenCV的功能:

void drawMatches(Mat img1, vector<KeyPoint> keypoints1,
                 Mat img2, vector<KeyPoint> keypoints2,
                 vector<DMatch> matches, 
                 Mat outImg) //want keypoints1[i] = keypoints2[matches[i]]
大概,
queryIdx
是一组关键点的索引,
trainIdx
是另一组关键点的索引


问题是:是否
queryIdx
索引到
keypoints1
,而
trainIdx
索引到
keypoints2
?或者,是另一种方式吗?

这取决于如何获得
匹配项

如果按以下顺序调用匹配函数:

match(descriptor_for_keypoints1, descriptor_for_keypoints2, matches)
然后
queryIdx
指的是
keypoints1
trainIdx
指的是
keypoints2
,反之亦然。

变量“matches”是数据匹配对象的列表

如果我们正在迭代此DMatch对象列表,则每个项目将具有以下属性:

  • item.distance:此属性提供描述符之间的距离。距离越小表示匹配越好
  • item.trainIdx:该属性为我们提供列车描述符列表中描述符的索引(在我们的例子中,它是img2中的描述符列表)
  • item.queryIdx:该属性为我们提供查询描述符列表中描述符的索引(在我们的示例中,它是img1中的描述符列表)
  • item.imgIdx:此属性为我们提供列车图像的索引

  • 它们应该使功能更清晰。界面和语言不一致。完全同意。命名非常混乱,文档中没有解释。什么是imgIdx?我找不到关于它的讨论。同样,这里也找不到解释什么是
    imgIdx
    -我只比较了两个图像。如何在图像中找到匹配的Y坐标?
    match(descriptor_for_keypoints1, descriptor_for_keypoints2, matches)