forked from mathisonian/processingPhotobooth
-
Notifications
You must be signed in to change notification settings - Fork 1
/
processingPhotobooth.pde
59 lines (52 loc) · 1.26 KB
/
processingPhotobooth.pde
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
49
50
51
52
53
54
55
56
57
58
59
import org.openkinect.*;
import org.openkinect.processing.*;
Kinect kinect;
int dividerSize = 5;
int[] depth;
PFont font;
PhotoBoothController photoBoothController;
void setup() {
photoBoothController = new PhotoBoothController();
size(640*2+dividerSize, 480*2+dividerSize);
frameRate(15);
smooth();
font = loadFont("SansSerif-64.vlw");
textFont(font);
kinect = new Kinect(this);
kinect.start();
// kinect.enableDepth(true);
kinect.enableRGB(true);
noStroke();
background(0);
fill(#FFFFFF);
rect(0, 480, width, dividerSize);
rect(640, 0, dividerSize, height);
}
void draw() {
if(!photoBoothController.endPhotoShoot) {
// depth = kinect.getRawDepth();
// photoBoothController.drawPrevious();
photoBoothController.processImage(kinect.getVideoImage(), depth);
if(photoBoothController.isPhotoShoot) {
photoBoothController.drawPhotoShoot();
}
} else {
photoBoothController.oldShoot();
}
}
void keyPressed() {
if(key == ' ') {
photoBoothController.tryPhotoShoot();
}
else if (key == CODED) {
if (keyCode == LEFT) {
photoBoothController.decrementFilter();
} else if (keyCode == RIGHT) {
photoBoothController.incrementFilter();
}
}
}
void stop() {
kinect.quit();
super.stop();
}