Quantcast
Channel: Kinect - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 530

Kinect map pixel in Z axis

$
0
0

Hello Guys,

im quite fresh in the processing world and no native speaker so please be gentle :)

but direct to the Point:

Im would like to know is there any possibilty to get an defined Z axis output of every pixel ? with the code below (copied from shiffman) i can get an matrix out of the kinect so is there any possibility to map every single pixel and send it to an arduino ?

        import org.openkinect.freenect2.*;
        import org.openkinect.processing.*; //<>//

        Kinect2 kinect2;

        void setup() {
          size(32, 16, P2D);
          kinect2 = new Kinect2(this);
          kinect2.initVideo();
          kinect2.initDepth();
        }


        void draw() {
          background(0);

    PImage img = kinect2.getDepthImage();
    //image(img, 0, 0);

    for (int x = 0; x < img.width; x++); {
    for (int y = 0; y < img.height; x++);{
    int index = x +y * img.widht;
    float b = brightness (img.pixels[index]);
    float z = map(b, 0, 255, 250, -250);
    fill(255-b);
    pushMatrix();
    translate( x, y, z);
    rect( 0, 0,skip/2,skip/2);
    popMatrix();
        }
      }
    }

Viewing all articles
Browse latest Browse all 530

Trending Articles