-
Notifications
You must be signed in to change notification settings - Fork 1
/
image.h
47 lines (31 loc) · 1.03 KB
/
image.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
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <string>
#include <vector>
#include <stdio.h>
#include <iostream>
#include <complex>
#include <queue>
#include <thread>
using namespace std::complex_literals;
enum Mode {forward, inverse};
enum Color {red, green, blue};
typedef std::vector<std::complex<float>> ComplexVec;
typedef std::complex<float> ComplexNum;
constexpr float PI = 3.141592F;
class Image{
private:
std::string filename;
std::vector<std::vector<std::vector<ComplexNum>>> rawimage;
std::vector<ComplexVec> bwimage;
void PPMToArray(std::string filename);
ComplexVec ditfft(ComplexVec &slice, Mode mode);
ComplexVec fft(ComplexVec &slice);
ComplexVec ifft(ComplexVec &slice);
float GetThreshold(Color channel, int ratio);
void ZeroOut(Color channel, float threshold);
void fft2(std::vector<ComplexVec> &channel);
void ifft2(std::vector<ComplexVec> &channel);
public:
Image(std::string filename);
void Compress(int ratio);
void ImageToPPM();
};