The objective of this tutorial is -
1) To install OpenNI, Nite (drivers that help getting data from the kinect) in Ubuntu 12.04.
2) To set up Processing and SimpleOpenNI ( OpenNI and Nite wrapper for Processing ) using which you can get started with Kinect coding.
What you need?
Kinect with usb cable and a computer with Ubuntu installed. It is not recommended to run Ubuntu as a wubi installer from Windows when working with Kinect. Better install Ubuntu in a new partition and run it.
1) Installing OpenNI and NITE
1) I highly recommend installing 32 bit versions of all even if yours is a 64 bit system. Download OpenNI_Nite installer package from here. eg: I downloaded OpenNI_NITE_Installer-Linux32-0.27.zip . Now extract the zip file to a folder.
Instead of navigating to different folders using cd command you can enable Open in terminal option when you right click in any folder. To get that open terminal and type:
sudo apt-get install nautilus-open-terminal
After installing type : killall nautilus && nautilus in terminal to activate the change immediately.
2) Navigate to OpenNI-Bin-Dev-Linux-x86-v18.104.22.168 folder ( version could have changed if you are seeing at a later point in time) in the unzipped folder using terminal and type the following command to install -sudo ./install.sh
3) Navigate to NITE-Bin-Dev-Linux-x86-v22.214.171.124 folder ( version could have changed if you are seeing at a later point in time) in the unzipped folder and type the following command to install -sudo ./install.sh
4) Navigate to Kinect folder and then to Sensor-Bin-Linux-x86-v126.96.36.199 folder ( version could have changed if you are seeing at a later point in time) in the unzipped folder and type the following command to install -sudo ./install.sh
Testing the installation:
Connect the kinect and ensure that the green Led on it is blinking. Now, navigate to the unzipped folder OpenNI_NITE_Installer-Linux32-0.27. Then to OpenNI-Bin-Dev-Linux-x86-v188.8.131.52 -> Samples -> Bin -> x86-Release and try out the following sample in the the terminal.
The output with my Kinect:
2) Setting up Processing and SimpleOpenNI for Kinect coding
1)Download processing for Linux from here.
2) Install OpenJDK Java7 Runtime by searching it from Ubuntu Software center.
3) Download simpleOpenNI from here and extract it. I downloaded SimpleOpenNI-0.27.zip which works for all platforms.
4) Unzip the downloaded processing folder, navigate to it and run ./processing in terminal.
When started for the first time Processing asks where to place the sketchbook folder. I let it place in the default folder. It’s path in my computer is /home/sanmarino/sketchbook
Create a folder named libraries inside Sketchbook folder and place the unzipped folder SimpleOpenNI from step3 inside it.
5) Restart processing again . Now you should be able to see SimpleOpenNI as shown under.
Now we are done with installation.
Running processing Demo
In the processing menu under File ->Examples-> SimpleOpenNI(scroll down to see) ->OpenNI you will find DepthImage. Double click on it to bring up the code. Make sure that the kinect is properly connected. Now run the code by pressing the run button (that is right below the File menu). You should be able to see the output.
Now if you want to systematically learn kinect coding using processing and SimpleOpenNI you can follow this book called Making things See. If you just want to try out few other examples , the codes from the book are available here.
Feel free to comment if any of the steps are unclear and if you face any problem. I shall be glad to offer the help I can.
Errors in my case:
error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory
Installing freeglut3 from Ubuntu software center fixed it.