Building on Linux

jmendeth edited this page Jul 3, 2012 · 5 revisions

Install the dependencies

First, install OpenNI (the unstable branch!) if you haven't do so.
Visit the OpenNI project's page for instructions.

After that, install Git, CMake, Boost and Python. Via APT:

sudo apt-get install cmake build-essential git-core python-dev libboost-python-dev

Build and install PyOpenNI

Clone PyOpenNI:

git clone https://github.com/jmendeth/PyOpenNI.git

Then, create an empty directory somewhere and cd to it. PyOpenNI will be built here.

mkdir PyOpenNI-build
cd PyOpenNI-build

In that folder, configure the project with CMake, passing in the location of PyOpenNI:

cmake ../PyOpenNI

This will check and detect the needed libraries (OpenNI, Boost, Python, ...) required to build PyOpenNI.
Finally, compile the sources:

make

If all gone well, you'll have the finished module in lib/openni.so, so just copy it to your Python modules directory:

sudo cp lib/openni.so /usr/lib/pymodules/python2.7/   # <- Change this if you have a different Python version

Voilà! You can now use OpenNI from Python.
To test, try to import the module:

$ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import openni
>>> 

Now, what?

Head to the README for how to get started.