-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimageSlicer.h
34 lines (29 loc) · 861 Bytes
/
imageSlicer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <vector>
#include <string>
#include <Magick++.h>
using namespace std;
using namespace Magick;
struct RGB {
int red;
int green;
int blue;
};
// object which holds an image and slices it into pieces to
// extract average RGB values for each subpiece.
class ImageSlicer {
string imgsrc; // source of the input image
int numSlices; // number of slices in x and y direction
int cutSize; // number of sub slices to make from each image
vector< vector< RGB > > rgbs; // vector to store RGB values of pieces
vector<RGB> averages; // vector to store average rgbs
vector< vector< Image > > slices; // image slices.
Image sourceImage;
public:
ImageSlicer(string imgsrc, int n, int cSize);
vector<RGB> getAverages();
vector< vector< Image > > getSlices();
private:
void slice();
void calculateRGBValues();
};