Recently, I’ve struggled to install the Kinect drivers to my Ubuntu 14.10. There is not too many documentation and existing ones are a bit obsolete. Until 2013, PrimeSense company had developed open source libraries(OpenNI, NITE) for Kinect. In 2013, Apple bought PrimeSense and despite OpenNI is still open source, NITE2 is no more available for developers which is used for applications such as skeleton, hands, object, gesture tracking. Without NITE, just with libraries OpenNI1.5, SensorKinect and libfreenect you can just control utilites like depth view, LED light and camera motor. I will also explain the installation of PyOpenNI library which allows to control Kinect from Python.
This post will help you the installation of libfreenect, OpenNI1.5, SensorKinect, and PyOpenNI. Although these recipe works fine for me I do not guarantee it works in your system. Here you can get NITE1.5.
Create a new directory under ‘home’
mkdir ~/kinect
cd ~/kinect
Get dependencies
sudo apt-get install git-core cmake python-dev python-numpy freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev doxygen mono-complete graphviz
Create a ‘library’ directory
mkdir ~/kinect/lib
cd ~/kinect/lib
Get git repositories
git clone https://github.com/OpenKinect/libfreenect
git clone https://github.com/OpenNI/OpenNI
git clone https://github.com/avin2/SensorKinect
git clone https://github.com/jmendeth/PyOpenNI.git
Update
sudo apt-get update
libfreenect
cd ~/kinect/lib/libfreenect
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib64/
sudo chmod a+rw /dev/bus/usb//
OpenNI-1.5.4.0
cd ~/kinect/lib/OpenNI
git checkout Unstable-1.5.4.0
cd Platform/Linux/CreateRedist/
sudo ./RedistMaker
cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.4.0
sudo ./install.sh
SensorKinect
cd ~/kinect/SensorKinect/Platform/Linux/CreateRedist
./RedistMaker
If ./RedistMaker fails and Redist directory could not be created try to make this change in RedistMaker file in any text editor.
(line 70): make -j$(calc-jobs_number) -C ../Build
–> make -j1 -C ../Build
In line 70, change ‘-j$(calc-jobs_number)’ to ‘1’
Then
cd ../Redist/Sensor-Bin-Linux-x64-v5.1.2.1/
sudo ./install.sh
NITE1.5.2.21
cd ~/kinect/lib/NITE-Bin-Dev-Linux-x64-v1.5.2.21
chmod a+x install.sh
sudo ./install.sh
PyOpenNI
cd ~/kinect/lib/PyOpenNI/
mkdir build
cd build
cmake ..
make
Copy it your python version library.
sudo cp ./lib/openni.so /usr/lib/pymodules/python2.7/
nano ~/kinect/lib/OpenNI_1.5.4.0/Data/SamplesConfig.xml
enter licences: <License vendor=”PrimeSense” key=”0KOIk2JeIBYClPWVnMoRKn5cdY4=”/>
cd /usr/etc/primesense/Features_1_5_2/
Give privilige to Data folder for skeleton tracking. Write your Ubuntu <username> to corresponding part.
sudo chown -R <username>:<username> Data/
At this point rebooting is required.
Testing
cd ~/kinect/lib/OpenNI/Platform/Linux/Bin/x64-Release/
./Sample-NiSimpleViewer
./Sample-NiSimpleSkeleton
Hi !
I have a problem when I build PyOpenNI : when I do
sudo cmake ..
in my build folder everything seems ok :
— OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
— Boost version: 1.54.0
— Found the following Boost libraries:
— python
— Detected CXX compiler flags for Python
— Configuring done
— Generating done
— Build files have been written to: /home/bgely/kinect/lib/PyOpenNI/build
But when I go to my ./lib folder there is no openni.so file.
Do you have any suggestion ?
Thank you for your tutorial.
LikeLike
Sorry for late reply. I am not sure about your problem. Have you solved it since then?
LikeLike
Have you done “make” after “cmake ..” where Makefile is created?
LikeLike
really nice!
Just one small edit: make step is missing from PyOpenni installation instructions
LikeLiked by 1 person
Hi. Do these steps work for Kinect 2?
LikeLike
I did not try that.
LikeLike
I can not get Collar, and ankle joints using PyOpenNI. Can any one help me related to this error?
LikeLike
Pingback: How to use kinect with python on Ubuntu 16.04? - Onooks