The output image of using EasyOpenNI with an xbox360 kinect is a small 640 x 480 image, is there anyway to maybe scale it up to fullscreen, or near fullscreen.
I tried using image.resize() but it creates additional images on the top, and the expanded image does not refresh, it gives the initial frame at boot.
Code:
import SimpleOpenNI.*;
SimpleOpenNI kinect;
PImage depthCam;
PImage result;
void setup()
{
size(640, 480);
surface.setResizable(true);
background(0);
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
result = createImage(width,height,RGB);
}
void draw()
{
background(0);
kinect.update();
depthCam = kinect.depthImage();
int[] depthVals = kinect.depthMap();
result.loadPixels();
for (int y=0; y<depthCam.height; y=y+5)
{
for (int x =0; x<depthCam.width; x=x+5)
{
int loc = x+(y*depthCam.width);
if (depthVals[loc] <= 1200 && depthVals[loc] > 50) {
result.pixels[loc] = color(250);
}
else if (depthVals[loc] > 1200 && depthVals[loc]< 3000 )
{
result.pixels[loc] = color(102);
}
else {
//otherwise let the pixel value in the result image be white
result.pixels[loc] = color(0);
}
}
}
result.updatePixels();
result.resize(640*2,480*2);
image(result,0,0);
}
Here is a screenshot of what appears:
Everything is working correctly, except for the fact that there are two duplicated streams at the top (that do refresh), and the enlarged stream does not refresh.