Metaduck

Kinect in the Browser using Node.js

I was recently at a Nodecopter session and had this idea of controlling one of those drones using a Kinect. So I ordered one.

Kinect

First I tried getting access to the depth and camera feeds, creating a Node.js binding for that — which uses libfreenect.

Then I looked into how I could extract skeleton information and heard about OpenNI.

Node-Land

I then created node-openni, a Node binding for OpenNI skeleton feed. Using this module you can track the skeleton joints using an event-emitter like this:

var OpenNI = require('openni');
var context = OpenNI();
[
  "head", "left_hand", "right_hand"
].forEach(function(joint) {
  context.on(joint, function(userId, x, y, z) {
    console.log('joint %s of user %d moved to (%d, %d, %d).',
                joint, userId, x, y, z);
  });
});

Browser-land

To pipe this skeleton data into the browser I used the combination of these Node modules:

And with these modules and a few lines of code I created node-openni-browser.

Demos

The module comes with 2 basic demos:

Here is a video of these demos:

Have fun!

(All demos were created using the fantastic three.js).