public static BitmapSource ToBitmapSource(this BodyFrame bodyFrame, bool drawBones = true, double pointRadius = 3F, double line = 0.8F) { var frameDescription = bodyFrame.BodyFrameSource.KinectSensor.DepthFrameSource.FrameDescription; var renderTargetBitmap = new RenderTargetBitmap(frameDescription.Width, frameDescription.Height, 96.0, 96.0, PixelFormats.Pbgra32); var drawingGroup = bodyFrame.GetDrawingGroup(drawBones, true, pointRadius, line); renderTargetBitmap.Render(drawingGroup); return(renderTargetBitmap); }