Creating a UserTracker crashes in NITE2 python bindings

China☆狼群 提交于 2019-12-23 19:25:21

问题


I am trying to use OpenNI2 and NITE2 python bindings. I'm under Windows 7 and I have Kinect SDK1.8, OpenNI 2.2 and NITE 2.2 working without problems in Visual C++ with their 32 bits versions. I have python 2.7.5 32 bits.

Now, my intention is to translate some of the examples provided in NITE to python, but I still haven't found how to create a UserTracker without the program crashing (the same goes for HandTracker). I have been able to run the toy example provided (which doesn't make use of NITE). This is what I'm doing and the error I get -which I don't find very informative-:

In [1]: from primesense import openni2, nite2

In [2]: nite2.initialize()

In [3]: dev = openni2.Device.open_any()

In [4]: ut = nite2.UserTracker(dev)
---------------------------------------------------------------------------
NiteError                                 Traceback (most recent call last)
<ipython-input-4-5be0b82b0a2b> in <module>()
----> 1 ut = nite2.UserTracker(dev)

C:\Python27\lib\site-packages\primesense-2.2.0.30_5-py2.7.egg\primesense\nite2.p
yc in __init__(self, device)
    198             self._devstruct = _NiteDevStruct()
    199             self._devstruct.device = device._handle
--> 200             c_api.niteInitializeUserTrackerByDevice(ctypes.byref(self._d
evstruct), ctypes.byref(handle))
    201         HandleObject.__init__(self, handle)
    202         _registered_user_trackers.add(self)

C:\Python27\lib\site-packages\primesense-2.2.0.30_5-py2.7.egg\primesense\_nite2.
pyc in wrapper(*args)
    693         res = func(*args)
    694         if res != NiteStatus.NITE_STATUS_OK:
--> 695             raise NiteError(res)
    696         return res
    697

NiteError: NiteStatus.NITE_STATUS_ERROR

I have already tried initializing the depth stream of the device before passing it to the UserTracker creator, but still doesn't work.

Has anyone been able to make NITE2 python bindings work? If so, is there something I'm missing?


回答1:


I've finally been able to make it work but I trully think there's a mess with versions regarding Nite and primesense python bindings, so I'll share in case someone goes through the same problems.

When I posted the question I was using (as indicated) the python bindings downloaded from openNI website and Nite 2.2.

I tried downloading the latest version from pyPi, which is 2.2.0.30-5 and then I got an error when initializing nite2 (nite2.initialize()) because it wasn't able to find the method niteDumpUserTrackerCalibrationDataToFile in the C API.

The "solution"? I downgraded Nite to version 2.0, where that method is actually present. I think this is not the best solution. The latest versions for Nite and its python bindings should work together without having to hack the code or downgrading.

To summarize: it's working for me with python bindinngs 2.2.0.30-5 from pyPi and Nite 2.0.0, but is should work with Nite 2.2.




回答2:


Yes, niteDumpUserTrackerCalibrationDataToFile is missing from 2.2, but there also another problem in using NiTE 2.2 from Python.

NiTE 2.2 is not playing well with ONI file devices, because it says that it requires a "PrimeSense SOC" device. This can be discovered by enabling logging in NiTE.ini




回答3:


This fork of the openni-python bindings solves the problems mentioned in this post regarding Nite 2.2. I am aware it is in the process of being merged back to the original openni-python github project.



来源:https://stackoverflow.com/questions/19962339/creating-a-usertracker-crashes-in-nite2-python-bindings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!