-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.h
More file actions
48 lines (37 loc) · 716 Bytes
/
image.h
File metadata and controls
48 lines (37 loc) · 716 Bytes
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 <bits/stdc++.h>
using namespace std;
const double eps = 1e-5;
const double threshold = 30.0;
const int max_segments = 10;
const double tolerance = 0.001;
struct RGB {
double R, G, B;
void operator+=(const RGB& x) {
R+=x.R;
G+=x.G;
B+=x.B;
}
void operator/=(int y) {
if(y!=0) {
R/=y;
G/=y;
B/=y;
}
}
};
struct XYZ {
double X, Y, Z;
};
struct LAB {
double L, A, B;
};
struct Image {
RGB* rgb;
char temp[3];
int width, height, maxlevel;
};
void getImage(Image* image, string file);
void convertRGB2XYZ(const RGB& src, XYZ& dest);
void convertXYZ2LAB(const XYZ& src, LAB& dest);
double dist(const LAB& C1, const LAB& C2);
double dist(const RGB& col1, const RGB& col2);