Skip to main content

In my discovery and experimentation I’ve recently been focusing on kinect hacking. While the kinect is a powerful tool capable of mapping joints on the body a sometimes overlooked capability it something called Center of Mass tracking. Energy Sketch was set up to track users who passed by and draw a random color from an array at their position. Every hour the sketch was saved and reset. Sometimes people just walked by and other times they would stop and play. 105 hours of interaction were recorded and the poster below shows activity throughout that time.

Center of Mass tracking is a great tool because it doesn’t require the user to stop and assume a pose for the kinect to track them. A more passive experience, the kinect would automatically recognize humans and calculate the center most position of their mass, which is usually around your belly button. This makes it easy to create projects that track people in malls, on sidewalks in-front of store windows and wherever else you can imagine to have graphics or animations interact with them.

For this kinect hack I used Processing and the SimpleOpenNI and NITE libraries. If you haven’t downloaded them you can do so here. If this is your first time working with processing and kinect I would also recommend you check the book Making Things See. Installing the NITE files requires using the terminal if your on a mac which can be tricky. The Making Things See book walks you through the process easily.

Download the timer class from Daniel Shiffman. This used used to trigger the save and reset each hour. Have fun.

If you want to try it out here’s the processing code:

import SimpleOpenNI.*;
SimpleOpenNI kinect;

Timer timer;

void setup() {
 size(800, 600);

kinect = new SimpleOpenNI(this);
kinect.enableDepth();
kinect.setMirror(true);

kinect.enableUser(SimpleOpenNI.SKEL_PROFILE_NONE);
   smooth();
   noStroke();
   background(0);  //set background to black
   
   //Timer stuff
 timer = new Timer(3600000);
  timer.start();

}

void draw() {
 kinect.update();
//image(kinect.depthImage(), 0, 0);
//Timer call
 if (timer.isFinished()) {
     saveReset();
    timer.start();
  }

IntVector userList = new IntVector();
kinect.getUsers(userList);


for( int i=0; i<userList.size(); i++) {
  int userID = userList.get(i);
  PVector position = new PVector();
  kinect.getCoM(userID, position);

  kinect.convertRealWorldToProjective(position, position);

  float zDepth = map(position.z, 500, 5000, 10, 30);
  float zScale = map(position.z, 500, 5000, 20, 100);
  //println(position.z);
  
  color[]      userCoMColors = { color(255,100,100,zDepth), color(100,255,100,zDepth), color(100,100,255,zDepth), color(255,255,100,zDepth), color(255,100,255,zDepth), color(100,255,255,zDepth) };
pushStyle();
   fill(userCoMColors[userID % userCoMColors.length]);
   ellipse(position.x, position.y, zScale, zScale);
 popStyle();

  }
}
  
void saveReset() {
   saveFrame("images/sketch-###.jpg");
   background(0);  //set background to black
}
 



Leave a Reply


6 − 4 =