-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompare.pde
More file actions
34 lines (29 loc) · 887 Bytes
/
Compare.pde
File metadata and controls
34 lines (29 loc) · 887 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
long compare() { //PImage m, PImage n) {
//blend(target,0,0,width,height,0,0,width,height,DIFFERENCE);
long diff = 0;
loadPixels();
String name = "TriE";
//save some images
if (iterations % divisor == 0) {
save("TriE" + divisor + ".png");
divisor *= 2;
println("Iteration " + iterations);
for (int ii = 0; ii < numElements; ii++) {
tris[ii].printTri();
}
}
//PImage diffImg = createImage(width,height,RGB);
for (int i = 0; i < width * height; i++) {
diff += abs(pixels[i] - target.pixels[i]);
//diff += abs(pixels[i].saturation() - target.pixels[i].saturation());
//diff += abs(pixels[i].brightness() - target.pixels[i].brightness());
//pixels[i] = abs(pixels[i] - target.pixels[i]);
}
//updatePixels();
return diff/1000000;
}
void delay(int t) {
int time = millis() + t;
while (millis() < time) {
}
}