More descriptive function comments

This commit is contained in:
Mark Hoekveen
2019-03-03 11:19:39 +01:00
parent ddcf8d7ca5
commit aed05f694c
+7 -2
View File
@@ -32,6 +32,7 @@ DescriptorManager::DescriptorManager(const fs::path & image_path) {
DescriptorManager::~DescriptorManager() { DescriptorManager::~DescriptorManager() {
//Do some clean-up? //Do some clean-up?
//Realistically, when this gets destroyed the application is done anyway. //Realistically, when this gets destroyed the application is done anyway.
//Let the OS take care of garbage collection
} }
//Loads all base images, calculates their descriptors, //Loads all base images, calculates their descriptors,
@@ -139,7 +140,8 @@ void DescriptorManager::Init() {
initialized = true; initialized = true;
} }
//Sorts all images we have on distance from the query image //Sorts all base (unmutated) images in order of distance from the given image
//After this function the distances array will be filled
void DescriptorManager::rankImages(string image_name, int method) { void DescriptorManager::rankImages(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) { //if we have image
@@ -156,7 +158,8 @@ void DescriptorManager::rankImages(string image_name, int method) {
} }
} }
//inserts the descriptors of the mutated versions of the image. //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 //Assumes the distances array is filled with the normal distances
void DescriptorManager::rankMutations(string image_name, int method) { void DescriptorManager::rankMutations(string image_name, int method) {
bitset<64> target; bitset<64> target;
@@ -190,6 +193,8 @@ void DescriptorManager::rankMutations(string image_name, int method) {
} }
} }
//Needs to be called after Init().
//Takes all the calculated features and rankes
void DescriptorManager::runExperiments() { void DescriptorManager::runExperiments() {
for (int i = 0; i < numDescriptors; i++) { for (int i = 0; i < numDescriptors; i++) {
for (map<string, bitset<64>>::iterator it = features[i].begin(); it != features[i].end(); ++it) { for (map<string, bitset<64>>::iterator it = features[i].begin(); it != features[i].end(); ++it) {