将骨架数据转换为Kinect中的深度数据

时间:2012-09-23 11:13:21

标签: kinect depth

  

可能重复:
  Kinect: How to get the skeleton data from some depth data( geting from kinect but i modified some place)

由于骨架坐标空间与深度空间不同,我希望能够从骨架数据转换为深度图像数据,以便能够使用这些坐标来动画我的3D模型。 。我一直在看的教程非常古老而且无益。我正在使用Kinect v1.5,它根本不涉及NUI编程。 。任何帮助将不胜感激......这是我到目前为止所得到的。

void newSensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {   
            using (SkeletonFrame skeletalFrame = e.OpenSkeletonFrame())
            using(ColorImageFrame colorFrame = e.OpenColorImageFrame())
            using(DepthImageFrame depthFrame = e.OpenDepthImageFrame())
            {
                if (skeletalFrame != null)
                {
                    Skeleton[] skeletonData = new Skeleton[skeletalFrame.SkeletonArrayLength];
                    skeletalFrame.CopySkeletonDataTo(skeletonData);

                    Skeleton playerSkeleton = (from s in skeletonData where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault();

                    if (playerSkeleton != null)
                    {
                        Joint rightHand = playerSkeleton.Joints[JointType.HandRight];
                        var rightHandX = rightHand.Position.X;
                        var rightHandY = rightHand.Position.Y;
                        var rightHandZ = rightHand.Position.Z

                        Console.SetOut(writer);
                        Console.SetOut(oldOut);
                        writer.WriteLine(rightHandX + "," + rightHandY + "," + rightHandZ);


                      //Pattern.Add(new Point(rightHandX, rightHandY));



                    }

                    if (colorFrame != null)
                    {
                        int stride = colorFrame.Width * 4;

                        pixels = new byte[colorFrame.Width*colorFrame.Height*4];
                        colorFrame.CopyPixelDataTo(pixels);
                    }


                }


                if (Keyboard.IsKeyDown(Key.Escape))
                {
                    Stopkinect(kinectSensorChooser1.Kinect);
                    Application.Current.Shutdown();
                }


               // Pattern_Coordinates();

               //  Print_Pattern();
            }
        }

1 个答案:

答案 0 :(得分:2)

你会希望看到Kinect: How to get the skeleton data from some depth data( geting from kinect but i modified some place),即使它从深度数据中获取骨架数据,答案也会显示如何做相反的事情。