如何vl_ubcmatch技术上的工作? [英] How does vl_ubcmatch work technically?

查看:585
本文介绍了如何vl_ubcmatch技术上的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读通过vl_ubcmatch的功能​​源$ C ​​$ C,提供的这里,我试图去理解,它是如何计算分数,以及它是如何在技术上内部工作。

I am reading through vl_ubcmatch's function source code, provided here, and I am trying to understand, how does it compute the score, and how does it work technically internally.

不过,这种C code的这些宏,怪异##变量一样,并没有什么,我没有与经验。因此,这里的主要问题是,而我在C无能如果可能的话,可能会有人告诉我,如何 vl_ubcmatch 工作到底是什么?它是如何比较两个描述符?

However, this C code has these macros, weird ## variables like, and what not, that I don't have experience with. So the main problem here is rather my incompetency in C. If possible, could somebody tell me, how does vl_ubcmatch work exactly? How does it compare two descriptors?

推荐答案

这是第7.1和的 鲜明的形象特征
从尺度不变关键点

This is explained in Sections 7.1 and 7.2 of Distinctive Image Features from Scale-Invariant Keypoints.

该函数文档是在这里:<一href=\"http://www.vlfeat.org/mdoc/VL_UBCMATCH.html\">http://www.vlfeat.org/mdoc/VL_UBCMATCH.html

这特征D1在图像1到特征d2的图像2所述的匹配用于仅当d1和d2之间的距离比为D1的距离,并在图像中的任何其它特征显著较小2.匹配需要显著更好比其他任何潜在的匹配。 显着是由您传递给VL_UBCMATCH功能的门槛定义。

A match from feature d1 in image 1 to feature d2 in image 2 is used only if the distance between d1 and d2 is significantly smaller than the distance to d1 and any other feature in image 2. The match needs to be significantly better than any other potential match. "Significant" is defined by the threshold that you pass to the VL_UBCMATCH function.

7.2节是指一个近似最邻近搜索的结构,但VL_UBCMATCH不使用此

Section 7.2 refers to an approximate nearest neighbor search structure, but VL_UBCMATCH doesn't use this:

for(k1 = 0 ; k1 < K1 ; ++k1, L1_pt += ND ) {                        \
                                                                    \
  PROMOTE_##MXC best = maxval ;                                     \
  PROMOTE_##MXC second_best = maxval ;                              \
  int bestk = -1 ;                                                  \
                                                                    \
  /* For each point P2[k2] in the second image... */                \
  for(k2 =  0 ; k2 < K2 ; ++k2, L2_pt += ND) {                      \
                                                                    \
    int bin ;                                                       \
    PROMOTE_##MXC acc = 0 ;                                         \
    for(bin = 0 ; bin < ND ; ++bin) {                               \
      PROMOTE_##MXC delta =                                         \
        ((PROMOTE_##MXC) L1_pt[bin]) -                              \
        ((PROMOTE_##MXC) L2_pt[bin]) ;                              \
      acc += delta*delta ;                                          \
    }                                                               \
                                                                    \
    /* Filter the best and second best matching point. */           \
    if(acc < best) {                                                \
      second_best = best ;                                          \
      best = acc ;                                                  \
      bestk = k2 ;                                                  \
    } else if(acc < second_best) {                                  \
      second_best = acc ;                                           \
    }                                                               \
  }                                                                 \
                                                                    \
  L2_pt -= ND*K2 ;                                                  \
                                                                    \
  /* Lowe's method: accept the match only if unique. */             \
  if(thresh * (float) best < (float) second_best &&                 \
     bestk != -1) {                                                 \
    pairs_iterator->k1 = k1 ;                                       \
    pairs_iterator->k2 = bestk ;                                    \
    pairs_iterator->score = best ;                                  \
    pairs_iterator++ ;                                              \
  }                                                                 \
}

下面是伪code:

matches = []
For each descriptor k1 in image 1:
    closest_match_distance = Infinity
    second_closest_match_distance = Infinity
    best_match = None
    For each descriptor k2 in image 2:
        distance_squared = d(k1, k2)
        if (distance_squared < closest_match_distance):
            second_closest_match_distance = closest_match_distance
            closest_match_distance = distance_squared
            best_match = k2
    If (threshold * closest_match_distance <
      second_closest_match_distance AND best_match != None):
        matches.Insert((k1, best_match, closest_match_distance))
return matches

这篇关于如何vl_ubcmatch技术上的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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