// import library
import SimpleOpenNI.*;
// declare SimpleOpenNI object
SimpleOpenNI context;
// PImage to hold incoming imagery
PImage cam;
void setup() {
// same as Kinect dimensions
size(640, 480);
// initialize SimpleOpenNI object
context = new SimpleOpenNI(this);
if (!context.enableUser()) {
// if context.enableScene() returns false
// then the Kinect is not working correctly
// make sure the green light is blinking
println("Kinect not connected!");
exit();
} else {
// mirror the image to be more intuitive
context.setMirror(true);
}
}
void draw() {
// update the SimpleOpenNI object
context.update();
// put the image into a PImage
cam = context.userImage().get();
// display the image
image(cam, 0, 0);
}
I have the kinect connected and it works fine on other sketches. I am using Processing 2.1.1 and SimpleOpenNI version 1.96.