OpenNI2 + NiTE2 + freenect + Ubuntu 13.04 + Kinect 1473 + OpenCV



Step 0: Dependencies

Install the following packages:

sudo apt-get install cmake git libusb-dev freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev libgtk2.0-dev python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev 

Step 1: libFreeNect, the device driver for Kinect

Get libfreenect https://github.com/OpenKinect/libfreenect

Clone it. Then follow instructions on their wiki page to install: http://openkinect.org/wiki/Getting_Started#Ubuntu_Manual_Install

Be sure to set libfreenect into the LD_LIBRARY_PATH. What I did was adding the line below into my ~/.bashrc
export LD_LIBRARY_PATH=/home/forrest/libfreenect/build/lib/


Step 2: OpenNI2, the software foundation

Get OpenNI2 at http://www.openni.org/openni-sdk/ and install by executing the script install.sh. You have to be root/sudo to do that.

Copy OpenNI2-FreenectDriver/build/libFreenectDriver.so to OpenNI-Linux-x64-2.2/Samples/Bin/OpenNI2/Drivers/ and OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/ .

Step 3: NiTE2, the PrimeSense middleware that calculates the skeleton

Download it from http://www.openni.org/files/nite/ You will be asked to register or log in before you can download. After downloading, extract the files and run the install.sh as root/sudo.

Copy OpenNI2-FreenectDriver/build/libFreenectDriver.so to NiTE-Linux-x64-2.2/Samples/Bin/OpenNI2/Drivers/ .

Now, run the test app UserViewer under NiTE-Linux-x64-2.2/Samples/Bin/ to see whether you can get your skeleton extracted.

Step 5: OpenCV


Option 1: Using apt-get


sudo apt-get install libopencv-dev

It will install all needed packages for you.

Option 2: Compiling from source

Download OpenCV from http://opencv.org/downloads.html and follow instructions at http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation

You do not have to set CMAKE_INSTALL_PREFIX as /usr/local. It can be any where other than the directory where you will run make.

Also, do not forget to append LD_LIBRARY_PATH with installed OpenCV's lib.

This link might help: https://help.ubuntu.com/community/OpenCV


Troubleshooting

If you get OpenNI initialization failure error like this: http://stackoverflow.com/questions/14383759, make sure that you have libfreenectDriver.so (the bridge between OpenNI2 and libfreenect, NOT libfreenect itself) in place and libfreenect.so is pointed by LD_LIBRARY_PATH

4 comments:

Matthieu FRAISSINET-TACHET said...

"LD_LIBRARY_PATH" and you just saved me. Thank you !

Matthieu FRAISSINET-TACHET said...

"LD_LIBRARY_PATH" and you just saved me. Thank you ! :)

V. Margot said...

Any idea on where to get NiTE2 now that openni.org is dead (thanks Apple)?

(for others...you can get OpenNI2 from github, just search google)

Anonymous said...

I found it here: https://bitbucket.org/kaorun55/openni-2.2/src/2f54272802bf?at=master