Skip to content

Instantly share code, notes, and snippets.

@llamapope
Last active February 2, 2023 18:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save llamapope/890f15d0c81a1ce6075b016cd938ca4b to your computer and use it in GitHub Desktop.
Save llamapope/890f15d0c81a1ce6075b016cd938ca4b to your computer and use it in GitHub Desktop.
Setup XBox 360 Kinect with Processing 3 Ubuntu 16.04

Install Kinect Drivers (tested with Stable-1.5.7.10)
https://github.com/OpenNI/OpenNI/releases

sudo ./install.sh

Or maybe...

sudo apt-get install libfreenect libfreenect-dev libfreenect-demos
# test with
freenect-glview

If it isn't working, make sure your computer is able to see the Kinect

lsusb | grep Xbox

Should get something like this:

Bus 001 Device 025: ID 045e:02ae Microsoft Corp. Xbox NUI Camera
Bus 001 Device 023: ID 045e:02b0 Microsoft Corp. Xbox NUI Motor
Bus 001 Device 024: ID 045e:02ad Microsoft Corp. Xbox NUI Audio

If you don't, you may be able to get things working with some extra udev rules (not sure if these were needed or not... was trying to get this to work for a while)
https://raw.github.com/OpenKinect/libfreenect/master/platform/linux/udev/51-kinect.rules to /etc/udev/rules.d/51-kinect.rules

Once that is working, we just need to get processing talking to the Kinect.

Install Processing 3 - 64bit
https://processing.org/download/

Install SimpleOpenNi libraries into processing sketchbook libraries

git clone https://github.com/wexstorm/simple-openni
cp -R simple-openni/SimpleOpenNi ~/sketchbook/libraries

Running this sample script:

import SimpleOpenNI.*;
SimpleOpenNI kinect; 

# NOTE: must use settings (not setup) for size() to use variables in P3
void settings() {
 kinect = new SimpleOpenNI(this);
 // enable depthMap and RGB image
 kinect.enableDepth();
 kinect.enableRGB();
 // enable mirror
 kinect.setMirror(true);
 size(kinect.depthWidth()+kinect.rgbWidth(), kinect.depthHeight());
}

void draw() {
 kinect.update();
 // draw depthImageMap and RGB images
 image(kinect.depthImage(), 0, 0);
 image(kinect.rgbImage(),kinect.depthWidth(),0);
}

Code from Arduino and Kinect Projects, ©2012 by Enrique Ramos Melgar and Ciriaco Castro Díez
Chapter 3: Accessing the Depth Map and RGB Image

It is missing libboost_system.so.1.54.0 An error something like this is in the Processing output window:

Can't load SimpleOpenNI library (libSimpleOpenNI64.so) : java.lang.UnsatisfiedLinkError: /home/ubuntu/sketchbook/libraries/SimpleOpenNI/library/libSimpleOpenNI64.so: libboost_system.so.1.54.0: cannot open shared object file: No such file or directory
Verify if you installed SimpleOpenNI correctly.
http://code.google.com/p/simple-openni/wiki/Installation
UnsatisfiedLinkError: SimpleOpenNI.SimpleOpenNIJNI.swig_module_init()V
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit application.

Google code doesn't exist anymore. Thankfully there was a reported issue:
wexstorm/simple-openni#79 (comment)

Which instructed us to dowload Boost 1.54.0
https://www.boost.org/users/history/version_1_54_0.html

Extract, then install/setup

./bootstrap.sh
./b2

This takes a while to complete, but the file we need is complied near the beginning, so we don't actually have to wait.

cp bin.v2/libs/system/build/gcc-5.4.0/release/threading-multi/libboost_system.so.1.54.0 ~/sketchbook/libraries/SimpleOpenNI/library/linux64

Run the program. Should have window with 2 outputs, RGB and depth camera views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment