Coding4Fun Kinect Toolkit v1.5 for v1

Last but not least is one of those must have toolkits, one of those hard learned repositories of BST (blood, sweat and tears)...

Coding4Fun Kinect Toolkit

Updated for Kinect for Windows SDK v1.0!

This project requires the Kinect for Windows SDK. If you want to learn how to use the Kinect for Windows SDK, head over to the Channel 9 and their quick start series. This toolkit contains both a WinForm and WPF version.

WPF:

Depth Data Extension Methods:

  • ImageFrame.ToBitmapSource()
    • returns BitmapSource
  • int[].ToBitmapSource()
    • returns BitmapSource
  • int[].ToBitmapSource(int width, int height, int minimumDistance, Color highlightColor)
    • returns BitmapSource
  • ImageFrame.ToDepthArray()
    • returns int[]
  • int[].GetMidpoint(int startX, int startY, int endX, int endY, int minimumDistance)
    • returns Point
  • BitmapSource.Save(string fileName, ImageFormat format)
    • returns nothing

Skeleton Data Extension Methods:

  • Joint.ScaleTo(int width, int height)
    • Scales a Joint's Position to the maximum width and height specified
  • Joint.ScaleTo(int width, int height, float maxSkeletonX, float maxSkeletonY)
    • Scales a Joint's Position to the maximum width and height specified

Controls:

  • Hover Button
WinForm:

Depth Data Extension Methods:

  • ImageFrame.ToBitmap()
    • returns Bitmap
  • int[].ToBitmap()
    • returns Bitmap
  • int[].ToBitmap(int width, int height, int minimumDistance, Color highlightColor)
    • returns Bitmap
  • ImageFrame.ToDepthArray()
    • returns int[]
  • int[].GetMidpoint(int startX, int startY, int endX, int endY, int minimumDistance)
    • returns Point
  • Bitmap.Save(string fileName, ImageFormat format)
    • returns nothing

Skeleton Data Extension Methods:

  • Joint.ScaleTo(int width, int height)
    • Scales a Joint's Position to the maximum width and height specified
  • Joint.ScaleTo(int width, int height, float maxSkeletonX, float maxSkeletonY)
    • Scales a Joint's Position to the maximum width and height specified

Project Information URL: http://c4fkinect.codeplex.com/

Project Download URL: http://c4fkinect.codeplex.com/releases/view/81523

Project Source URL: http://c4fkinect.codeplex.com/SourceControl/list/changesets

Runs with v1? Yes

image

image

void sensor_ColorFrameReady(AllFramesReadyEventArgs e)
{
    using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
    {
        if (colorFrame == null)
        {
            return; 
        }

        //set image
        ColorImage.Source = colorFrame.ToBitmapSource();

        if (_saveColorFrame)
        {
            //save image

            colorFrame.ToBitmapSource().Save(DateTime.Now.ToString("yyyyMMddHHmmss") + "_color.jpg", ImageFormat.Jpeg);
        }
    }            
}

void sensor_DepthFrameReady(AllFramesReadyEventArgs e)
{
    using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
    {
        if (depthFrame == null)
        {
            return; 
        }

        //turn raw data into an array of distances; 
        var depthArray = depthFrame.ToDepthArray();

        MidPointDistanceViaGetDistanceText.Text = depthFrame.GetDistance(depthFrame.Width/2, depthFrame.Height/2).ToString();

        //image
        DepthImageWithMinDistance.Source = depthArray.ToBitmapSource(depthFrame.Width, depthFrame.Height,
                                                                    _minDistance, Colors.Red);

        //image
        DepthImage.Source = depthFrame.ToBitmapSource();

        if (_saveDepthFrame)
        {
            _saveDepthFrame = false;
            depthFrame.ToBitmapSource().Save(DateTime.Now.ToString("yyyyMMddHHmmss") + "_depth.jpg", ImageFormat.Jpeg);
        }
    }
}

Tags:

Follow the Discussion

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.