Konvertieren von Kinect-Methoden von Beta 2 zu Version 1

Also habe ich die konvertiertgetDisplayPosition von der Beta-Version des Kinect SDK zur Vollversion. Folgendes habe ich gerade

Das Original

<code> 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));
    }
</code>


Meine Version
<code>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));
    }
</code>

Grundsätzlich möchte ich wissen, ob meine Version das Gleiche macht wie das Original, und wenn nicht, wie man es repariert.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage