none
Trouble reading skeleton for kinect RRS feed

  • Question

  • I'm new to kinect programming and i am trying to map a skeleton and it is not working properly i'm using the 1.6 version of kinect sdk and my code runs but when it gets to this part it stops:

    void kinectsensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
           
    {
              
    SkeletonFrame skeletonSet = e.OpenSkeletonFrame();

        
    //   Skeleton skeletonData = new Skeleton[kinectsensor.SkeletonStream.FrameSkeletonArrayLength];

           
    **SkeletonskeletonData = (froms inskeletons
                                
    wheres.TrackingState == SkeletonTrackingState.Tracked
                                
    selects).FirstOrDefault();**
           
    if (skeletonData != null)

    {           
    SetEllipsePosition(Head, skeletonData.Joints[JointType.Head]);           
    SetEllipsePosition(leftHand, skeletonData.Joints[JointType.HandLeft]);           
    SetEllipsePosition(rightHand, skeletonData.Joints[JointType.HandRight]);           
    ProcessGesture(skeletonData.Joints[JointType.Head], skeletonData.Joints[JointType.HandLeft], skeletonData.Joints[JointType.HandRight]);       
    }   
    }

    the warning message i get is:

    'KinectSkeletonApplication3.MainWindow.skeletons' is never assigned  to, and will always have its default value null

           

    Thursday, April 11, 2013 7:35 PM

Answers

  • How did you handle the parameter 'KinectSkeletonApplication3.MainWindow.skeletons' ?

    You need to fill your Skeleton array with the following solution -  

                using (SkeletonFrame skeletonSet = e.OpenSkeletonFrame())
                {
                    if (skeletonFrame != null)
                    {
                        skeletons = new Skeleton[skeletonSet .SkeletonArrayLength];
                        skeletonSet.CopySkeletonDataTo(skeletons);
                    }
                }

    for the details, please see "Skeleton Basics - WPF" sample in K4W Toolkit browser.

    Friday, April 12, 2013 1:00 AM