3

I am trying to write a function to match ORB features. I am not using default matchers (bfmatcher, flann matcher) because i just want match speific features in image with features in other image.

I saw ORS descriptor its a binary array.

My query is how to match 2 features i.e how to find hamming distance between 2 descriptors ?

ORB descriptors:

descriptor1 =[34, 200, 96, 158, 75, 208, 158, 230, 151, 85, 192, 131, 40, 142, 54, 64, 75, 251, 147, 195, 78, 11, 62, 245, 49, 32, 154, 59, 21, 28, 52, 222]
descriptor2 =[128, 129, 2, 129, 196, 2, 168, 101, 60, 35, 83, 18, 12, 10, 104, 73, 122, 13, 2, 176, 114, 188, 1, 198, 12, 0, 154, 68, 5, 8, 177, 128]

Thanks.

nayab
  • 2,332
  • 1
  • 20
  • 34

1 Answers1

9

ORB descriptors are just 32 byte uchar Mat's.

the bruteforce and flann matchers do some more work, than just comparing descriptors, but if that's all you want for now, it would be a straight norm:

   Mat descriptor1, descriptor2;
   double dist = norm( descriptor1, descriptor2, NORM_HAMMING);
   // NORM_HAMMING2 or even NORM_L1 would make sense, too.
   // dist is a double, but ofc. you'd only get integer values in this case.
berak
  • 39,159
  • 9
  • 91
  • 89
  • thanks for answer, Can i take the less distance as more matching or any furthur criteria to match ? – nayab Nov 13 '14 at 09:37
  • hmm, yes, but with a grain of salt, as hamming distance gives you a very 'narrow' range (64*8). – berak Nov 13 '14 at 09:50
  • (64*8) ?, I am getting 32 8-bit numbers and mat type is 0 i,e CV_8U. – nayab Nov 13 '14 at 10:05
  • Any suggestion on how to use angle in ORB descriptor for matching. – nayab Nov 13 '14 at 10:51
  • 1
    @bvbdort I don't think that it is a good idea to use angle for matching. Since descriptors are 32 bit numbers,but angles are limited to 0-360 degrees it is bad idea to use angle.Also if I m not wrong,Feature Detectors are using histograms of orientation and steps of that is 0-20-40-..360 . You can t distinguish 10 degrees from 15 degrees. – Muhammet Ali Asan Jan 19 '15 at 13:31