/
RGBDepthTest.pde
63 lines (53 loc) · 1.36 KB
/
RGBDepthTest.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
60
61
62
63
// Daniel Shiffman
// All features test
// https://github.com/shiffman/OpenKinect-for-Processing
// http://shiffman.net/p5/kinect/
import org.openkinect.freenect.*;
import org.openkinect.processing.*;
Kinect kinect;
float deg;
boolean ir = false;
boolean colorDepth = false;
boolean mirror = false;
void setup() {
size(1280, 520);
kinect = new Kinect(this);
kinect.initDepth();
kinect.initVideo();
//kinect.enableIR(ir);
kinect.enableColorDepth(colorDepth);
deg = kinect.getTilt();
// kinect.tilt(deg);
}
void draw() {
background(0);
image(kinect.getVideoImage(), 0, 0);
image(kinect.getDepthImage(), 640, 0);
fill(255);
text(
"Press 'i' to enable/disable between video image and IR image, " +
"Press 'c' to enable/disable between color depth and gray scale depth, " +
"Press 'm' to enable/diable mirror mode, "+
"UP and DOWN to tilt camera " +
"Framerate: " + int(frameRate), 10, 515);
}
void keyPressed() {
if (key == 'i') {
ir = !ir;
kinect.enableIR(ir);
} else if (key == 'c') {
colorDepth = !colorDepth;
kinect.enableColorDepth(colorDepth);
}else if(key == 'm'){
mirror = !mirror;
kinect.enableMirror(mirror);
} else if (key == CODED) {
if (keyCode == UP) {
deg++;
} else if (keyCode == DOWN) {
deg--;
}
deg = constrain(deg, 0, 30);
kinect.setTilt(deg);
}
}