3

I wrote an application which detects keypoints, compute their descriptors and match them with BruteForce in OpenCV. That works like a charme.

But: How is the distance in the match-objects computed?

For example: I'm using SIFT and get a descriptor vector with 128 float values per keypoint. In matching, the keypoint is compared with for example 10 other descriptors with the same vectorsize. Now, I get the "best match" with a distance of 0.723.

Is this the average of every single euclidean distance of all floats of one vector to another? I just want to understand how this one value is created.

Benjamin Gruenbaum
  • 270,886
  • 87
  • 504
  • 504
dwi
  • 33
  • 2
  • 4

1 Answers1

3

By default, from the Open-CV docs, the BFMatcher uses the L2-norm.

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

Parameters: 
normType – One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. 
L1 and L2 norms are preferable choices for SIFT and SURF descriptors ...

See: http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_descriptor_matchers.html?highlight=bruteforcematcher#bruteforcematcher

The best match is the feature vector with the lowest distance compared to all the others.

Kirell
  • 9,228
  • 4
  • 46
  • 61
  • Yes, BFMatcher uses the L2-norm (euclidian distance). The Matcher does not return the euclidean distance of all vector elements, but one distance value. And that's exactly what I want to comprehend. How is this one value computed. Average over all distance of the vector elements? – dwi Mar 28 '15 at 12:06
  • The best match is the vector with the lowest distance. It is the closest feature vector – Kirell Mar 28 '15 at 13:22
  • The distance between what exactly? The descriptor has 128dim. So I get 128 distances from one descriptor to another. But the matcher returns just one. – dwi Mar 28 '15 at 13:50
  • The distance between the 2 feature vectors, the number of dimensions is irrelevant. Look at http://en.wikipedia.org/wiki/Euclidean_distance – Kirell Mar 28 '15 at 14:11