0

Possible Duplicate:
Kinect: How to get the skeleton data from some depth data( geting from kinect but i modified some place)

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 . .

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();
            }
        }
Community
  • 1
  • 1
Sweta Dwivedi
  • 326
  • 2
  • 4
  • 20
  • possible dup: http://stackoverflow.com/questions/12155062/kinect-how-to-get-the-skeleton-data-from-some-depth-data-geting-from-kinect-bu/12159919#12159919 – Kinected Sep 23 '12 at 21:42

1 Answers1

2

You will want to see Kinect: How to get the skeleton data from some depth data( geting from kinect but i modified some place), even though it is getting skeleton data from depth data, the answer shows how to do the opposite too.

Community
  • 1
  • 1
Kinected
  • 441
  • 5
  • 19