Crash on Nite initialisation in python program written using primesense2.2.0.30-5

827 views Asked by At

I am using Ubunut 14.04 and have installed OpenNI 2.2, NITE 2.2 and primesense2.2.0.30-5 (https://pypi.python.org/pypi/primesense/2.2.0.30-5)

The sample program mentioned at the above site works quite well however when I am trying to use initialize nite2 the program crashes.

Here is the code:

from primesense import openni2, nite2

openni2.initialize()     # can also accept the path of the OpenNI redistribution
nite2.initialize()

if (nite2.is_initialized()):
    print "nite2 initialized"
else:
    print "nite2 not initialized"

dev = openni2.Device.open_any()
print dev.get_sensor_info(openni2.SENSOR_DEPTH)

depth_stream = dev.create_depth_stream()
depth_stream.start()
frame = depth_stream.read_frame()
frame_data = frame.get_buffer_as_uint16()
depth_stream.stop()

openni2.unload()

Error Report :

Traceback (most recent call last):
File "test.py", line 4, in <module>
nite2.initialize()
File "/usr/local/lib/python2.7/dist-packages/primesense/nite2.py", line 81, in initialize
("\n    ".join("%s: %s" % (dir, ex) for dir, ex in exceptions)),)
primesense.utils.InitializationError: NiTE2 could not be loaded:
/home/user/project/kinect/NiTE-Linux-x64-2.2/Samples/Bin/libNiTE2.so: /home/user/project/kinect/NiTE-Linux-x64-2.2/Samples/Bin/libNiTE2.so: undefined symbol:  niteDumpUserTrackerCalibrationDataToFile
OpenNI2-FreenectDriver: Closing device freenect://0

I want nite python bindings for user tracking and hand tracking . Did anyone done it before successfully

1

There are 1 answers

0
max On

A workaround is to comment the following lines in file _openni2.py from the primesense python bindings:

global _niteDumpUserTrackerCalibrationDataToFile
_niteDumpUserTrackerCalibrationDataToFile = dll.niteDumpUserTrackerCalibrationDataToFile
_niteDumpUserTrackerCalibrationDataToFile.restype  = NiteStatus
_niteDumpUserTrackerCalibrationDataToFile.argtypes = [NiteUserTrackerHandle, NiteUserId, ctypes.c_char_p]

Also, make sure you have a copy/symlink of both the NiTE2 library and folder (Redist/NiTE2 in the archive) in the same directory as your python script.