Kinect Physics Mirror error

edited November 2014 in Kinect

Hi, I have been trying to do the Kinect Physics. However, the default context.setMirror(true) doesn't seem to work in the code. It still runs, but isn't mirrored.

this is my setup code:

void setup() { // it's possible to customize this, for example 1920x1080 size(1920, 1080, OPENGL); context = new SimpleOpenNI(this); // initialize SimpleOpenNI object if (!context.enableDepth() || !context.enableUser()) { // if context.enableScene() returns false // then the Kinect is not working correctly // make sure the green light is blinking println("Kinect not connected!"); exit(); } else { // mirror the image to be more intuitive context.setMirror(true); // calculate the reScale value // currently it's rescaled to fill the complete width (cuts of top-bottom) // it's also possible to fill the complete height (leaves empty sides) reScale = (float) width / kinectWidth; // create a smaller blob image for speed and efficiency blobs = createImage(kinectWidth/3, kinectHeight/3, RGB); // initialize blob detection object to the blob image dimensions theBlobDetection = new BlobDetection(blobs.width, blobs.height); theBlobDetection.setThreshold(0.3); // initialize ToxiclibsSupport object gfx = new ToxiclibsSupport(this); // setup box2d, create world, set gravity box2d = new Box2DProcessing(this); box2d.createWorld(); box2d.setGravity(0, -40); // set random colors (background, blob) setRandomColors(1);

float gap = kinectWidth / 21;
for (int i=0; i<20; i++)
{
  drawString(gap * (i+1), 2, 10);
}

} }

Tagged:

Answers

  • edited November 2014

    void setup()

    {

    // it's possible to customize this, for example 1920x1080

    size(1920, 1080, OPENGL);

    smile = loadImage("smiley.png");

    context = new SimpleOpenNI(this); // initialize SimpleOpenNI object if (!context.enableDepth() || !context.enableUser()) { // if context.enableScene() returns false // then the Kinect is not working correctly // make sure the green light is blinking println("Kinect not connected!"); exit(); } else { // mirror the image to be more intuitive context.setMirror(true); // calculate the reScale value // currently it's rescaled to fill the complete width (cuts of top-bottom) // it's also possible to fill the complete height (leaves empty sides) reScale = (float) width / kinectWidth; // create a smaller blob image for speed and efficiency blobs = createImage(kinectWidth/3, kinectHeight/3, RGB); // initialize blob detection object to the blob image dimensions theBlobDetection = new BlobDetection(blobs.width, blobs.height); theBlobDetection.setThreshold(0.3); // initialize ToxiclibsSupport object gfx = new ToxiclibsSupport(this); // setup box2d, create world, set gravity box2d = new Box2DProcessing(this); box2d.createWorld(); box2d.setGravity(0, -2); // set random colors (background, blob) setRandomColors(1);

    float gap = kinectWidth / 21;
    for (int i=0; i<20; i++)
    {
      drawString(gap * (i+1), 2, 10);
    }
    

    } }

Sign In or Register to comment.