From ffed7bff6e7d04750fa63de4b30ee3ff6e01f4ac Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Sun, 3 Mar 2019 11:21:12 +0100 Subject: [PATCH] makes rankMutations return a value Class state-machine isn't working very well --- DescriptorManager.cpp | 17 ++++++++--------- DescriptorManager.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/DescriptorManager.cpp b/DescriptorManager.cpp index 88d0c82..b4bd79e 100644 --- a/DescriptorManager.cpp +++ b/DescriptorManager.cpp @@ -162,24 +162,23 @@ void DescriptorManager::rankImages(string image_name, int method) { //Adds mutated descriptors of a given image to a copy of the distances array. //It inserts these mutated descriptors in a sorted way //Assumes the distances array is filled with the normal distances -void DescriptorManager::rankMutations(string image_name, int method) { +multiset> DescriptorManager::rankMutations(string image_name, int method) { bitset<64> target; - if (features[method].count(image_name) && initialized) { //if we have image + if (features[method].count(image_name) && initialized) { //this should always be the case target = features[method][image_name]; } - else { - return; - } + //cout << "Finding hits for " << image_name << " which has feature-number " << target.to_ullong() << endl; - multiset > local_distance = distances; //get our local copy of the distances. + multiset> local_distance = distances; //get our local copy of the distances. for (int i = 0; i < numMutations; i++) { bitset<64> b1 = mutatedFeatures[method][i][image_name]; unsigned long long d = descriptor_types[method]->distance(target, b1); pair p(d, mutators[i]->ToString()); local_distance.insert(p); - upper_bound + //upper_bound } - + return local_distance; + /* //cout << "..." << endl; for (int i = 0; i < numMutations; i++) { int j = 0; @@ -191,7 +190,7 @@ void DescriptorManager::rankMutations(string image_name, int method) { } j++; } - } + }*/ } //Needs to be called after Init(). diff --git a/DescriptorManager.h b/DescriptorManager.h index 3ebbd13..6855194 100644 --- a/DescriptorManager.h +++ b/DescriptorManager.h @@ -28,7 +28,7 @@ public: ~DescriptorManager(); void Init(); void rankImages(string image_name, int method); - void rankMutations(string image_name, int method); + multiset> rankMutations(string image_name, int method); void runExperiments(); void outputMap(int a); void outputMap();