From 8a26e2bd245bd431b79aa5f0712adb3c593e2fc9 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Sun, 19 Aug 2018 17:28:56 +0200 Subject: [PATCH] Use local distance array for each mutator check --- DescriptorManager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DescriptorManager.cpp b/DescriptorManager.cpp index 739583c..151b4b5 100644 --- a/DescriptorManager.cpp +++ b/DescriptorManager.cpp @@ -187,6 +187,7 @@ void DescriptorManager::similarImages(string image_name, int method, int numImag //inserts the descriptors of the mutated versions of the image. //Assumes the distances array is filled with the normal distances void DescriptorManager::insertMutations(string image_name, int method) { + multiset > local_distance(distances); fs::ifstream ifs; bitset<64> target; if (descriptors[method].count(image_name)) { //if image exists in map @@ -207,7 +208,7 @@ void DescriptorManager::insertMutations(string image_name, int method) { bitset<64> b1(n); unsigned long long d = descriptor_types[method]->distance(target, b1); pair p(d, mutators[i]->ToString()); - distances.insert(p); + local_distance.insert(p); } else { cout << "data not set properly" << endl; @@ -218,7 +219,7 @@ void DescriptorManager::insertMutations(string image_name, int method) { cout << "..." << endl; for (int i = 0; i < numMutations; i++) { int j = 0; - for (std::multiset>::iterator it = distances.begin(); it != distances.end(); ++it) { + for (std::multiset>::iterator it = local_distance.begin(); it != local_distance.end(); ++it) { //cout << "hey " << endl; if (it->second == mutators[i]->ToString()) { cout << "Hit. On the " << j << "th position: " << endl;