I'm trying to create a program using Kinect where watch the user and as output of the program tells the direction where the user is walking.
I mean, if the user is walking forward, the output should be.. UP
0 <= 8 <= // the user (8) is walking forward (<=) to the camera (0=kinect)
If the user is walking back, the output should be DOWN. If the user is walking to the left, the output should be LEFT. And the same thing for RIGHT.
Until what I have is:
private static KinectSensor kinectSensor;
static void Main(string[] args)
{
kinectSensor = KinectSensor.KinectSensors[0];
kinectSensor.SkeletonStream.Enable();
kinectSensor.Start();
kinectSensor.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady;
while (true) { }
}
private static Skeleton[] data;
static void kinectRuntime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
{
if (skeletonFrame != null)
{
if ((data == null) || (data.Length != skeletonFrame.SkeletonArrayLength))
data = new Skeleton[skeletonFrame.SkeletonArrayLength];
skeletonFrame.CopySkeletonDataTo(data);
foreach (Skeleton ske in data)
{
if (ske.TrackingState == SkeletonTrackingState.Tracked)
{
var joints = ske.Joints;
foreach (Joint joint in ske.Joints)
{
if (joint.JointType == JointType.HandLeft)
{
Console.WriteLine(joint.Position.X.ToString(".##"));
Console.WriteLine(joint.Position.Y.ToString(".##"));
Console.WriteLine(joint.Position.Z.ToString(".##"));
}
}
}
}
}
}
}
And this just tells you the position of your left hand. I don't know much about Kinect library, so I need a little bit of help to do this.
I've seen post, but I'm still don't get it how this can help me.