Created
April 16, 2013 21:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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