title: Converting Skeletal Data to depth data in Kinect
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12155062/kinect-how-to-get-the-skeleton-data-from-some-depth-data-geting-from-kinect-bu">Kinect: How to get the skeleton data from some depth data( geting from kinect but i modified some place)</a>  </p>
  </blockquote>
  
  
  
  <p>Since the Skeletal Coordinate space is different from the Depth space I want to be able to convert from the skeletal data to depth Image data to be able to use those coordinates for animating my 3D models. . the tutorial I have been looking at are really old and unhelpful . i'm using Kinect v1.5 which doesnt involve NUI programming at all . . Any help would be appreciated ... Here is what i've got so far . .</p>
  
  <pre><code>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();
              }
          }
  </code></pre>