pythondynamic-linkingopenniprimesense

Python OpenNI2 libOpenNI2.so problems


I am trying to use the Python primesense module on my kinect under Ubuntu. I appear to have OpenNI2 installed correctly, as I am able to run examples in processing fine using processing's simple-openni library. I installed the primesense module using pip, first in a virtualenv and then on the system, turning out identical results.

From iPython, I do/receive the following:

In [1]: from primesense import openni2

In [2]: openni2.initialize()
---------------------------------------------------------------------------
InitializationError                       Traceback (most recent call last)
<ipython-input-2-4a1f095d5922> in <module>()
----> 1 openni2.initialize()

/usr/local/lib/python2.7/dist-packages/primesense/openni2.pyc in initialize(dll_directories)
     95     if not found:
     96         raise InitializationError("OpenNI2 could not be loaded:\n    %s" %
---> 97             ("\n    ".join("%s: %s" % (dir, ex) for dir, ex in exceptions)),)
     98 
     99     _openni2_initialized = True

InitializationError: OpenNI2 could not be loaded:
    /home/escher/pyenv/libOpenNI2.so: file does not exist

I tried creating a symbolic from /usr/lib/libOpenNI.so to /usr/lib/libOpenNI2.so, and then I changed into the /usr/lib/ directory. This is what I got:

openni2.initialize()
---------------------------------------------------------------------------
InitializationError                       Traceback (most recent call last)
<ipython-input-5-4a1f095d5922> in <module>()
----> 1 openni2.initialize()

/usr/local/lib/python2.7/dist-packages/primesense/openni2.pyc in initialize(dll_directories)
     95     if not found:
     96         raise InitializationError("OpenNI2 could not be loaded:\n    %s" %
---> 97             ("\n    ".join("%s: %s" % (dir, ex) for dir, ex in exceptions)),)
     98 
     99     _openni2_initialized = True

InitializationError: OpenNI2 could not be loaded:
    /usr/lib/libOpenNI2.so: /usr/lib/libOpenNI2.so: undefined symbol: oniInitialize

Am I doing something wrong or is/are the package(s) broken, and in either case, is there anything I can do to just get something working?


Solution

  • The problem was a combination of two things:

    1. On openni2.initialize(), I was supposed to pass in the path to the Redist directory and it defaults to the current directory in the primesense module.

    2. I didn't have the correct implementation downloaded for my distribution (though it seemed to work fine for processing). I had downloaded, built and installed the OpenNI.master.zip, when I should have downloaded OpenNI-Linux-x64-2.2.0.33.tar.zip.