0

I've been trying to write a program for Kinect using Skeletal Tracking that will determine whether or not there are people/a person(seated or standing) is in front of the Kinect.

The problem is that my program always outputs "false"(meaning it has detected no skeleton). After consulting the below links,

Kinect SDK player detection Kinect user Detection

I can't for my life find out why the program does this.Perhaps my Kinect has a faulty skeleton tracking mechanism, but I think it's far more likely there's a bug in my program. I'd truly appreciate any input.

 bool TryGettingSkeleton(AllFramesReadyEventArgs e) { 
        using (SkeletonFrame skeletonFrame=e.OpenSkeletonFrame())
        {
            int playerCount=0;
            if (skeletonFrame != null)
            {
                Skeleton[] skeletonData = new Skeleton[kinectSensorChooser1.Kinect.SkeletonStream.FrameSkeletonArrayLength];
                skeletonFrame.CopySkeletonDataTo(skeletonData);


                foreach (Skeleton skeleton in skeletonData)//check all the skeletons, see which ones are tracked as sitting/standing
                {
                    if (skeleton.TrackingState == SkeletonTrackingState.Tracked || skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
                        playerCount++;
                }


                if (playerCount > 0)
                    return true;//there is at least one skeleton present
                else
                    return false;
            }

            else
            {
                return false;//no skeleton frame data, thus assume no skeleton
            }
        }//ends using

    }//ends TryGettingSkeleton method
Community
  • 1
  • 1
  • Have you explored the possible conditions that would return false? – tnw May 28 '14 at 20:39
  • So did you debug it, is it seeing a skeletonFrame? – Bit May 28 '14 at 20:41
  • thank you so much! I neglected to check out (sorry, my bad for such a simple problem), but the program is not getting a skeleton frame, so it immediately outputs false. I guess my follow up question is if you have any idea why the skeletonFrame always returns null even with someone sitting right in front of the Kinect? Thank you so much again! – user3685223 May 28 '14 at 21:14
  • update: person was sitting too close to the kinect. – user3685223 May 29 '14 at 17:47

0 Answers0