I understand that in your project, more than one person will be visible to the Kinect, but you want the application to respond to just one person.
In the Kinect SDK, you are given an array of skeletons. This array always has 6 skeletons, regardless of the number of people visible to the Kinect. You can tell whether a person is present by checking the status of each skeleton in the array to see if it is
tracked. The first person visible might show as tracked in any of the six spots in the array (the index is random -- the zeroth index doesn't mean the first person). Once a person is tracked, their skeleton data will stay in the same index in the array.
For example, Alice walks in front of the Kinect and her skeleton shows up as tracked in skeletons. Then Bob walks in front of the Kinect and now there are tracked skeletons in skeletons and skeletons. Alice's skeleton data is still skeletons and
Bob's skeleton data is skeletons. Bob walks away and now skeletons becomes NotTracked and Alice's skeleton data is still tracked skeletons. (Note - the names are simply for explaining the example. The Kinect SDK does not do person identification and
does not know which skeleton is which identity.)
For your project, you would have to design a way to determine whether Alice or Bob (for example) is the patient, and then just respond to that person's skeleton by only using the index. For example, if the patient is always visible first, then maybe Alice would
be the patient, and then once the exercise activity starts, only respond to the skeleton in skeletons (or whichever index became tracked first.)
As for code, you can look in Kinect PowerPoint Control's source code in MainWindow.xaml.cs to see an example of getting the skeleton data:
using (var skeletonFrame = e.OpenSkeletonFrame())
if (skeletonFrame == null)
if (skeletons == null ||
skeletons.Length != skeletonFrame.SkeletonArrayLength)
skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
//now check skeletons for TrackingState == SkeletonTrackingState.Tracked
//and do something interesting with skeletons
//Determine which index into the array is the patient and respond to that index each time, until the exercise ends or tracking is lost
Hope that helps!