2

I'm using pykinect to get kinect xbox360 data in python. Also I'm using pykinect for python 3.6 (https://github.com/ShrirangaKadam/pykinect-python3.6).

kinect = nui.Runtime()

kinect.video_stream.open(nui.ImageStreamType.Video,2,nui.ImageResolution.Resolution640x480,nui.ImageType.Color)



kinect.depth_stream.open(nui.ImageStreamType.Depth, 2, nui.ImageResolution.Resolution640x480, nui.ImageType.Depth)


kinect.skeleton_frame_ready += skeleton_frame_ready

kinect.skeleton_engine.enabled=True

and I defined skeleton_frame_ready as

def skeleton_frame_ready(frame):
    skeletons = frame.SkeletonData
    for index,data in enumerate(skeletons):
           head=data.SkeletonPositions[JointId.Head]
           print(head)

But I get error that there isn't any index or data attributes for skeleton. What Should i do to get the skeleton joints and its positions. Please help

4

2 回答 2

0
def skeleton_handler_function(frame):
for data in frame.SkeletonData:
    print("Positions : " , data.SkeletonPositions)

试试这个来获取骨架位置数据

于 2018-04-17T20:32:03.567 回答
0
skeleton_to_depth_image = nui.SkeletonEngine.skeleton_to_depth_image

def skeleton_handler_function(frame):

    if frame.SkeletonData is not None:
        for index, data in enumerate(frame.SkeletonData):
            point = skeleton_to_depth_image(data.SkeletonPositions[JointID.Head], 320, 240)
            print(point)
于 2021-04-28T00:24:20.553 回答