72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
#include <bitset>
|
|
#include <climits>
|
|
#include <set>
|
|
#include <boost/filesystem.hpp>
|
|
#include <boost/system/error_code.hpp>
|
|
#include <boost/filesystem/fstream.hpp>
|
|
//Boost serialization test:
|
|
#include <boost/archive/binary_oarchive.hpp>
|
|
#include <boost/archive/binary_iarchive.hpp>
|
|
#include <boost/serialization/map.hpp>
|
|
#include <boost/serialization/bitset.hpp>
|
|
#include <boost/serialization/string.hpp>
|
|
|
|
//YAS Serialization:
|
|
#include <yas/serialize.hpp>
|
|
#include <yas/std_types.hpp>
|
|
|
|
#include <chrono> //Debug, for measuring execution times
|
|
|
|
#include <Magick++.h>
|
|
#include <string>
|
|
#include "Descriptor.h"
|
|
#include "Mutation.h"
|
|
|
|
using namespace std;
|
|
using namespace chrono;
|
|
using namespace Magick;
|
|
|
|
//ENUM_STRING(descriptorss, (totalColors)(averageColor)(numDescriptors))
|
|
|
|
namespace fs = boost::filesystem;
|
|
namespace ar = boost::archive;
|
|
|
|
//Manager class for descriptors.
|
|
//Contains functions to load, store, process
|
|
//all images, descriptors and mutations
|
|
class DescriptorManager {
|
|
public:
|
|
DescriptorManager();
|
|
DescriptorManager(const fs::path & image_path);
|
|
~DescriptorManager();
|
|
void Init();
|
|
void SaveFeatures();
|
|
void LoadFeatures();
|
|
void rankImages(string image_name, int method);
|
|
multiset<pair<unsigned long long, string>> rankMutations(string image_name, int method);
|
|
void runExperiments();
|
|
void generatePreviews(string imagename);
|
|
void outputMap(int a);
|
|
void outputMap();
|
|
void outputRank(string imagename, int method);
|
|
private:
|
|
static const int numDescriptors = 8;
|
|
static const int numMutations = 8;
|
|
//TODO: automagically update this?
|
|
|
|
bool initialized = false;
|
|
int numImages;
|
|
|
|
map<string, bitset<64>> features[numDescriptors]; //array of maps that will hold the descriptors
|
|
map<string, bitset<64>> mutatedFeatures[numDescriptors][numMutations];
|
|
multiset<pair<unsigned long long, string> > distances; //multiset that stores the distances
|
|
fs::path img_path; //where the images are
|
|
Descriptor* descriptor_types[numDescriptors];
|
|
Mutation* mutators[numMutations];
|
|
};
|
|
|