Use Euclidean distance in SURF

ぐ巨炮叔叔 提交于 2019-12-02 13:56:23

问题


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?


回答1:


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.


来源:https://stackoverflow.com/questions/19812216/use-euclidean-distance-in-surf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!