gpt4 book ai didi

c++ - 进行 knnMatch 后的 .distance 是什么?

转载 作者:搜寻专家 更新时间:2023-10-31 01:53:26 25 4
gpt4 key购买 nike

基本上我有:

BruteForceMatcher<L2<float>>().knnMatch(descriptor1,descriptor2,matches,2);

为了只获得良好的匹配,我解析了所有“匹配” vector 并像这样检查距离:

if( (matches[i][0].distance / matches[i][1].distance) < ratio ){
//> Good match!
}

但是什么matches[i][0].distance意思是 ? matches[i][0]之间的距离和?

我的假设

据我所知,计算第一个匹配项与它的 NN 之间的欧氏距离并用阈值过滤它对我来说听起来更合乎逻辑,例如:

//> I calculate the distance between 2 nearest neighborhood and filter it based on thresold
foreach( matches : i) {
if ( euclianDistance( matches[i][0] , matches[i][1] ) < threshold ) {
//> good match
}
}

最佳答案

描述符 - 是 N 维空间的一个点。

match - 是一对描述符 - 一个来自第一组,一个来自第二组(也称为 trainquery 集).

distance - 是 L2 指标,用于 match 结构指向的 2 个描述符。 (您将指标类型指定为 BruteForceMatcher 的模板参数)。

match[i][0].distance = L2(descriptor1.row(match[i][0].trainIdx),
descriptor2.row(match[i][0].queryIdx))

所以 knnMatchtrain 集中的每个描述符返回 query 集中的两个最接近的描述符。接下来,您要过滤掉两个找到的描述符彼此接近的情况。

关于c++ - 进行 knnMatch 后的 .distance 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11176421/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com