Ubuntu + Kinect + OpenNI + PrimeSense
Getting the OpenNI and PrimeSense drivers working on Ubuntu
Here’s an overview of the process to get the OpenNI and PrimeSense drivers working with the Kinect and Ubuntu. Begin by installing some dependencies:
sudo apt-get install git-core cmake freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev doxygen graphviz mono-complete
Make a directory to store the build, then clone the OpenNI source from Github.
mkdir ~/kinect
cd ~/kinect
git clone https://github.com/OpenNI/OpenNI.git
Run the RedistMaker script in the Platform/Linux folder and install the output binaries
cd OpenNI/Platform/Linux/CreateRedist/
chmod +x RedistMaker
./RedistMaker
cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.2.23/
sudo ./install.sh
Next, clone the Avin2 SensorKinect source from Github.
cd ~/kinect/
git clone git://github.com/avin2/SensorKinect.git
Run the RedistMaker script in the Platform/Linux folder and install the output binaries.
cd SensorKinect/Platform/Linux/CreateRedist/
chmod +x RedistMaker
./RedistMaker
cd ../Redist/Sensor-Bin-Linux-x64-v5.1.0.25/
chmod +x install.sh
sudo ./install.sh
Then download the OpenNI Compliant Middleware Binaries to ~/kinect
Select these options from the dropdown menus:
Unstable
PrimeSense NITE Unstable Build for Ubuntu 10.10 x64 v 1.5.2.21
Extract the contents of the archive and switch to the Data directory contained within.
cd ~/kinect
tar -xvjpf nite-bin-linux-x64-v1.5.2.21.tar.bz2
cd NITE-Bin-Dev-Linux-x64-v1.5.2.21/Data
Now modify the license in the files: Sample-Scene.xml, Sample-Tracking.xml, and Sample-User.xml. Change
<License vendor=”PrimeSense” key=”"/>
to:
<License vendor=”PrimeSense” key=”0KOIk2JeIBYClPWVnMoRKn5cdY4=”/>
Change back to the NITE directory and run the install script.
cd ..
sudo ./install.sh
That’s it! If you followed steps through to here you should be able to run the sample applications. The OpenNI samples are here:
~/kinect/OpenNI/Platform/Linux/Bin/x64-Release
and the PrimeSense samples are here:
~/kinect/NITE-Bin-Dev-Linux-x64-v1.5.2.21/Samples/Bin/x64-Release
Note: if you get the error:
InitFromXml failed: Failed to set USB interface!
the solution is to remove the gspca_linect kernel module:
sudo rmmod gspca_kinect








Hi Micheal , when I run this on ubuntu 12.04 I get the following errors. Any help is greatly appreciated.
Thanks,
Ramsri
errors::
../../../../../Source/Utils/niLicense/niLicense.cpp:129:96: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
/bin/sh: 1: javac: not found
make[1]: *** [../../../Bin/x64-Release/org.OpenNI.jar] Error 127
make: *** [Wrappers/OpenNI.java] Error 2
make: *** Waiting for unfinished jobs….
../../../../../Wrappers/OpenNI.net/NodeInfo.cs(51,43): warning CS0219: The variable `description’ is assigned but its value is never used
failed to execute: make -j8 -C /home/sanmarino/kinect/OpenNI/Platform/Linux/CreateRedist/../Build > /home/sanmarino/kinect/OpenNI/Platform/Linux/CreateRedist/Output/BuildOpenNI.txt
Building Failed!
Hi Ramsri Goutham, do you have openjdk installed? I had a similar error and I fix it installing openjdk 7.
Sorry for the late reply. No, I don’t have the openjdk installed. I shall give an update after installing it and recompiling.
I could procced after installing openjdk-7-jdk and openjdk-7-jre. Thanks for the help
Thanks for the guide, I’ve compiled and installed latest OpenNI and SensoKinect from git under Ubuntu 12.04 64bit, all seemed fine but can’t run any sample and can’t install NITE.
niReg -l
58 INFO OpenNI version is 1.3.2 (Build 1)-Linux-x86 (May 6 2012 20:40:18)
158 INFO Filter Info - minimum severity: ERROR, masks: NONE
niReg: symbol lookup error: niReg: undefined symbol: xnLogSetMaskMinSeverity
./Sample-NiSimpleViewer
Module filename: ../../../../Data/SamplesConfig.xml
Module filename: ../../../../Data/SamplesConfig.xml
One or more of the following nodes could not be enumerated:
^^^^^^^^ there are 2 blank lines in the command output ^^^^^^^
anyone has any hint? I’ve spent half a day on it, blacklisted gspca_kinect and added this patch SensorKinect https://github.com/avin2/SensorKinect/pull/1 cause it refines udev rules but nothing to do, I’m stuck with these errors, please help.
Hi brother..
Its simple. The mistake u did was downlloading all the stable releases of OpenNI and Sensor Kinect.. I also did the same misatke .. just download the stable releases abd everything will be fine..
And many hanks to author of this web site for this tutorial
I think he means unstable just fyi. you need the unstable releases
hi michael, thankyou very much for your guide but im having some difficulty in installing OpenNi.
when i do this step:
./RedistMaker
i get these errors:
./RedistMaker
Creating redist for Sensor v5.1.2.1
Cleaning previous outputs…
Building…
make: Entering directory `/home/mypc/kinect/SensorKinect/Platform/Linux/Build’
make -C XnCore CFG=Release
make -C XnDeviceSensorV2 CFG=Release
make[1]: Entering directory `/home/mypc/kinect/SensorKinect/Platform/Linux/Build/XnCore’
make[1]: warning: jobserver unavailable: using -j1. Add `+’ to parent make rule.
g++ -MD -MP -MT “./x86-Release/XnBuffer.d x86-Release/XnBuffer.o” -c -msse3 -O2 -DNDEBUG -I/usr/include/ni -I../../../../Include -I../../../../Source -I../../../../Source/XnCommon -DXN_CORE_EXPORTS -fPIC -fvisibility=hidden -o x86-Release/XnBuffer.o ../../../../Source/XnCore/XnBuffer.cpp
make[1]: Entering directory `/home/mypc/kinect/SensorKinect/Platform/Linux/Build/XnDeviceSensorV2′
make[1]: warning: jobserver unavailable: using -j1. Add `+’ to parent make rule.
In file included from ../../../../Source/XnCore/XnBuffer.cpp:25:0:
../../../../Source/XnCore/XnBuffer.h:28:18: fatal error: XnOS.h: No such file or directory
compilation terminated.
g++ -MD -MP -MT “./x86-Release/Bayer.d x86-Release/Bayer.o” -c -msse3 -O2 -DNDEBUG -I/usr/include/ni -I../../../../Include -I../../../../Source -I../../../../Source/XnCommon -DXN_DEVICE_EXPORTS -fPIC -fvisibility=hidden -o x86-Release/Bayer.o ../../../../Source/XnDeviceSensorV2/Bayer.cpp
In file included from ../../../../Source/XnDeviceSensorV2/Bayer.h:28:0,
from ../../../../Source/XnDeviceSensorV2/Bayer.cpp:72:
../../../../Source/XnDeviceSensorV2/XnDeviceSensor.h:28:24: fatal error: XnPlatform.h: No such file or directory
make[1]: *** [x86-Release/XnBuffer.o] Error 1
compilation terminated.
make[1]: Leaving directory `/home/mypc/kinect/SensorKinect/Platform/Linux/Build/XnCore’
make: *** [XnCore] Error 2
make: *** Waiting for unfinished jobs….
make[1]: *** [x86-Release/Bayer.o] Error 1
make[1]: Leaving directory `/home/mypc/kinect/SensorKinect/Platform/Linux/Build/XnDeviceSensorV2′
make: *** [XnDeviceSensorV2] Error 2
make: Leaving directory `/home/mypc/kinect/SensorKinect/Platform/Linux/Build’
After “git clone https://github.com/OpenNI/OpenNI.git” go into the OpenNI Folder and do a “git checkout unstable”. After that everything should work.
I have the same problem.So I did “git checkout unstable” but the the appear again
start all over again, after downloading OpenNI do “git checkout unstable” and then proceed with the instalation. That worked for me.
Right now I have another problem, I’m working with an x86 machine and I don’t have the Sample-Scene.xml, Sample-Tracking.xml, and Sample-User.xml files as in the tutorial. when trying to run the NiSkeletonBenchmark I get the error:
Reading config from: ‘../../Config/SamplesConfig.xml’
Find user generator failed: Can’t create any node of the requested type!
any idea about what’s wrong?
I have this same problem. anyone know the solution?
Hi Michael!
Thank you for the guide. I’m though having the same issue Mauricio has described above and I’m unable to install the SensorKinect properly. Is there a solution for this?
Hi i am not able to buld anything, i sucessfully did following:
cd OpenNI/Platform/Linux/CreateRedist/
chmod +x RedistMaker
./RedistMaker
however it prompts me that Building failed ! any idead folks , this is gonna be my project and so far i cant even compile sample examples.
Hi Michael
Thank you for your guide it is very detailed.
But, In my PC the windows of all samples show something for a short time in some samples without errors (for example Sample-Players) close almost immediately after a calling. And the sensor remain with the red light. I am using Openni verion 1.5.2
Somebody know what could be the problem? and how to fix it? please
Thanks!
Alexander
Hey, at execute on install NITE
$> sudo ./install.sh
y got this error
Copying shared libraries… OK
Copying includes… OK
Installing java bindings… OK
Installing module ‘Features_1_3_0′…
Registering module ‘libXnVFeatures_1_3_0.so’… niReg: error while loading shared libraries: libOpenNI.so: cannot open shared object file: No such file or directory
Any idea to solve this?
Thanks
I get the same error, did you solve it? Thanks
Hello
It’s me again. I try to be more clear with my problem.
I was installing again Openni in a laptop with a Nvidia GeForce 7150M / nForce 630M and Ubuntu 12.04 64.
The installation is ok. but..
As I see exist a problem of core dump when I try to execute wherever example of Nite. Because the program always crashes .
alexander@alexander-HP-Pavilion-dv2700-Notebook-PC:~/kinect/NITE-Bin-Dev-Linux-x64-v1.5.2.21/Samples/Bin/x64-Release$ ./Sample-Players
645 INFO New log started on 2012-09-04 19:13:39
785 INFO OpenNI version is 1.5.2 (Build 23)-Linux-x86 (Sep 4 2012 16:07:52)
836 INFO — Filter Info — Minimum Severity: UNKNOWN
Instrucción ilegal (`core’ generado)
alexander@alexander-HP-Pavilion-dv2700-Notebook-PC:~/kinect/NITE-Bin-Dev-Linux-x64-v1.5.2.21/Samples/Bin/x64-Release$
By using the gdb aplication (and writing run) in this way:
gdb ./Sample-Players
(gdb) run
I obtain this result:
Starting program: /home/alexander/kinect/NITE-Bin-Dev-Linux-x64-v1.5.2.21/Samples/Bin/x64-Release/Sample-Players
Traceback (most recent call last):
File “/usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16-gdb.py”, line 62, in
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers
[Depuración de hilo usando libthread_db enabled]
Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1″.
239 INFO New log started on 2012-09-04 19:03:34
303 INFO OpenNI version is 1.5.2 (Build 23)-Linux-x86 (Sep 4 2012 16:07:52)
324 INFO — Filter Info — Minimum Severity: UNKNOWN
[Nuevo Thread 0x7ffff0bb7700 (LWP 3109)]
Program received signal SIGILL, Illegal instruction.
0x00007ffff205beee in NAFarfield::RunFarfield(Array2D&, Array2D&, Array2D&) ()
from /usr/lib/libXnVFeatures_1_5_2.so
I guess that is a driver problem.
Anybody knows how to fix this problem, please?
Thanks
Alexander
Are there drivers for Asus Xtion that would work with this?
Hi,
I get an error while executing ./RedistMaker as shown below… Any help ? I already performed “git checkout unstable” and it says its already on unstable.
../../../../Source/XnDDK/XnFrameBufferManager.h:30:22: fatal error: XnEventT.h: No such file or directory
compilation terminated.
I also had the same problem with the sensor module it was giving compilation error.
So i checked out the master branch from git.Ran the compilation again and it ran.
git checkout master
./RedistMaker
aditya, ty, and good tutorial, I wish there was more fedora support on this too!
MIchael, thank you, it was very usefull
cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.2.23/
I had 1.5.4.0. it is located in CreateRedist/Final. it is in a .bz2 as well.
Thanks a lot
hello. thanks for the guide. When you say:
cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.2.23/
what folder is that? I can’t find it anywhere…
I’ve having the same problem. I hope you find an answer soon.
That likely means there was an error when you ran sudo ./RedistMaker in the previous step. Try running the command again and this time take note of the error and if you still need help, post the error.
“”"Run the RedistMaker script in the Platform/Linux folder and install the output binaries
cd OpenNI/Platform/Linux/CreateRedist/
chmod +x RedistMaker
./RedistMaker
cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.2.23/ “”
<<——- When I got to this point, the cli argued there was no such directory. I can't find it now. It was in an OpenNI/Platform/Linux folder. It's named "create' or something. It's in that OpenNI/ folder somewhere in a .gz zip file. Extract that and continue with instructions.
I have it working, I just don't know how to get tracking to work, or anything else except the cameras.
I like Kinect. It makes me feel stupid.
Could you be a bit more clear on where you found the file? I can help you with getting tracking working if you can help me get the Sensor set up correctly!
Do you remember which folder was after OpenNI where you found the gz zip file?
I know that it was after I did this:
“cd OpenNI/Platform/Linux/CreateRedist/
chmod +x RedistMaker
./RedistMaker”
I then tried the command “cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.2.23/”
The file was not there. Actually I used a different version of OpenNI. OpenNI-Bin-Dev-Linux-x86-v1.5.4.0..
You can’t sudo ./install.sh because it’s in a .gz file in another folder. Enter command “./RedistMaker”.You will either search for .gz files or manually look in all folders for “OpenNI-Bin-Dev-Linux-x86-v1.5.4.0.gz”. Unzip, enter command “sudo install.sh”. continue instructions.
I don’t know why I can’t find the folder. After I did ./RedistMaker, it was in something like “build”, then a subfolder.
Sorry I can’t be of more help. This stuff is hard for me to get my head around.
I was able to get silhouettes and regular camera working. I had head tracking going in a terminal, but had no idea what to do with it at that point. Still figuring things out. Problem is with this stuff is nothing is standard as there really aren’t any yet. Most of the instructions are outdated. You have use the exact builds of the programs and libraries they use, or it won’t work in a lot of cases. GNU/Linux is in flux as well, so instructions for Ubuntu 10.10 won’t work for 12.04.
CreateRedist/Final. That was the folder the .gz is in. In the OpenNi folder somewhere after you run ./RedistMaker.
It seems like copy-pasting the string
from this webpage into SampleConfig.xml results in a very subtle XML parsing error, because of quotation marks ”…” being used instead of the “…”.
Seems like my comment is not correctly displayed on this webpage. What I want to say is that the XML-code on this page uses right double quotation marks:
http://www.fileformat.info/info/unicode/char/201d/index.htm
instead of quotation marks
http://www.fileformat.info/info/unicode/char/0022/index.htm
causing an error when copy-pasting the code.
Thanks for the post. I got till the last step, and get this error installing NITE unstable. Any idea? Thanks a lot
Installing NITE
***************
Copying shared libraries… OK
Copying includes… OK
Installing java bindings… OK
Installing module ‘Features_1_3_0′…
Registering module ‘libXnVFeatures_1_3_0.so’… niReg: symbol lookup error: niReg: undefined symbol: xnLogSetMaskMinSeverity
Hi,
A really nice step by step tutorial, but i found some problem when i want to install the OpenNI, i found this error:
/bin/sh: 1: javac: not found
make[1]: *** [../../../Bin/x64-Release/org.OpenNI.jar] Error 127
make: *** [Wrappers/OpenNI.java] Error 2
make: *** Waiting for unfinished jobs….
../../../../../Wrappers/OpenNI.net/NodeInfo.cs(51,43): warning CS0219: The variable `description’ is assigned but its value is never used
failed to execute: make -j8 -C /home/chokhow/kinect/OpenNI/Platform/Linux/CreateRedist/../Build > /home/chokhow/kinect/OpenNI/Platform/Linux/CreateRedist/Output/BuildOpenNI.txt
Building Failed!
Then i go to the https://github.com/OpenNI/OpenNI.git there and check for the openNI. However in the website, they did mention that the source ‘platform’ were lost by mistake.
What i can do now?
Hi thanks for the tutorial, I’m having some problems running openni2 on ubuntu 12.10 using gcc 4.7, if you can help me it would be very much appreciated!
http://stackoverflow.com/q/14383759/1781571
For everybody getting make errors on the SensorKinect run this:
cd SensorKinect
git checkout faf4994fceba82e6fbd3dad16f79e4399be0c184
Thank you for your helpful hint in your website.
So, whenever anyone has problem with one of above installation, try to get the master files of that package. This helped me to install all of the 3 packages on UBUNTU 10.04.
i have a problem in the metasploit console,when i write the next command “load xmlrpc Pass= “abc123″ ServerType =”Web”"and this is error show me part of Failed to load plugin from C:/metasploit/apps/pro/msf3/plugins/xmlrpc: super
class mismatch for class Client ,i tried to update the ruby but ddnt work for me if u can help me to find the way to resolve that problem