43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Microsoft.Research.Kinect.Nui;
|
|
|
|
namespace Demo2
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
if (Runtime.Kinects.Count == 0)
|
|
{
|
|
Console.WriteLine("KEine Kinect");
|
|
return;
|
|
}
|
|
Runtime r = Runtime.Kinects[0];
|
|
r.Initialize(RuntimeOptions.UseSkeletalTracking);
|
|
r.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(r_SkeletonFrameReady);
|
|
r.SkeletonEngine.TransformSmooth = true;
|
|
|
|
Console.ReadLine();
|
|
r.Uninitialize();
|
|
}
|
|
|
|
static void r_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
|
|
{
|
|
foreach (SkeletonData sk in e.SkeletonFrame.Skeletons)
|
|
{
|
|
if (sk.TrackingState == SkeletonTrackingState.Tracked)
|
|
{
|
|
Joint l = sk.Joints[JointID.HandLeft];
|
|
Joint r = sk.Joints[JointID.HandRight];
|
|
Console.WriteLine("Left Hand: X:{0}, Y:{1}, Z:{2}", l.Position.X, l.Position.Y, l.Position.Z);
|
|
Console.WriteLine("Right Hand: X:{0}, Y:{1}, Z:{2}", r.Position.X, r.Position.Y, r.Position.Z);
|
|
}
|
|
}
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
}
|