We are working on creating an interactive mosaic mirror in processing using the Kinect XBox camera. We currently have code that pixelates a live video feed from the kinect camera, but we are unable to take a photo from the live video feed. We are working on adding code that would allow the user to press a key and take a photo from the video. Any ideas on how to get this user input?
We have already tried using an if key pressed function but were unsuccessful.
Our code so far adapted from a Daniel Shiffman Tutorial:
import kinect4WinSDK.Kinect;
import kinect4WinSDK.SkeletonData;
Kinect kinect;
ArrayList <SkeletonData> bodies;
PImage obama;
PImage smaller;
int scl = 16;
int w, h;
void setup() {
size(600, 749);
kinect = new Kinect(this);
obama = kinect.GetImage();
w = obama.width/scl;
h = obama.height/scl;
smaller = createImage(w,h,RGB);
smaller.copy(obama, 0, 0, obama.width, obama.height, 0, 0, w, h);
}
void draw() {
obama = kinect.GetImage();
smaller.copy(obama, 0, 0, obama.width, obama.height, 0, 0, w, h);
background(0);
smaller.loadPixels();
for (int x =0; x < w; x++) {
for (int y = 0; y < h; y++) {
int index = x + y * w;
color c = smaller.pixels[index];
fill(c);
noStroke();
rect(x*scl, y*scl, scl, scl);
}
}
//image(obama,0,0);
//image(smaller, 0, 0);
}