-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGBCam.pde
More file actions
48 lines (38 loc) · 1 KB
/
GBCam.pde
File metadata and controls
48 lines (38 loc) · 1 KB
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
48
import processing.video.*;
Capture kamera;
PImage goruntu;
color[] gbRenk = { color(15, 56, 15), color(48, 98, 48), color(139, 172, 15), color(155, 188, 15)};
void setup() {
size(1024, 1024);
kamera = new Capture(this, 320, 240);
kamera.start();
goruntu = createImage(128, 128, RGB);
}
void draw() {
if (kamera.available()) {
kamera.read();
kamera.loadPixels();
for (int x = 0; x < 128; x++) {
for (int y = 0; y < 128; y++) {
int i = x + y * 128;
int kx = int(x * 1.875f);
int ky = int(y * 1.875f);
int ki = 40 + kx + ky * 320;
color renk = kamera.pixels[ki];
float b = brightness(renk);
b += random(10);
renk = color(gbRenk[int(b / 67)]);
goruntu.pixels[i] = renk;
}
}
//int i = x + y * kamera.width;
// kamera.pixels[]
goruntu.updatePixels();
}
image(goruntu, 0, 0, 1024, 1024);
}
int kayitSayisi = 2;
void mousePressed() {
goruntu.save("G" + kayitSayisi + ".jpg");
kayitSayisi++;
}