Finding hamming distance between ORB feature descriptors

7.5k views Asked by At

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.

1

There are 1 answers

5
berak On BEST ANSWER

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.