Quick wip

This commit is contained in:
2019-07-20 15:26:07 +02:00
parent 2fc2ae5aba
commit d28128009b
2 changed files with 10 additions and 8 deletions
+7 -7
View File
@@ -57,6 +57,7 @@ DescriptorManager::DescriptorManager(const fs::path & image_path) {
//Returns a pointer to the image mutated by the given method.
//Either gets it from disk, or calculates it directly.
//Deprecated?
Image* DescriptorManager::GetMutated(Image* image, string image_name, int method) {
return mutators[method]->getMutated(image);
fs::path mutPath(img_path / mutators[method]->ToPath() / image_name);
@@ -101,13 +102,13 @@ void DescriptorManager::LoadFeatures(string image_path, string image_name) {
//Fills the mutatedFeatures array with all descriptors for the given mutation and image.
void DescriptorManager::LoadMutationFeatures(string image_path, string image_name, int mutation) {
if (!current_image) current_image->read(image_path);
Image* image = mutators[mutation]->getMutated(current_image);
for (int i = 0; i < numDescriptors; i++) {
//First check if we already have this information from the loaded cache
/*if (mutatedFeatures[i][mutation].count(image_name) > 0) {
continue;
}*/
if (!current_image) current_image->read(image_path);
Image* image = GetMutated(current_image, image_name, i);
fs::path featurePath("meta" / descriptor_types[i]->ToPath() / mutators[mutation]->ToPath() / image_name);
uint64_t b1;
@@ -124,8 +125,8 @@ void DescriptorManager::LoadMutationFeatures(string image_path, string image_nam
}
mutatedFeatures_vector[i][mutation].push_back(pair<string, uint64_t>(image_name, b1));
mutatedFeatures[i][mutation][image_name] = b1;
delete image;
}
delete image;
}
//Calculates all features, mutations and features of mutations.
@@ -147,10 +148,9 @@ void DescriptorManager::Init() {
//if (!itr->path().has_extension()) continue; //skip directories and such
string image_name = (*itr).filename().generic_string();
string image_path = (*itr).string();
{ //Progress bar
filecount++;
if (show_progress) {
cout << setw(60) << setfill('*') << "\r" << string(60, ' ') << flush;
cout << setfill('*') << setw(60) << right<< "\rProgress: " << filecount*100/numImages << "% - (" << filecount << "/" << numImages << "): " << image_name << flush;
cout << setfill('*') << setw(60) << right<< "\rProgress: " << ++filecount*100/numImages << "% - (" << filecount << "/" << numImages << "): " << image_name << flush;
}
//Store all base features in the features array
LoadFeatures(image_path, image_name);
@@ -195,7 +195,7 @@ void DescriptorManager::CompareFeatures() {
//No need to check for mutated features, because they are always calculated and saved together
}
}
cout << "IMAGES: " << images.size() << endl;
cout << "Images left to check: " << images.size() << endl;
}
//Saves feature map to disk.