How to make live video feed the background for my sketch?

edited March 2014 in Kinect

Hi,

I am trying to use a Kinect to grab a live video feed and use it as a background to then 'drag and drop' images around on top of this live video feed.

I have the libraries openkinect and SimpleOpenNI installed.

Does anyone have any code/know how to get this video feed as a background for me to work on top of?

Any help would be much appreciated,

Thanks

Answers

  • I learned much from: 1) http://ericmedine.com/tutorials/LECTURE_kinect_hacking.htm 2) http://shiffman.net/p5/kinect/

    Here's a basic sketch that works on my setup (Kinect Model 1414, Mac OS 10.6.8, Processing 2.0.3, OpenKinect):

    import org.openkinect.*;
    import org.openkinect.processing.*;
    
    Kinect kinect; // Kinect Library object
    
    // Size of kinect image
    int w = 640;
    int h = 480;
    
    public void setup() {
      size(w, h);
      kinect = new Kinect(this);
      kinect.start();
      kinect.enableRGB(true); // camera
    }
    
    public void draw() {
      PImage img = kinect.getVideoImage();
      image(img, 0, 0);
    
      ellipse(mouseX, mouseY, 20, 20); // draw your images here
    }
    
    public void stop() {
      kinect.quit();
    }
    
Sign In or Register to comment.