Kinect, OpenNI, NiTE and Nuimotion Setup for Ubuntu

IMG_2025

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:

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:

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`:

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:

cd  ~/Developer/Work/libfreenect
mkdir build
cd build
cmake .. -DBUILD_OPENNI2_DRIVER=ON
make
sudo make install

– Add to library path:

sudo vi /etc/ld.so.conf.d/custom.conf
/usr/local/lib64/ 
/usr/local/lib64/OpenNI2-FreenectDriver/
sudo ldconfig 

– Test with glview:

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:

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:

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:

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:

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`

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:

sudo vi /etc/ld.so.conf.d/custom.conf
/usr/local/lib64/ 
/usr/local/lib64/OpenNI2-FreenectDriver/
# Added
/usr/local/lib
sudo ldconfig 

– Add OpenNI and NiTE to .bashrc:

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:

mkdir ~/Developer/Work/prototype-nuimotion/

– Copy Redist files to the root of the app:

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`:

npm install websocket

– Install `node-gyp`:

sudo npm install -g node-gyp

– Create `prototype-nuimotion` and download the nuimotion project to the `node_modules` directory:

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:

cd ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion
node-gyp rebuild

– Edit `index.js` to fix require, remove `src` prefix in first line:

vi ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion/index.js
module.exports = require('./build/Release/nuimotion.node');
...

– Copy `basicquickstart.js` and run:

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`:

lsusb | grep Xbox

– Should result in:

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

Comments are closed.