Kinect, OpenNI, NiTE and Nuimotion Setup for Ubuntu
This is a follow up to my setup notes for OS X, here are my notes to setup Kinect, OpenNI, NiTE and Nuimotion on Ubuntu Desktop LTS 12.04 Precise.
– Installation notes for Ubuntu Desktop LTS 12.04 Precise.
– NOTE: All code is installed to ~/Developer/Work
Install Updates
– Update system:
1 2 3 4 5 |
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo reboot sudo apt-get autoremove |
Install freenect from github
– Install dependencies:
1 2 3 |
sudo apt-get install cmake libpthread-stubs0-dev libgl1-mesa-dev libx11-dev libxrandr-dev \ libfreetype6-dev libglew1.5-dev libjpeg8-dev libsndfile1-dev libopenal-dev freeglut3-dev \ libxmu-dev libxi-dev build-essential libusb-1.0-0-dev git git-core |
– Clone libfreenect
:
1 2 3 4 5 |
mkdir -p ~/Developer/Work cd ~/Developer/Work git clone https://github.com/OpenKinect/libfreenect cd libfreenect git checkout tags/v0.3.0 |
– NOTE: Tested with libfreenect stable release v0.3.0
– Build and install:
1 2 3 4 5 6 |
cd ~/Developer/Work/libfreenect mkdir build cd build cmake .. -DBUILD_OPENNI2_DRIVER=ON make sudo make install |
– Add to library path:
1 |
sudo vi /etc/ld.so.conf.d/custom.conf |
1 2 |
/usr/local/lib64/ /usr/local/lib64/OpenNI2-FreenectDriver/ |
1 |
sudo ldconfig |
– Test with glview:
1 |
sudo glview |
– Reference:
https://github.com/OpenKinect/libfreenect
http://openkinect.org/wiki/Getting_Started
Install node.js
– Install node.js
from source, this will take 10 min:
1 2 3 4 5 6 7 8 |
sudo apt-get install g++ curl libssl-dev apache2-utils cd ~/Developer/Work wget http://nodejs.org/dist/node-latest.tar.gz tar -xzf node-latest.tar.gz cd node-v* ./configure make sudo make install |
– NOTE: Tested with node.js v0.10.23
Install OpenNI and NiTE
– Download OpenNI from:
http://www.openni.org/openni-sdk/
– Uncompress OpenNI and move:
1 2 3 4 5 |
unzip OpenNI-Linux-x64-2.2.0.33.tar.zip tar xvf OpenNI-Linux-x64-2.2.tar.bz2 mv OpenNI-Linux-x64-2.2 ~/Developer/Work/ cd ~/Developer/Work/OpenNI-Linux-x64-2.2 sudo ./install.sh |
– Download NiTE from:
http://www.openni.org/files/nite/
– Uncompress NiTE and move:
1 2 3 4 5 |
unzip NiTE-Linux-x64-2.2.tar1.zip tar xvf NiTE-Linux-x64-2.2.tar.bz2 mv NiTE-Linux-x64-2.2 ~/Developer/Work/ cd ~/Developer/Work/NiTE-Linux-x64-2.2 sudo ./install.sh |
– Copy libFreenectDriver.so
to OpenNI2 directory:
1 2 |
cp /usr/local/lib64/OpenNI2-FreenectDriver/libFreenectDriver.so \ ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/ |
– Copy all libraries to /usr/local/lib
1 2 |
sudo cp -R ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/* /usr/local/lib sudo cp -R ~/Developer/Work/NiTE-Linux-x64-2.2/Redist/* /usr/local/lib |
– Add to library path:
1 |
sudo vi /etc/ld.so.conf.d/custom.conf |
1 2 3 4 |
/usr/local/lib64/ /usr/local/lib64/OpenNI2-FreenectDriver/ # Added /usr/local/lib |
1 |
sudo ldconfig |
– Add OpenNI and NiTE to .bashrc:
1 2 |
cat ~/Developer/Work/OpenNI-Linux-x64-2.2/OpenNIDevEnvironment >> ~/.bashrc cat ~/Developer/Work/NiTE-Linux-x64-2.2/NiTEDevEnvironment >> ~/.bashrc |
– Logout and log back in to include changes made to .bashrc
.
Install Nuimotion and Websocket
– Make project directory:
1 |
mkdir ~/Developer/Work/prototype-nuimotion/ |
– Copy Redist files to the root of the app:
1 2 |
cp -R ~/Developer/Work/NiTE-Linux-x64-2.2/Redist/* ~/Developer/Work/prototype-nuimotion/ cp -R ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/* ~/Developer/Work/prototype-nuimotion/ |
– Install websocket
:
1 |
npm install websocket |
– Install node-gyp
:
1 |
sudo npm install -g node-gyp |
– Create prototype-nuimotion
and download the nuimotion project to the node_modules
directory:
1 2 3 4 5 6 |
mkdir ~/Developer/Work/prototype-nuimotion/node_modules cd ~/Developer/Work/prototype-nuimotion/node_modules wget https://github.com/bengfarrell/nuimotion/archive/master.zip unzip master.zip mv nuimotion-master nuimotion rm master.zip |
– Rebuild:
1 2 |
cd ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion node-gyp rebuild |
– Edit index.js
to fix require, remove src
prefix in first line:
1 |
vi ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion/index.js |
1 2 |
module.exports = require('./build/Release/nuimotion.node'); ... |
– Copy basicquickstart.js
and run:
1 2 3 |
cp ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion/quickstart/basicquickstart.js ~/Developer/Work/prototype-nuimotion/ cd ~/Developer/Work/prototype-nuimotion/ sudo node basicquickstart.js |
– Reference:
http://www.kdab.com/setting-up-kinect-for-programming-in-linux-part-1/
http://overconsulting.net/blog/installation-d-une-kinect-sous-ubuntu-13-10-openni2-freenect-nite2
Is the hardware being detected?
– Run lsusb
:
1 |
lsusb | grep Xbox |
– Should result in:
1 2 3 |
Bus 002 Device 006: ID 045e:02ad Microsoft Corp. Xbox NUI Audio Bus 002 Device 005: ID 045e:02b0 Microsoft Corp. Xbox NUI Motor Bus 002 Device 007: ID 045e:02ae Microsoft Corp. Xbox NUI Camera |