Converting Kinect Methods from Beta 2, to Version 1

前端 未结 1 705
醉梦人生
醉梦人生 2020-12-12 03:15

So I have convert the getDisplayPosition from the beta version of the Kinect SDK to the full version. Here\'s what I have right now

The Original

相关标签:
1条回答
  • 2020-12-12 04:04

    This is what I did and it works for me (this is very similar to yours) - I hope it helps:

    My Version

    private Point getDisplayPosition(DepthImageFrame depthFrame, Joint joint)
    { 
        float depthX, depthY;        
        DepthImagePoint depthPoint = kineticSensor.MapSkeletonPointToDepth(joint.Position, depthImageFormat);
    
        depthX = depthPoint.X;
        depthY = depthPoint.Y;
    
        depthX = Math.Max(0, Math.Min(depthX * 320, 320));
        depthY = Math.Max(0, Math.Min(depthY * 240, 240));
    
        int colorX, colorY;
        ColorImagePoint colorPoint = depthFrame.MapToColorImagePoint(depthPoint.X, depthPoint.Y, sensor.ColorStream.Format);
        colorX = colorPoint.X;
        colorY = colorPoint.Y;
    
        return new Point((int)(skeleton.Width * colorX / 640.0), (int)(skeleton.Height * colorY / 480));
    }
    
    0 讨论(0)
提交回复
热议问题