cv::flann::index::knnsearch 索引和距离的值
cv::flann::index::knnsearch values of indices and dists
给定以下代码就可以了
index.knnSearch(mat,indices,dists,3);
for (int i = 0; i < indices.rows; i++ )
{
indices.at<int>(i,0) // this is the index of the match
indices.at<int>(i,1) // ????? what is this?
indices.at<int>(i,2) // and this?
}
同样对于 dists,我如何处理每行中的 3 个值?我如何将其变成有用的比率或百分比匹配?
在索引中,我需要知道 500 个描述符中有多少个匹配,我确信数据以某种方式显示了这一点,但我不明白。请帮助
假设这是调用:-
knnSearch(mat,indices,dists,N);
注意 - N 是调用者传递的值。
在 return、
"indices" refer to the array having the "N" closest neighbours found
by the algorithm.
"dists" refers to the distance of the same indices.
因此,在问题中提到的情况下,N=3,并且 3 个最近的邻居 return 连同它们的距离。你如何使用它真的取决于用例。
给定以下代码就可以了
index.knnSearch(mat,indices,dists,3);
for (int i = 0; i < indices.rows; i++ )
{
indices.at<int>(i,0) // this is the index of the match
indices.at<int>(i,1) // ????? what is this?
indices.at<int>(i,2) // and this?
}
同样对于 dists,我如何处理每行中的 3 个值?我如何将其变成有用的比率或百分比匹配? 在索引中,我需要知道 500 个描述符中有多少个匹配,我确信数据以某种方式显示了这一点,但我不明白。请帮助
假设这是调用:-
knnSearch(mat,indices,dists,N);
注意 - N 是调用者传递的值。
在 return、
"indices" refer to the array having the "N" closest neighbours found by the algorithm.
"dists" refers to the distance of the same indices.
因此,在问题中提到的情况下,N=3,并且 3 个最近的邻居 return 连同它们的距离。你如何使用它真的取决于用例。