使用primesense2.2.0.30-5编写的python程序中的Nite初始化崩溃

时间:2014-06-18 13:34:34

标签: openni primesense nite

我正在使用Ubunut 14.04并安装了OpenNI 2.2,NITE 2.2和primesense2.2.0.30-5(https://pypi.python.org/pypi/primesense/2.2.0.30-5

上面提到的示例程序工作得很好但是当我尝试使用initialize nite2时程序崩溃。

以下是代码:

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()

错误报告:

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

我希望nite python绑定用于用户跟踪和手部跟踪。有人在成功之前完成了吗

1 个答案:

答案 0 :(得分:0)

解决方法是在primesense python绑定中注释文件_openni2.py中的以下行:

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

此外,请确保您在与python脚本相同的目录中具有NiTE2库和文件夹(存档中的Redist / NiTE2)的副本/符号链接。