在SURF中使用欧氏距离 [英] Use Euclidean distance in SURF

查看:687
本文介绍了在SURF中使用欧氏距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,我基于最近的邻居距离比例过滤好的图像,如下:

  for int i = 0; i  {
if((matches [i] [0] .distance ; 0.6 *(matches [i] [1] .distance))&&
((int)matches [i] .size()< = 2& .size()> 0))
{
good_matches.push_back(matches [i] [0]);
}
}

最近邻距离比,我还需要做欧几里得距离计算吗?



我想知道当我使用 knnMatch $ b> $
>
> 方法在 FlannBasedMatcher 中,它们使用欧氏距离匹配keypoints?解决方案

是的,你需要。最近的邻居距离比意味着你:
1)计算从一个图像中的描述符到第二图像中的第一和第二最近邻居的距离。 d1 = d(desc1_img1,descA_img2); d2 = d(desc1_img1,descB_img2)。
2)计算距离比R = d1 / d2。如果R < 0.6,那么匹配可能是好的。它是这样做的,因为你总是在第二个图像中有最接近描述符,无论它是多么糟糕 - 你用比率检查它。



距离,从你计算的比率?



距离类型取决于在normType参数中构造KNN-matcher时传递的值。

  BFMatcher :: BFMatcher(int normType = NORM_L2,bool crossCheck = false)




  • NORM_L2表示Eucledian d(p1,p2)= sqrt((x1 - x2)^ 2 +(y1 - y2) ^ 2 +
    ...);

  • NORM_Ll表示曼哈顿d(p1,p2)= abs(x1-x2)+ abs(y1-y2)+
    ..

  • NORM_HAMMING表示汉明等。


In my code I'm filtering the good images based on the nearest neigbour distance ratio, as follows:

for(int i = 0; i < min(des_image.rows-1,(int) matches.size()); i++) 
{
        if((matches[i][0].distance < 0.6*(matches[i][1].distance)) && 
                                  ((int)matches[i].size()<=2 && (int)matches[i].size()>0))
        {
            good_matches.push_back(matches[i][0]);
        }
 }

Since I'm filtering the good images based on the nearest neighbor distance ratio, do I need to still do Euclidean distance calculation?

And I want to know when I use the knnMatch method in FlannBasedMatcher, inside the method do they use the Euclidean distance to match the keypoints?

解决方案

Yes, you need. Nearest neigbour distance ratio means that you: 1)Calculate distances from the descriptor in one image to the the 1st and 2nd nearest neighbours in the second image. d1 = d(desc1_img1, descA_img2); d2 = d(desc1_img1, descB_img2). 2)Calculate distance ratio R = d1/d2. If R < 0.6, then match is probably good. It is done because you will always got "nearest" descriptor in the second image, no matter how bad it is - you check it with ratio.

So if you have no distances, from what will you calculate ratio?

Type of distance depends on value you passed when constructed KNN-matcher in normType parameter.

 BFMatcher::BFMatcher(int normType=NORM_L2, bool crossCheck=false )  

  • NORM_L2 means Eucledian d(p1,p2) = sqrt((x1 - x2)^2+(y1 - y2)^2 + ...);
  • NORM_Ll means Manhattan d(p1,p2) = abs(x1 - x2)+abs(y1 - y2) + ..;
  • NORM_HAMMING means Hamming, etc.

这篇关于在SURF中使用欧氏距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆