makes rankMutations return a value

Class state-machine isn't working very well
This commit is contained in:
Mark Hoekveen
2019-03-03 11:21:12 +01:00
parent aa31c1f513
commit ffed7bff6e
2 changed files with 9 additions and 10 deletions
+7 -8
View File
@@ -162,14 +162,12 @@ void DescriptorManager::rankImages(string image_name, int method) {
//Adds mutated descriptors of a given image to a copy of the distances array. //Adds mutated descriptors of a given image to a copy of the distances array.
//It inserts these mutated descriptors in a sorted way //It inserts these mutated descriptors in a sorted way
//Assumes the distances array is filled with the normal distances //Assumes the distances array is filled with the normal distances
void DescriptorManager::rankMutations(string image_name, int method) { multiset<pair<unsigned long long, string>> DescriptorManager::rankMutations(string image_name, int method) {
bitset<64> target; 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]; target = features[method][image_name];
} }
else {
return;
}
//cout << "Finding hits for " << image_name << " which has feature-number " << target.to_ullong() << endl; //cout << "Finding hits for " << image_name << " which has feature-number " << target.to_ullong() << endl;
multiset<pair<unsigned long long, string>> local_distance = distances; //get our local copy of the distances. multiset<pair<unsigned long long, string>> local_distance = distances; //get our local copy of the distances.
for (int i = 0; i < numMutations; i++) { for (int i = 0; i < numMutations; i++) {
@@ -177,9 +175,10 @@ void DescriptorManager::rankMutations(string image_name, int method) {
unsigned long long d = descriptor_types[method]->distance(target, b1); unsigned long long d = descriptor_types[method]->distance(target, b1);
pair<unsigned long long, string> p(d, mutators[i]->ToString()); pair<unsigned long long, string> p(d, mutators[i]->ToString());
local_distance.insert(p); local_distance.insert(p);
upper_bound //upper_bound
} }
return local_distance;
/*
//cout << "..." << endl; //cout << "..." << endl;
for (int i = 0; i < numMutations; i++) { for (int i = 0; i < numMutations; i++) {
int j = 0; int j = 0;
@@ -191,7 +190,7 @@ void DescriptorManager::rankMutations(string image_name, int method) {
} }
j++; j++;
} }
} }*/
} }
//Needs to be called after Init(). //Needs to be called after Init().
+1 -1
View File
@@ -28,7 +28,7 @@ public:
~DescriptorManager(); ~DescriptorManager();
void Init(); void Init();
void rankImages(string image_name, int method); void rankImages(string image_name, int method);
void rankMutations(string image_name, int method); multiset<pair<unsigned long long, string>> rankMutations(string image_name, int method);
void runExperiments(); void runExperiments();
void outputMap(int a); void outputMap(int a);
void outputMap(); void outputMap();