Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:11:58+00:00 2026-06-15T08:11:58+00:00

I am reading through vl_ubcmatch’s function source code, provided here , and I am

  • 0

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.

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:11:59+00:00Added an answer on June 15, 2026 at 8:11 am

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

    Documentation for the function is here: http://www.vlfeat.org/mdoc/VL_UBCMATCH.html

    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.

    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++ ;                                              \
      }                                                                 \
    }
    

    Here’s the pseudocode:

    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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading through and trying to understand some verilog, and sprinkled through is the
Whilst reading through the DirectWrite source code I came across the following struct: ///
I've been reading through the source code for Moq and I came across the
Reading through the Backbone.js source code, I saw this: validObj[attr] = void 0; What
Reading through some of the questions here, the general concensus seems to be that
While reading through another question here, on creating a URL shortening service, it was
It's clear from reading through threads that I can call a PHP function using
I'm currently reading through this jquery masking plugin to try and understand how it
Reading through the C specs I found this function: double remquo(double x, double y,
Reading through the documentation for powershells add-type it seems you can add JScript code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.