2

I would like to use BoW with FLANN in order to index all my pictures inside my database.(For a CBIR project)

What i did :

  1. Loop over all ma database in order to compute the descriptors of each pictures.
  2. Clustering descriptors using K-MEAN
  3. Extraction of BoWDescriptors (Visual words) in order to have a big histogram with all my features
  4. Use FLANN Index to compute an index in each pictures

Code:

// Create Flann LSH index
cv::flann::Index flannIndex(this->descDescriptorbow, cv::flann::LshIndexParams(12, 20, 2), cvflann::FLANN_DIST_HAMMING);

cv::Mat results, dists;

int k=2; // find the 2 nearest neighbors

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

DescriptorBow contains all my BoWfeatures of my database. ResponseHist constains the bowFeature of my picture i want to eval.

Now, what i have to do in order to see what is the best matching picture ?

Can someone help me ?

Joker
  • 91
  • 1
  • 5
  • I presume it's the first line which throws, not the last? (Since the exception originates in `buildIndex` ? Debugging at a distance is hard, don't make it even harder for us. And obviously `file.txt` can't contain a continuous array; the question is whether you load it into one (code not shown) – MSalters Aug 18 '14 at 09:09
  • No i didn't load it, i just saved it in order to see what was the structure of the file. Would you like i put all the code ?( I don't know if it useful or not) I've edited my post in order to show you how what is my txt file. – Joker Aug 18 '14 at 09:11
  • Don't worry. I don't have the error anymore but now what i have to do in order to see the picture, once i get the cv::Mat Result and the cv::Mat dist ? – Joker Aug 18 '14 at 12:20
  • the results mat returns the index position of the match in columns. and dists the same with the computed distance. You have to input an array into the index constructor that directly correlates to another variable that holds your images in the same order. I have not worked with BOW, but I have just finished a program using FLANN index for binary descriptors, so I'm not sure how to correlate the BOW histogram whatever to your original images. – Neal Mar 01 '16 at 18:19

0 Answers0