4

I'm looking for a picture inside a database (1000 pictures). In order to do that, i use Bag of Features with ORB. Then, i use LSH.

There is something i don't understand at all. With KD-TREE i got among my 3 nearest neighbor one good match then, the other results are very bad. I think it's because KD-TREE works very badly in highly dimentional data.

Index : [47, 194, 1118] Dist : [0, 0.01984383, 0.021690277]

Then when i use LSH with hamming distance, i always get the same bad results results whatever my query image.

Index : [0, 1, 2] Dist : [0, 0, 0]

 responseDatabase.convertTo(responseDatabase,CV_8U);
 cv::flann::Index flannIndex(responseDatabase,cv::flann::LshIndexParams(20,10,2), cvflann::FLANN_DIST_HAMMING);
cv::Mat results, dists;
 int k=3; // find the 3 nearest neighbors


// search (nearest neighbor)
responseQuery.convertTo(responseQuery,CV_8U);
flannIndex.knnSearch(responseQuery, results, dists, k, cv::flann::SearchParams() );

and

 cv::flann::Index flannIndex(responseDatabase,cv::flann::KDTreeIndexParams,cvflann::FLANN_DIST_EUCLIDEAN);
cv::Mat results, dists;
 int k=3; // find the 3 nearest neighbors


// search (nearest neighbor)
flannIndex.knnSearch(responseQuery, results, dists, k, cv::flann::SearchParams() );

responseQuery --> cv::Mat which contains the response histogram of the query databaseQuery --> cv::Mat which contains the response histogram of all my pictures of my database

Do i miss something ? Maybe with ORB there is something i have to do besides the others things ? I precise that firstly i used SIFT and SURF with LSH and KD-TREE and i got pretty good results even if it was not perfect.

Can anyone explain me why ? I really don't understand why.

However i use BruteForce-Hamming as a matcher.

lilouch
  • 1,054
  • 4
  • 23
  • 43
  • I would say that Flann in practice (for me) works best sub 5 dimensions. (I normally only use 3) But as the dimensions increase the time effectiveness is reduced. Doing a bruteForce N^2 best match is what most people do for feature matching especially when using sift or surf features. – Jay Aug 19 '14 at 19:40
  • But the problem is each of my descriptors contains 32 numbers so it's an high dimentional problem. Yes i know what you mean but it takes time to look all over the database that's why i wanted to use BoW with LSH. – lilouch Aug 19 '14 at 23:18
  • Well you can more intelligently do your search within your database. Lets say Image A is a subset of Image B then do a query where the features that you take from image B is only contained in image A. So in sql. `Select * from featureTable where x<(somenumber) and y < (#) and x >(#) and y > (#)` I know this is only a small optimization. But its one none the less – Jay Aug 20 '14 at 00:50
  • Sorry Jay i didn't get it... Because of time of computation, i can't put the descriptors of each picture in my SQL database. – lilouch Aug 20 '14 at 10:07
  • By time computation you mean, you are doing real time image matching? You can't do some pre proccessing on one image set. And when traveling through the other image set you can query the database. I don't know anything about your project so just saying :D – Jay Aug 20 '14 at 18:15
  • Not pas time Jay, the matching is done in less than 1s! This is the quality of the matching. (Not corresponding at all whereas with KD-tree, i have some good results) – lilouch Aug 20 '14 at 19:19

0 Answers0