Hello,
I have created an interactive “graphic” with Open Kinect and Processing where the Kinect detects your hand movements to reveal the “moon surface image” which is below the top image called “moon dirt”. Basically you have to move your hands to “clean the moon”.
I have read a bit that the Kinect depth sensor is only able to be at a fixed resolution, however I need it to be fullscreen. I am able to get the 2 images moonSurface and moonDirt to be full screen, however the interactive bit, where you “wipe off” the moonDirt image does not scale full screen.
Is there any quick method to force kinect to be full screen? Does this involve somehow upscalling everything, instead of using fullScreen();
It needs to be full screen because, the next step would be that it will be displayed by a projector onto a table, where the user would be doing a “wiping” action to clean off the orange moonDirt to reveal moonSurface.
As you can see, on the image above, the moon surface is revealed when kinect detects movement
Right now it is fixed at this resolution
import org.openkinect.freenect.*;
import org.openkinect.processing.*;
import processing.video.*;
Kinect kinect;
// Depth image
PImage depthImg;
PImage maskingImg;
PImage moonSurface;
PImage moonDirt;
// Which pixels do we care about?
int minDepth = 930;
int maxDepth = 940;
// What is the kinect's angle
float angle;
void setup() {
size(640, 480);
//fullScreen();
kinect = new Kinect(this);
kinect.initDepth();
angle = kinect.getTilt();
// Blank image
depthImg = new PImage(kinect.width, kinect.height);
// Masking image
maskingImg = new PImage(kinect.width, kinect.height);
// Load the movie files
moonSurface = loadImage("MoonSurface.png");
moonDirt = loadImage("MoonDirt.png");
println("SETUP done");
}
void draw() {
// Draw moon surface
image(moonSurface, 0, 0, 640, 480);
// Draw the moon dirt
image(moonDirt, 0, 0);
// Threshold the depth image
int[] rawDepth = kinect.getRawDepth();
for (int i=0; i < rawDepth.length; i++) {
if (rawDepth[i] >= minDepth && rawDepth[i] <= maxDepth) {
depthImg.pixels[i] = color(255);
maskingImg.pixels[i] = color(255);
} else {
depthImg.pixels[i] = color(0);
}
}
// Draw the thresholded image
//depthImg.updatePixels();
//maskingImg.updatePixels();
//moonDirt.resize(640, 480); //(640, 480);
moonDirt.loadPixels();
for (int i=0; i < rawDepth.length; i++) {
if ( maskingImg.pixels[i] == color(255) ) {
moonDirt.pixels[i] = color( 0, 0, 0, 0 );
}
}
moonDirt.updatePixels();
image(moonDirt, 0, 0, 640, 480);
//image(depthImg, kinect.width, 0);
//image(maskingImg, kinect.width, 0);
//fill(0);
text("TILT: " + angle, 10, 20);
text("THRESHOLD: [" + minDepth + ", " + maxDepth + "]", 10, 36);
}
// Adjust the angle and the depth threshold min and max
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
angle++;
} else if (keyCode == DOWN) {
angle--;
}
angle = constrain(angle, -10, 10);
kinect.setTilt(angle);
} else if (key == 'a') {
minDepth = constrain(minDepth+10, 0, maxDepth);
} else if (key == 's') {
minDepth = constrain(minDepth-10, 0, maxDepth);
} else if (key == 'z') {
maxDepth = constrain(maxDepth+10, minDepth, 2047);
} else if (key =='x') {
maxDepth = constrain(maxDepth-10, minDepth, 2047);
}
}