Showing posts with label kinect. Show all posts
Showing posts with label kinect. Show all posts

2014-02-15

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

2013-10-15

OpenKinect and Kinect Model 1473

Since I am a computer engineering professor now, I do something other than computational neuroscience (neuroinformatics) or bioinformatics.

Recently, I started working on a project using 4D camera (RGB + depth). I spent $30 on eBay to get a Kinect. Today I just got it. First, I decided to use OpenKinect/freenect to make sure that the depth sensor is working. 

My Kinect is a late version 1473. The freenect package comes with my Ubuntu Linux 13.04 is too old - though this version of Kinect has been around for quite a while.

I struggled a lot and couldn't get it to work, until I saw this in freenect's discussion.

If you have Kinect 1473, go to OpenKinect's Github repository for the latest version. Then follow the instruction on their wiki to compile and install. Then it should work.

Oh, here is my first encounter with Kinect. Pay attention to the wrinkles on my shirt and the depth hole in my mouth - I intentionally did that.


Also I found out that open source drivers do not work for Kinect for Windows. Be sure to get Kinect for XBox.

See also: