Add Flop, LowQ, JPEG, Hue, Brighten
Extra mutators yay
This commit is contained in:
@@ -21,6 +21,11 @@ DescriptorManager::DescriptorManager(const fs::path & image_path) {
|
|||||||
|
|
||||||
mutators[0] = new Grayscale();
|
mutators[0] = new Grayscale();
|
||||||
mutators[1] = new Flip();
|
mutators[1] = new Flip();
|
||||||
|
mutators[2] = new Flop();
|
||||||
|
mutators[3] = new JPEG();
|
||||||
|
mutators[4] = new LowQ();
|
||||||
|
mutators[5] = new Hue();
|
||||||
|
mutators[6] = new Brighten();
|
||||||
}
|
}
|
||||||
|
|
||||||
//No need to call destructor.. yet?
|
//No need to call destructor.. yet?
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ public:
|
|||||||
void outputMap();
|
void outputMap();
|
||||||
private:
|
private:
|
||||||
static const int numDescriptors = 8;
|
static const int numDescriptors = 8;
|
||||||
static const int numMutations = 2;
|
static const int numMutations = 7;
|
||||||
//TODO: automagically update this?
|
//TODO: automagically update this?
|
||||||
|
|
||||||
map<string, bitset<64>> descriptors[numDescriptors]; //array of maps that will hold the descriptors
|
map<string, bitset<64>> descriptors[numDescriptors]; //array of maps that will hold the descriptors
|
||||||
|
|||||||
+61
@@ -53,3 +53,64 @@ public:
|
|||||||
return "Flip";
|
return "Flip";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Flop : public Mutation {
|
||||||
|
public:
|
||||||
|
Image * getMutated(Image* img) {
|
||||||
|
Image* mut = new Image(*img);
|
||||||
|
mut->flop();
|
||||||
|
return mut;
|
||||||
|
}
|
||||||
|
string ToString() {
|
||||||
|
return "Flop";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class LowQ : public Mutation {
|
||||||
|
public:
|
||||||
|
Image * getMutated(Image* img) {
|
||||||
|
Image* mut = new Image(*img);
|
||||||
|
mut->quality(5);
|
||||||
|
return mut;
|
||||||
|
}
|
||||||
|
string ToString() {
|
||||||
|
return "Low Quality";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class JPEG : public Mutation {
|
||||||
|
public:
|
||||||
|
Image * getMutated(Image* img) {
|
||||||
|
Image* mut = new Image(*img);
|
||||||
|
mut->quality(45);
|
||||||
|
return mut;
|
||||||
|
}
|
||||||
|
string ToString() {
|
||||||
|
return "JPEG";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Hue : public Mutation {
|
||||||
|
public:
|
||||||
|
Image * getMutated(Image* img) {
|
||||||
|
Image* mut = new Image(*img);
|
||||||
|
mut->modulate(100, 100, 150);
|
||||||
|
return mut;
|
||||||
|
}
|
||||||
|
string ToString() {
|
||||||
|
return "Hue";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Brighten : public Mutation {
|
||||||
|
public:
|
||||||
|
Image * getMutated(Image* img) {
|
||||||
|
Image* mut = new Image(*img);
|
||||||
|
mut->modulate(125, 100, 100);
|
||||||
|
mut->sigmoidalContrast(false, 20.0);
|
||||||
|
return mut;
|
||||||
|
}
|
||||||
|
string ToString() {
|
||||||
|
return "Brighten";
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user