Interactive Mirror

edited October 2016 in Kinect

Hi guys, I just want to know if its possible to do an (interactive mirror) with processing and Kinect. Interactive mirror is for changing clothes at stores, I had seen many examples but is it possible with processing ?!

Tagged:

Answers

  • Answer ✓

    It is possible. Here is an example of the concept. Instead of using clothes, I am using an ellipse that moves based on the mouse position. Then you can click in the image to fix it in position. Click it again to be able to move the ellipse again over all the image. You can change the ellipse to and PImage object. In the PImage object you can load a piece of clothing. Notice I am playing with the alpha value so to get transparency. It might be useful to you when working in your concept.

    Kf

    /**
     * Getting Started with Capture.
     * 
     * Reading and displaying an image from an attached Capture device. 
    *
    * Code modified by Kf
     */
    
    import processing.video.*;
    
    Capture cam;
    boolean stickIt=false;
    int x, y;
    
    void setup() {
      size(640, 480);
      //size(1920,1080);
    
      String[] cameras = Capture.list();
    
      if (cameras == null) {
        println("Failed to retrieve the list of available cameras, will try the default...");
        cam = new Capture(this, 640, 480);
      } 
      if (cameras.length == 0) {
        println("There are no cameras available for capture.");
        exit();
      } else {
        println("Available cameras:");
        printArray(cameras);
    
        // The camera can be initialized directly using an element
        // from the array returned by list():
        cam = new Capture(this, cameras[0]);
        // Or, the settings can be defined based on the text in the list
        //cam = new Capture(this, 640, 480, "Built-in iSight", 30);
        frameRate(60);
        // Start capturing the images from the camera
        cam.start();
      }
    }
    
    void draw() {
    
      if (cam.available() == true) {
        cam.read();
    
        image(cam, 0, 0, width, height);
        // The following does the same as the above image() line, but 
        // is faster when just drawing the image without any additional 
        // resizing, transformations, or tint.
        //set(0, 0, cam);
    
    
        if (stickIt) {
          fill(200, 20, 20, 125);
          ellipse(x, y, 75, 50);
        } else {
          fill(200, 20, 20, 255);
          ellipse(mouseX, mouseY, 75, 50);
        }
    
    
      }
    }
    
    void mouseReleased() {
      stickIt=!stickIt;
      if (stickIt) {
        x=mouseX;
        y=mouseY;
      }
    }
    
  • OMG thank u so much sir its the exact answer !! :)

Sign In or Register to comment.