Permalink
63 lines (53 sloc) 1.36 KB
// 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);
}
}