dorian3d / DBoW2

Enhanced hierarchical bag-of-word library for C++
Other
865 stars 370 forks source link

Implementing BRISK features #25

Closed odiseo123 closed 6 years ago

odiseo123 commented 7 years ago

Hi Dorian, For implementing BRISK features, I have created a class (copied from ORB.cpp) and set FBRISK::L=64; I have also modified the distance measure using the Stanford's CountBitsSetParallel code with a int_64t template:

  const long long  *pa = a.ptr<int64_t>();
  const long long  *pb = b.ptr<int64_t>();

  double dist=0;

  for(int i=0; i<8; i++, pa++, pb++)
  {
      unsigned long long v = *pa ^ *pb;
      v = v - ((v >> 1) & 0x5555555555555555UL);
      v = (v & 0x3333333333333333UL) + ((v >> 2) & 0x3333333333333333UL);
      dist += (((v + (v >> 4)) & 0xF0F0F0F0F0F0F0FUL) * 0x101010101010101UL) >> 56;
  }

  return dist;
}

I can generate a vocabulary and match image-to-image as in the demo, with similar scores (1 for the same images, <0.1 for different images). however since this has involved some coding outside my comfort zone I am unsure if it was done correctly. Could suggest ways of validating the words stored in the vocabulary?

EDIT: The above runs fine on Windows. however when deployed on Ubuntu as part of ORB_SLAM2 I get: /home/andres/Andres/myORB_SLAM2/Thirdparty/DBoW2/DBoW2/FBRISK.cpp:88:41: error: invalid conversion from ‘const long int’ to ‘const long long int’ [-fpermissive] const long long *pa = a.ptr(); I guess I need to read a bit more on how each OS handles the integers...

dorian3d commented 7 years ago

The error should go away with a const long long *pa = static_cast<const long long*>(a.ptr<int64_t>)();.