none
Suggestions for Xbox Kinect RRS feed

  • Question

  • I'm currently working on a project for school that requires me to create a certain piece of software with the Kinect hardware. The software is closely related to an aerobics/exercise "game". 

    However, being that I have never worked for the Kinect, I'm somewhat clueless as to where to start. I have downloaded the SDK and the Toolkit browser, as well as some (unofficial?) Toolkit.

    I have some experience in Java programming, but no knowledge whatsoever how to work with C/C++/C# nor Visual Studio.

    I'm basically looking for tutorials that could help me get more knowledgeable with the Kinect and how programming for it works. I tried looking for a few but they were either outdated or really confusing that I couldn't keep up with them.

    My main goal in the project is to figure out how I can see when a live skeleton holds both his arms above his head and when they're next to his body (A jumping jack exercise).

    Can anyone help me along the right direction with a few links or examples?

    Regards,

    Pallavi

    Thursday, March 21, 2013 5:50 PM

Answers

  • Pallavi -

    If you have Java experience, the learning curve for C# should be fairly easy, so I would recommend C# rather than C/C++ for your project.

    In the Toolkit browser, take a look at the SkeletonBasics-WPF sample. It shows how to initialize the Kinect runtime and process skeleton data. The sample takes the skeleton data and renders it on the screen, but your own code can examine the 3-dimensional positions of the joints, and respond to various configurations. Here's a very simple example:

        public static bool AreHandsAboveHead(Skeleton s)
        {
            if (s.TrackingState != SkeletonTrackingState.Tracked)
            {
                return false;
            }
    
            SkeletonPoint handLeft = s.Joints[JointType.HandLeft].Position;
            SkeletonPoint handRight = s.Joints[JointType.HandRight].Position;
            SkeletonPoint head = s.Joints[JointType.Head].Position;
    
            // each hand must be more than this far above the center of the head
            const float height = 0.2;   // 20 cm
    
            // each hand must be inside a circle of this radius, centered above the head
            const float radius = 0.3;   // 30 cm
    
            return
                (handLeft.Y - head.Y > height &&
                 handRight.Y - head.Y > height &&
                 Distance2D(handLeft.X, handLeft.Z, head.X, head.Z) < radius &&
                 Distance2D(handRight.X, handRight.Z, head.X, head.Z) < radius);
        }
    
        internal static float Distance2D(float a1, float b1, float a2, float b2)
        {
            float a = a1 - a2;
            float b = b1 - b2;
            return Math.Sqrt(a * a + b * b);
        }
    I hope this helps you get started. Best wishes for a successful project.

    John | Kinect for Windows development team


    Thursday, March 21, 2013 8:17 PM

All replies

  • Pallavi -

    If you have Java experience, the learning curve for C# should be fairly easy, so I would recommend C# rather than C/C++ for your project.

    In the Toolkit browser, take a look at the SkeletonBasics-WPF sample. It shows how to initialize the Kinect runtime and process skeleton data. The sample takes the skeleton data and renders it on the screen, but your own code can examine the 3-dimensional positions of the joints, and respond to various configurations. Here's a very simple example:

        public static bool AreHandsAboveHead(Skeleton s)
        {
            if (s.TrackingState != SkeletonTrackingState.Tracked)
            {
                return false;
            }
    
            SkeletonPoint handLeft = s.Joints[JointType.HandLeft].Position;
            SkeletonPoint handRight = s.Joints[JointType.HandRight].Position;
            SkeletonPoint head = s.Joints[JointType.Head].Position;
    
            // each hand must be more than this far above the center of the head
            const float height = 0.2;   // 20 cm
    
            // each hand must be inside a circle of this radius, centered above the head
            const float radius = 0.3;   // 30 cm
    
            return
                (handLeft.Y - head.Y > height &&
                 handRight.Y - head.Y > height &&
                 Distance2D(handLeft.X, handLeft.Z, head.X, head.Z) < radius &&
                 Distance2D(handRight.X, handRight.Z, head.X, head.Z) < radius);
        }
    
        internal static float Distance2D(float a1, float b1, float a2, float b2)
        {
            float a = a1 - a2;
            float b = b1 - b2;
            return Math.Sqrt(a * a + b * b);
        }
    I hope this helps you get started. Best wishes for a successful project.

    John | Kinect for Windows development team


    Thursday, March 21, 2013 8:17 PM
  • Thanks for the help John. I'm going to try this out.

    In the meantime if anyone else has any other suggestions on where to start, that would be really helpful.



    Regards,

    Pallavi

    Monday, March 25, 2013 8:15 AM