An example from the NiViewer example

Kinect: How to install and use OpenNI on Windows – Part 2

In the previous section we saw how to install OpenNI, NITE and the SensorKinect drivers on Windows and we tried the given samples like this:

An example from the NiViewer example
(IR and RGB video)

Now we are going to take advantage of information provided by OpenNI and by the Kinect to make skeleton tracking.

Before starting we will need of OSCeleton which is an open-source proxy . It collects the skeleton information returned by the Kinect (via the OpenNI interface) and then format them in a standard format before sending them via OSC (Open Sound Control). This simplifies the use of data to make them available in any programming language/application which supports the OSC protocol:

  • To start download OSCeleton here (if you don’t have a git client click on Downloads > Download.zip).

The expand zip file of OSCeleton

  • Extract the zip file contents, browse into the folder and open OSCeleton.sln with Visual Studio C++ express 2010 (If you didn’t it, download it here).
  • Once the project opened, generate the executable by pressing the F6 key or by clicking on Build Solution from the Build menu.

The debug folder after the generation

  • After close Visual Studio, browse into the Debug folder which has just been created to check out if OSCeleton.exe has been generated.
  • Finally verify that it was properly compiled by running the executable with the -h option to display all the available options: OSCeleton.exe –h.

Now that OSCeleton is installed, we are going to download the examples to make some tests:

OSCeleton Kinect examples folder

  • Once the download is completed, expand the archive.

These examples use two free open source software which are Animata and Processing. Animata is a software for real-time animation designed to create animations and interactive background that are similar to an environment of puppets. Processing is itself a development environment and programming language designed to easily create images, animations or interactions.
Let’s start by testing the example with Animata:

  • If you don’t have it, download Animata here (version 004) and expand the zip file.
  • Then run OSCeleton with these options: OSCeleton.exe -k -mx 640 -my 480 -ox -160. The –k option (« kitchen » mode) allows to format the messages sent by OSC to make them compatible with Animata.

The Animata open sample box

  • Later runs Animata and open the “doll_soft.nmt” example which is located in the animata folder.

The Animata sample display view

(That’s what you should see on your screen)

The OpenNI user calibration scheme

(Calibration position)

  • Take place in front of your Kinect, and put yourself in position calibration as shown above.
  • When calibration is done, the animata should begin to replicate your movements.

In order to have a little more freedom, we are going to test the examples under Processing:

  • If you don’t have Processing, download it here (1.2.1 version). Once downloaded and run it and close it. This will create a lot of configuration files and create a folder named Processing in your Documents.
  • To run the examples you will need 2 libraries:
    • OscP5 is a library which implements the OSC protocol. If you don’t have it, download it using SVN here (If you don’t have a SVN client, download TortoiseSVN).
    • pBox2d is a physics engine for 2-dimensional worlds. You can download it here (currently v0.03).

The processing library directory

  • To use these libraries in Processing copy them into the Processing>libraries folder in your documents.
  • Run OSCeleton without argument.
  • Restart Processing if it was open, otherwise run it.

The Processing open example

  • Select Open in the File menu and select the MotionCapture3D.pde sample in the example folder that we have previously downloaded.

A Processing sample code

  • Run the example by going to the Sketch>Run menu.

The Processing skeleton display

  • Put yourself in front of the Kinect and wait until the calibration is done. Then you must see your skeleton in the Processing window as shown above.

There is also an OpenNIs wrapper for Processing which allows you to access more features such as the depthMap, the handtracking, etc… This library is called Simple-OpenNI-and you can download it here. Install it in the same way as OscP5 and pBox2d by expanding the archive into the Processing>libraries folder in your Documents.

Well, now you have all the basis to start the development of prototypes using Kinect while pending the official SDK from Microsoft release.

External links:
OpenNI Cookbook
http://openkinect.org/wiki/Main_Page
http://www.openni.org/
https://github.com/Sensebloom/OSCeleton
https://github.com/Sensebloom/OSCeleton-examples
http://animata.kibu.hu/
http://www.processing.org/
http://code.google.com/p/simple-openni/

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 5.00 out of 5)
Loading...
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditPin on Pinterest

7 comments

Time limit is exhausted. Please reload CAPTCHA.

  1. Ralina · March 6, 2011

    this blog should anyone print out and installed on every house in the world

  2. Uther · March 6, 2011

    I’m having problems with compiling the OSCeleton, I get two error messages, wondering what they mean, can anybody help:
    1>—— Build started: Project: OSCeleton, Configuration: Debug Win32 ——
    1> The syntax of the command is incorrect.
    1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command “copy C:\Users\Desktop\Sensebloom-OSCeleton-7307683\src\\lib\*.dll C:\Users\Desktop\Sensebloom-OSCeleton-7307683\\Debug\
    1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd” exited with code 1.
    ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

  3. Lesley · March 6, 2011

    I’m now having the same problem as Uther, did you find a way to resolve this?! it’s driving me insane! Thanks for the help

  4. Lesley · March 6, 2011

    It is now saying ‘The application failed to start because glut32.dll was not found. Re-installing the application may fix this problem’

  5. Patricia · March 6, 2011

    This is excellent, just what I have been looking for. Thank you for sharing

  6. Nicolas · March 6, 2011

    Very nice!
    I just bought the Kinect and I’m doing some experiment with iPi, but I would like to expand the tracking capability of the Kinect.
    It is possible to modify the bone position ( of the doll_soft ) in order to shape it like a face, in order to track the face?
    I suppose that thos position are “sensible areas” so I imagine that the tracking of the face could work in the same way…maybe by tracking markers on the face?

  7. eisha · March 6, 2011

    Hi this is a nice blog.. I doing skeletal tracking in WPF C# and i want to do animation like yours. can you tell me how to use animata in this case please ?
    Thanks