Kinect SimpleOpenNI

edited November 2017 in Kinect

Hello guys,I m trying to make this code with kinect,Im using as help guide the book "Makings things see" with SimpleOpenNI library in processing 2.2.1. I want get the data from the kinct and when i get into one specific area in front of kinect the pixels will get colorized.This is the first test of an aplication for children with Down Syndrome,I can make it wit user tracking because it will be awkard making them take a pose to calibrate. Thank You very much Here is the code:

``

import SimpleOpenNI.*;

SimpleOpenNI kinect;

int closestValue; int closestX; int closestY; int Threshold; int PixelsInFrame;

void setup() {

size(640, 480); kinect = new SimpleOpenNI(this);

kinect.enableDepth(); //kinect.enableRGB(); }

void draw() {

closestValue =800; Threshold = 1000;

kinect.update();

int[] depthValues = kinect.depthMap();

//int currentDepthValue =

//PImage depthImage = kinect.depthImage();

// get the depth array from kinect

for (int y = 0; y < 480; y++) { for (int x = 0; x < 640; x++) {

  int i = x + y *640;

  int currentDepthValues  = depthValues[i];


  //Find the pixels in certain distance bound)
  //fIND THE PIXELS IN Y AND X AXIS and paint them one colour
  //find the pixels and make them interact with other shapes

  if ( currentDepthValues > 0 && currentDepthValues <= Threshold && currentDepthValues >= closestValue) {

  currentDepthValues = PixelsInFrame;

  print(PixelsInFrame);



    /*loadPixels();
     for (int k = 0; k < depthValues[i].length; k++){
     pixels[k] = pink; 
     }

     updatePixels();*/


    //depthValues[i] = color(0, 255, 0);
  }
}

}

image(kinect.depthImage(), 0, 0);

}

``

Answers

Sign In or Register to comment.