title: C++/OpenCV - How to index pictures for image retrieval? (and find the best image)
body: <p>I would like to use BoW with FLANN in order to index all my pictures inside my database.(For a CBIR project)</p>
  
  <p><strong>What i did</strong> :</p>
  
  <ol>
  <li>Loop over all ma database in order to compute the descriptors of each pictures.</li>
  <li>Clustering descriptors using K-MEAN</li>
  <li>Extraction of BoWDescriptors (Visual words) in order to have a big histogram with all my features</li>
  <li>Use FLANN Index to compute an index in each pictures</li>
  </ol>
  
  <p>Code: </p>
  
  <pre><code>// Create Flann LSH index
  cv::flann::Index flannIndex(this-&gt;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() );
  </code></pre>
  
  <p>DescriptorBow contains all my BoWfeatures of my database.
  ResponseHist constains the bowFeature of my picture i want to eval.</p>
  
  <p>Now, what i have to do in order to see what is the best matching picture ?</p>
  
  <p>Can someone help me ?</p>