Monday, December 26, 2011

OpenNI and Kinect

OpenNI is a framework for Natural Interfaces. I started to get my kinect work for OpenNI. I followed the instructions in

and there were issues. Apparently, the stuff in Sensor/Platform/Linux-x86/Build/Common needed to be copied to /usr/include/ni.

Also, I had to grep -R LIB_USED" kinect/Sensor/Platform/Linux-x86/Build and I needed to change LIB_USED to USED_LIBS in those Makefiles (there was only one instance IIRC).

Even after this there were issues. There was an error related to USB (Failed to set USB interface). The solution for it was to sudo rmmod gspca_kinect
(Apparently there is another kernel kinect module that needs to be unloaded).

With both these changes done, I was able to compile and get the sample program running.

I also tried compiling the python bindings for openni (thats called onipy). The guys at onipy already had made Makefile for linux, but it appears that the order of compilation is off in the final .so file.
I had to g++ -fPIC -shared -Wl,--export-dynamic -o ../../OpenNIPythonWrapper/Source/wrapper.o ../../OpenNIPythonWrapper/Source/OpenNIContextWrapper.o ../../OpenNIPythonWrapper/Source/OpenNIDepthGeneratorWrapper.o ../../OpenNIPythonWrapper/Source/OpenNIImageGeneratorWrapper.o ../../OpenNIPythonWrapper/Source/OpenNIImageMetaDataWrapper.o ../../OpenNIPythonWrapper/Source/conversionHelpers.o ../../PythonOutputStream/Source/PythonOutputStream.o -lboost_python -lOpenNI -lpython2.7 instead of the original one (where the -lboost_python.*$ would be at the beginning - as suggested here

Search this site