Multi user detection and visualisation

edited July 2016 in Kinect

I am looking to create a visualisation which represents the presence of users and the length of time that they stand in front of the camera for. Firstly, I wrote a code which writes 'Hello' when a user is present. This text grows over time. When the user vacates the room, the text decreases in size until it is no longer visible. The code for this is below.

import SimpleOpenNI.*;
SimpleOpenNI kinect;

int s = 0;

void setup(){
  size(1000,700);

  kinect = new SimpleOpenNI(this);
  kinect.enableDepth();
  //turn on user tracking 
  kinect.enableUser();

}

void draw(){

  background(255);

  kinect.update();
  PImage depth = kinect.depthImage();
  //image(depth, 0, 0);

  IntVector userList = new IntVector();

  kinect.getUsers(userList);

  if(userList.size()>0){
   println("There is somebody here"); 
   s = s + 1;
   textSize(s);
   fill(0);
   textAlign(CENTER);
   text("hello", 500, 350);
  }

if(userList.size()<1){
  println("There is nobody here");
  //s = 0;
  if (s >= 1){
    s = s - 1;
      textSize(s);
   fill(0);
   textAlign(CENTER);
   text("hello", 500, 350);
  }

}
}

It's relatively simple in that it basically asks if there is anybody in the room and returns a yes/no answer. What I want to do now is make it so that when there are several people in the room, they all get their own 'Hello' which grows and shrinks depending on the length of time they stay in the space individually. I know that I need to identify each user separately in order to do this but I am unsure how, and there is little information on the SimpleOpenNI library to reference. I'm wondering whether I could alter/add to the above code, or whether I would need to completely rethink the draw section in order to do what I want to do?

Any help would be appreciated.

Sign In or Register to comment.