代码:
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;
}
// enable ir generation
//context.enableRGB(640,480,30);
//context.enableRGB(1280,1024,15);
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);
}
效果图
![](https://img-my.csdn.net/uploads/201209/23/1348394916_8526.jpg)