Skip to content

Instantly share code, notes, and snippets.

@dan-mckay
Created April 16, 2013 21:29
Show Gist options
  • Save dan-mckay/5399811 to your computer and use it in GitHub Desktop.
Save dan-mckay/5399811 to your computer and use it in GitHub Desktop.
A sample script in Processing from simple-openni that visualises depth map data from a Kinect
import SimpleOpenNI.*;
SimpleOpenNI context;
void setup()
{
context = new SimpleOpenNI(this);
// mirror is by default enabled
context.setMirror(true);
// enable depthMap generation
if(context.enableDepth() == false)
{
println("Can't open the depthMap, maybe the camera is not connected!");
exit();
return;
}
if(context.enableRGB() == false)
{
println("Can't open the rgbMap, maybe the camera is not connected or there is no rgbSensor!");
exit();
return;
}
size(context.depthWidth() + context.rgbWidth() + 10, context.rgbHeight());
}
void draw()
{
// update the cam
context.update();
background(200,0,0);
// draw depthImageMap
image(context.depthImage(),0,0);
// draw irImageMap
image(context.rgbImage(),context.depthWidth() + 10,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment