我正在尝试运行以下代码,
from pykinect import nui
from pykinect.nui import JointId
from pykinect.nui import SkeletonTrackingState
from pykinect.nui import TransformSmoothParameters
with nui.Runtime() as kinect:
kinect.skeleton_frame_ready+=skeleton_frame_ready
kinect.skeleton_engine.enable=True
while True:
frame= kinect.skeleton_engine.get_next_frame()
for skeleton in frame.SkeletonData:
def skeleton_fram_raedy(skeleton_frame):
for index,data in enumerate(skeleton):
if skeleton.eTrackingState==nui.SkeletonTrackingState.TRACKED:
head=data.SkeletonPositions[JointId.Head]
print head
但 Kinect 关闭并给出以下错误:
Traceback (most recent call last):
File "C:\Users\sayyed javed ahmed\Desktop\Humaira\Practice Codes-Python\skeletonnew.py", line 5, in <module>
with nui.Runtime() as kinect:
File "C:\Python27\lib\site-packages\pykinect\nui\__init__.py", line 126, in __init__
self.camera = Camera(self)
File "C:\Python27\lib\site-packages\pykinect\nui\__init__.py", line 352, in __init__
self.elevation_angle
File "C:\Python27\lib\site-packages\pykinect\nui\__init__.py", line 359, in get_elevation_angle
return self.runtime._nui.NuiCameraElevationGetAngle()
File "C:\Python27\lib\site-packages\pykinect\nui\_interop.py", line 200, in NuiCameraElevationGetAngle
_NuiInstance._NuiCameraElevationGetAngle(self, ctypes.byref(res))
File "_ctypes/callproc.c", line 950, in GetResult
WindowsError: [Error -2147024883] The data is invalid
我是 PyKinect 的新手,因此感谢您的帮助!谢谢!