The Skeleton
data is just a series of Joint
collections, containing X/Y/Z coordinates. You can save them and write them just like any other type of object.
Getting the value of a Joint
is shown in multiple examples provided by Microsoft for the Kinect for Windows Samples. Please explore those examples to gain a basis for working with the latest Kinect SDK.
Here is a basic callback to parse the SkeletonFrame
and work with individual skeletons:
private void OnSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
{
if (skeletonFrame == null || skeletonFrame.SkeletonArrayLength == 0)
return;
// resize the skeletons array if needed
if (_skeletons.Length != skeletonFrame.SkeletonArrayLength)
_skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
// get the skeleton data
skeletonFrame.CopySkeletonDataTo(_skeletons);
foreach (var skeleton in _skeletons)
{
// skip the skeleton if it is not being tracked
if (skeleton.TrackingState != SkeletonTrackingState.Tracked)
continue;
// print the RightHand Joint position to the debug console
Debug.Writeline(skeleton.Joints[JointType.HandRight]);
}
}
}
Additionally, the Kinect Toolbox comes with functions that allow you to record and replay all 3 of the streams.