This is part of what will be a series of posts on Kinect SDK demos and howtos, go here to see the whole list.

Every time I create a new Kinect SDK demo I find myself doing the same setup so I created a few extensions methods that I use in my projects to make life easier.
I figured I would share them here since I will be using them in my blog posts about Kinect in the future.

The extension methods are SetSmoothTransform, which sets the smoothing parameters on the skeleton to stabilize the skeleton movement a bit, and the second method (GetFirstTrackedSkeleton) simply grabs the first skeleton that is tracked, so that we can use it in the SkeletonFrameReady event if we only need data about one skeleton.

   public static class RuntimeExtensions{
        public static void SetSmoothTransform(this Runtime runtime)
        {
            runtime.SkeletonEngine.TransformSmooth = true;

            var parameters = new TransformSmoothParameters
            {
                Smoothing = 0.75f,
                Correction = 0.0f,
                Prediction = 0.0f,
                JitterRadius = 0.05f,
                MaxDeviationRadius = 0.04f
            };

            runtime.SkeletonEngine.SmoothParameters = parameters;
        }

        public static SkeletonData GetFirstTrackedSkeleton(this SkeletonFrame skeletonSet){
            SkeletonData data = (from s in skeletonSet.Skeletons
                                 where s.TrackingState == SkeletonTrackingState.Tracked
                                 select s).FirstOrDefault();
            return data;
        }
    }

I would also recommend another extension method from Greg Duncan called CreateLivePlayerRenderer which extracts just the player from the video, based on depth data… I will use this later in the series.

Enjoy,
Tess