Clean-up mutation code

This commit is contained in:
Mark Hoekveen
2019-03-06 20:05:37 +01:00
parent 887bd45cac
commit f18c4be520
+5 -6
View File
@@ -16,7 +16,6 @@ namespace fs = boost::filesystem;
//but should be overloaded by a child class //but should be overloaded by a child class
class Mutation { class Mutation {
public: public:
//virtual void mutate(Image* img) = 0;
virtual Image* getMutated(Image* img) = 0; virtual Image* getMutated(Image* img) = 0;
virtual string ToString() = 0; virtual string ToString() = 0;
@@ -31,10 +30,6 @@ public:
Image* getMutated(Image* img) { Image* getMutated(Image* img) {
Image* mut = new Image(*img); Image* mut = new Image(*img);
mut->type(GrayscaleType); mut->type(GrayscaleType);
/*mut->quantizeColorSpace(GRAYColorspace);
mut->quantizeColors(256);
mut->quantize();
mut->type(TrueColorType);*/
return mut; return mut;
} }
string ToString() { string ToString() {
@@ -42,7 +37,7 @@ public:
} }
}; };
class Flip : public Mutation { //Mirrors over the vertical axis
public: public:
Image* getMutated(Image* img) { Image* getMutated(Image* img) {
Image* mut = new Image(*img); Image* mut = new Image(*img);
@@ -66,6 +61,7 @@ public:
} }
}; };
//Very low quality JPEG re-encoding
class LowQ : public Mutation { class LowQ : public Mutation {
public: public:
Image * getMutated(Image* img) { Image * getMutated(Image* img) {
@@ -78,6 +74,7 @@ public:
} }
}; };
//Medium quality JPEG re-encoding
class JPEG : public Mutation { class JPEG : public Mutation {
public: public:
Image * getMutated(Image* img) { Image * getMutated(Image* img) {
@@ -90,6 +87,7 @@ public:
} }
}; };
//A 50% hue-shift to the right
class Hue : public Mutation { class Hue : public Mutation {
public: public:
Image * getMutated(Image* img) { Image * getMutated(Image* img) {
@@ -102,6 +100,7 @@ public:
} }
}; };
//A 25% increase in brightness
class Brighten : public Mutation { class Brighten : public Mutation {
public: public:
Image * getMutated(Image* img) { Image * getMutated(Image* img) {