Giter VIP home page Giter VIP logo

node-openni's Introduction

node-openni

OpenNI bindings in Node.js.

Supports multiple users.


Looking for maintainer(s)!!

Ping the author if you're interested!


Install

Install libusb and OpenNI following the platform-specific instructions at https://github.com/OpenNI/OpenNI.

(If you're having trouble with this installation, some users have reported that the simple-openni package installs these dependencies successfully: https://code.google.com/p/simple-openni/wiki/Installation )

Then you will have to fork this repo:

$ cd node-openni
$ node-gyp configure build

Test

Plug in your kinect.

Run:

$ node test/base

Stay in the surrender position in front of the camera, a couple of meters away. After you're synced you should see

Use

Create Context

var OpenNI = require('openni');

var context = OpenNI();

Register for user events:

[
  'newuser',
  'userexit',
  'lostuser',
  'posedetected',
  'calibrationstart',
  'calibrationsucceed',
  'calibrationfail'
].forEach(function(eventType) {
  context.on(eventType, function(userId) {
    console.log('User %d emitted event: %s', userId, eventType);
  });
});

Register for joint events

[
  "head",
  "neck",
  "torso",
  "waist",
  "left_collar",
  "left_shoulder",
  "left_elbow",
  "left_wrist",
  "left_hand",
  "left_fingertip",
  "right_collar",
  "right_shoulder",
  "right_elbow",
  "right_wrist",
  "right_hand",
  "right_fingertip",
  "left_hip",
  "left_knee",
  "left_ankle",
  "left_foot",
  "right_hip",
  "right_knee",
  "right_ankle",
  "right_foot"
].forEach(function(jointName) {

  context.on(jointName, function(user, x, y, z) {
    console.log(jointName + ' of user %d moved to (%d, %d, %d)', user, x, y, z);
  });

});

Close Context

// Close the context to exit

process.on('SIGINT', function() {
  context.close();
  process.exit();
});

Specify Joints

You can specify exactly which joints you want to be tracked:

context.setJoints(['head', 'left_hand', 'right_hand']);

#Gestures Two gestures added: Wave and Click. ##Gesture Callbacks

context.on('Wave', function(gesture) {
  console.log('wave');
});

context.on('Click', function(gesture) {
  console.log('click');
}

Licence

MIT

node-openni's People

Contributors

pgte avatar eldog avatar kevingrandon avatar max-mapper avatar milafrerichs avatar

Stargazers

Indrajith Bandara avatar

Watchers

Dan Finlay avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.