Skip to content

Latest commit

 

History

History
87 lines (56 loc) · 3.95 KB

README.md

File metadata and controls

87 lines (56 loc) · 3.95 KB

Skeleton Jelly

"I am a generic wrapper for interaction with OpenNI compliant devices? No! I am Skeleton Jelly"

Skeleton Jelly is a library for Skeleton Tracking with a Microsoft Kinect device for people who have more interesting things to do than diving into the shitpile of abstractions on top of abstractions which is the OpenNI API.

Basically, it does that: Skeleton tracking. You turn it on, and it fully tracks your skeleton. Instead of slowly dying on the inside while trying to configure and work around the OpenNI API, you can focus on doing awesome stuff with the tracked skeleton; the boring part is handled by the library, and by me, because I'm already dead on the inside.

I feel great, though.

  • Plug & Play: SkeletonJelly automatically configures your Kinect for skeleton tracking without the need to tinker around with XML files.
  • Works everywhere: SkeletonJelly is written in portable C++, the kind of C++ that wouldn't disappoint your grandmother (e.g. the API returns error codes, instead of throwing exceptions).
  • Works with everything: SkeletonJelly can be built together with your program (it's just a CPP file and a header), linked dynamically (it exports all its classes through the DLL interface) or used with any scripting language (the library is prepared to be wrapped with SWIG).
  • Fast As Fuck (TM): SkeletonJelly is fast and minimalistic, and adds almost no overhead on top of the OpenNI API. This is specially noticeable when using SKJ to dump depth or image data from the Kinect

Building

SkeletonJelly has the following dependencies to build:

Note that OpenNI is just a generic API

Throw it into your project

SkeletonJelly is composed of two files (cpp + header), so you can just throw those into your project and make sure to link it versus openni.lib. BANG. Ready to roll.

Build a library

You can also use the included Visual Studio 2010 solution to build a static or dynamic library. It will automatically link it with OpenNI, so you can just link your project with SkeletonJelly and rock on.

Build the bindings for a dynamic language

If you have SWIG installed in your system, you can build a SkeletonJelly wrapper for your favourite language of choice.

Currently, only Python is fully supported, including a build script setup.py and pretty wrapping for all the methods in the API (e.g. return tuples and so on). You can install the python bindings like this:

python setup.py build
python setup.py install

If you are feeling risky, try to build a wrapper for any other language. It'll probably work, but the interface won't be pretty.

Usage

SkeletonJelly is so easy to use that I haven't even written documentation for it.

No, wait, that's just because I'm lazy. Here's a little sample of the API, though:

Kinect k;

if (k.init() != XN_STATUS_OK)
	return -1;

k.setTicksPerSecond(25);
k.runThreaded();

/*
	SkeletonJelly is now running on its own thread
	and crunching data from the sensor.

	Jump in front of the Kinect and do the calibration
	pose. SkeletonJelly will track you automatically.
*/

while (k.getUserStatus() != Kinect::USER_TRACKING)
	Sleep(500);

/* Once you are tracked, you can do awesome stuff */
const XnPoint3D *hand = k.getJoint(SK_JOINT_LEFT_HAND, true);

k.stopThread();

The Python bindings

...are awesome. Really, they are very good for being autogenerated. Here are some of the supported features:

  • Pass a Python method as an event callback
  • Pass a CTypes array as a drawing buffer to get the Image and Depth data.
  • Run SkeletonJelly on its own internal thread, without conflicting with the GIL.
  • Get pretty tuples for all return parameters
  • Get descriptive Python Exceptions instead of error codes.
  • Get awesome because you are using Python

Check the example in examples/example.py (requires a recent version of Pyglet for OpenGL drawing).