Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将Kinect方法从Beta 2转换为版本1_C#_Kinect - Fatal编程技术网

C# 将Kinect方法从Beta 2转换为版本1

C# 将Kinect方法从Beta 2转换为版本1,c#,kinect,C#,Kinect,因此,我将getDisplayPosition从Kinect SDK的beta版转换为完整版。这是我现在拥有的原件 我的版本 基本上,我想知道我的版本是否能做与原版相同的事情,如果不能,如何修复它。这就是我所做的,它对我有效(这与你的非常相似)-我希望它能帮助: 我的版本 对不起,我不能通过电话提供赏金:POh,但我不也需要一个DepthImageFrame?那会有什么影响吗?还有什么是depthImageFormat和sensor?depthImageFormat(depthImageFor

因此,我将
getDisplayPosition
从Kinect SDK的beta版转换为完整版。这是我现在拥有的
原件


我的版本
基本上,我想知道我的版本是否能做与原版相同的事情,如果不能,如何修复它。

这就是我所做的,它对我有效(这与你的非常相似)-我希望它能帮助:

我的版本
对不起,我不能通过电话提供赏金:POh,但我不也需要一个
DepthImageFrame
?那会有什么影响吗?还有什么是
depthImageFormat
sensor
?depthImageFormat(depthImageFormat实例)和sensor(KineticSensor实例)是代码中的一对变量。我在加载窗口时分配这些。我使用depthImageFrame来利用构建的MapToColorImagePoint方法。我使用了depthImageFormat,因为我认为这是KineticSensor上的一个初始化值,所以我想在这方面使用相同的设置。在我的代码中,“传感器”只是加载窗口时实例化的KinectSensor的一个实例。同样,depthImageFormat也是我在启动sensor.FYI后分配的一个变量。当你说
sensor.ColorStreamFormat
时,我发现它实际上是
sensor.ColorStream.Format
,看到“
sensor
ColorStreamFormat
没有定义”哈哈哈哈哈哈哈哈,没问题,那天我和KinectSensor的成员搞砸了,这是件好事。请参考此链接,它可能会帮到你。我以前在工作中遇到过这样的问题,不过还是要谢谢你
 private Point getDisplayPosition(Joint joint)
    {
        float depthX, depthY;
        nui.SkeletonEngine.SkeletonToDepthImage(joint.Position, out depthX, out depthY);
        depthX = Math.Max(0, Math.Min(depthX * 320, 320));  //convert to 320, 240 space
        depthY = Math.Max(0, Math.Min(depthY * 240, 240));  //convert to 320, 240 space
        int colorX, colorY;
        ImageViewArea iv = new ImageViewArea();
        // only ImageResolution.Resolution640x480 is supported at this point
        nui.NuiCamera.GetColorPixelCoordinatesFromDepthPixel(ImageResolution.Resolution640x480, iv, (int)depthX, (int)depthY, (short)0, out colorX, out colorY);


        // map back to skeleton.Width & skeleton.Height
        return new Point((int)(skeleton.Width * colorX / 640.0), (int)(skeleton.Height * colorY / 480));
    }
private Point getDisplayPosition(Joint joint)
    {
        float depthX, depthY;
        KinectSensor sensor = kinectSensorChooser1.Kinect;
        DepthImageFormat depth = DepthImageFormat.Resolution320x240Fps30;
        depthX = 320;
        depthY = 240;
        sensor.MapSkeletonPointToDepth(joint.Position, depth);
        depthX = Math.Max(0, Math.Min(depthX * 320, 320));
        depthY = Math.Max(0, Math.Min(depthY * 240, 240));
        int colorX, colorY;
        colorX = 320;
        colorY = 240;

        return new Point((int)(skeleton.Width * colorX / 640.0), (int)(skeleton.Height * colorY / 480));
    }
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));
}