Monday, March 25, 2013

Test Kinect in Ubuntu 12.04

In the previous post I tried to make the Kinect (for Windows) work in my Win7 with x86 driver. Actually my first attempt was to try to make the Kinect work in my Ubuntu 12.04 but failed, so I switched back to Win7 to make sure the Kinect is workable.

Several days ago I wanted to test the Kinect in my Ubuntu 12.04, and of course I googled and got OpenKinect. I followed the installation procedure but got no luck and before proceeding on I decided to make sure the Kinect is okay (and therefore `the previous post' about the test in Win7).

This time I followed another tutorial by igorbarbosa and finally got the Kinect working in my Ubuntu 12.04.

My installation steps were slightly different from that described in igorbarbosa's tutorial. I believe it is due to the version changes of avin2's SensorKinect driver.

Now I am sharing my installation and hope it might be useful to you.

Step 1: Downloads

Download the following packages.

Step 2: Extraction and Installation

Extract all the three downloaded packages.

Here I followed igorbarbosa's tutorial to rename the three extracted root directories to openni, nite, and sensorkin, respectively. This should not be necessary but I thought it would make things easier.

Each extracted package contains its own executable in its root directory. Just execute each with sudo permission.

Note in this step, there is no file or directory related to RedistMaker mentioned in igorbarbosa's tutorial.

The installation was so fast that I guessed there must be something wrong. :-p

Step 3: Test

Find pre-compiled examples in openni/Samples/Bin/x86-Release and try them.

At the beginning, I tried ./Sample-NiSimpleSkeleton but it only returned the following message and nothing went on:
Reading config from: '../../Config/SamplesConfig.xml'
Starting to run

Also I tried several tracking samples but they only gave me grayscale depth image streams.

But after several trials, I found that's my fault... Users have to step into the depth capturing region and maybe with certain degree of movement so that the Kinect could detect the motion or skeleton.

The successful samples were shown as follows.


Sample-NiHandTracker: To move your hand to be recognized and tracked. It is capable of tracking more than one hand simultaneously. If you wave your hand then the program will recognize it as ``Wave'' gesture. If you move your hand back and forth, then it will be recognized as ``Click''. The console output was as the following:
Gesture recognized: Wave
New Hand: 1 @ (107.631615,131.571106,619.913025)
Gesture recognized: Wave
Gesture recognized: Click
Gesture recognized: Click
Gesture recognized: Wave
New Hand: 2 @ (-232.994659,59.851322,664.228271)
Lost Hand: 1
Gesture recognized: Click
Gesture recognized: Wave
Gesture recognized: Wave
Lost Hand: 2
Gesture recognized: Wave
New Hand: 3 @ (119.862297,79.807777,659.674133)
Gesture recognized: Wave

Sample-NiUserSelection: The green region was my chair and was not regarded as an user.

Sample-NiUserTracker: The chair was selected as an user (the user 2) and also be tracked.
1364188866 New User 1
1364188866 Calibration started for user 1
1364188867 Calibration complete, start tracking user 1
1364188875 New User 2
1364188875 Calibration started for user 2
1364188876 Calibration complete, start tracking user 2

Sample-NiSimpleSkeleton: I expected this will output some graphical results but instead it printed only the following text information in the terminal.
user 1: head at (-212.40,-422.63,1090.80)
user 1: head at (-211.96,-422.34,1089.08)
user 1: head at (-211.14,-422.16,1088.57)
user 1: head at (-209.97,-421.83,1088.65)
user 1: head at (-209.65,-421.00,1088.30)
user 1: head at (-208.11,-419.34,1087.34)
user 1: head at (-206.33,-417.55,1091.40)
user 1: head at (-203.21,-417.75,1092.75)
user 1: head at (-201.76,-418.11,1091.07)

Sample-NiSimpleViewer: Similar to NiViewer but much simpler.


  1. Great post which summerizes everything in one. By the way, I'd very much appreciate it if you direct me into a perfect 3D reconstruction method for Kinect for Windows (K4W) in Ubuntu 12.04. Thanks!!!

    1. Sorry that I'm not good enough at 3D reconstruction to give you any direction... :-(

  2. Thanks!! Do you know how to get the graphical results from Sample-NiSimpleSkeleton