0

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); 


}

  • I'm not sure if I understand your question but check out [How do I check if the user is pressing a key?](https://stackoverflow.com/questions/18037576/how-do-i-check-if-the-user-is-pressing-a-key) and [How can I get the user input in Java?](https://stackoverflow.com/questions/5287538/how-can-i-get-the-user-input-in-java) – sonnyb Apr 30 '19 at 15:19
  • "We have already tried using an if key pressed function but were unsuccessful." You might get more responses if you explain what you tried and focus your question to this. See [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Good luck! – sonnyb Apr 30 '19 at 15:20

0 Answers0