none
KinectSDK - Convert Skeleton point to Screen Point RRS feed

  • Question

  • Hi All,

    I am developing an application using KinectSDK + Kinect + Microsoft WPF, My application resolution is 1920,1080. So when we get a Skeleton point I need to show it in my screen with the said resolution. Can someone help me to do this ?

    Regards

    Amila 

    Wednesday, January 9, 2013 8:14 AM

Answers

  • Using CoordinateMapper.MapSkeletonPointToDepthPoint, you can convert your SkeletonPoint to a 2D screen position. However, the highest resolution supported is 640x480, so you'll need to scale the point. Since 640x480 (4:3) is a different aspect ratio than 1920x1080 (16:9), you'll probably also want to apply an offset to the X coordinate so it will be centered within your application.

    private System.Windows.Point MapSkeletonToScreen(KinectSensor sensor, SkeletonPoint skeletonPoint)
    {
        const double scale = 1080.0 / 480.0;
        const double xOffset = 1920.0 - (640.0 * scale) / 2;
        DepthImagePoint depthImagePoint = sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(
            skeletonPoint,
            Resolution640x480Fps30);
        return new System.Windows.Point(xOffset + (scale * depthImagePoint.X), (scale * depthImagePoint.Y));
    }

    Note that if you're planning to superimpose the skeleton on top of the color image captured by the Kinect camera, you'll probably want to use MapSkeletonPointToColorPoint instead, so that the skeleton will be properly aligned with the image.


    John | Kinect for Windows development team

    Thursday, January 17, 2013 1:24 AM