Skeleton data in Pykinect

3k views Asked by At

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

2

There are 2 answers

0
user13107353 On
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)
0
Shriranga Kadam On
def skeleton_handler_function(frame):
for data in frame.SkeletonData:
    print("Positions : " , data.SkeletonPositions)

try this to get skeleton position data