Revert "Avoid obtaining several identical dimensions between two LSH sub-vectors...
authorMaksim Shabunin <Maksim.Shabunin@itseez.com>
Fri, 8 Aug 2014 12:59:24 +0000 (16:59 +0400)
committerMaksim Shabunin <Maksim.Shabunin@itseez.com>
Fri, 8 Aug 2014 12:59:24 +0000 (16:59 +0400)
This reverts commit e85bacff7b676a7789bea6501e694cac299b21be.

modules/flann/include/opencv2/flann/lsh_table.h

index 737a4f5..2c99a3a 100644 (file)
@@ -346,21 +346,13 @@ inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int
     mask_ = std::vector<size_t>((size_t)ceil((float)(feature_size * sizeof(char)) / (float)sizeof(size_t)), 0);
 
     // A bit brutal but fast to code
-    static std::vector<size_t> indices(feature_size * CHAR_BIT);
-
-    //Ensure the Nth bit will be selected only once among the different LshTables
-    //to avoid having two different tables with signatures sharing many dimensions/many bits
-    if( (indices.size() == feature_size * CHAR_BIT) || (indices.size() < key_size_) )
-    {
-      indices.resize( feature_size * CHAR_BIT );
-      for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = i;
-      std::random_shuffle(indices.begin(), indices.end());
-    }
+    std::vector<size_t> indices(feature_size * CHAR_BIT);
+    for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = i;
+    std::random_shuffle(indices.begin(), indices.end());
 
     // Generate a random set of order of subsignature_size_ bits
     for (unsigned int i = 0; i < key_size_; ++i) {
-        size_t index = indices[0];
-        indices.erase( indices.begin() );
+        size_t index = indices[i];
 
         // Set that bit in the mask
         size_t divisor = CHAR_BIT * sizeof(size_t);