Kinectを使用して、ユーザーを監視し、プログラムの出力としてユーザーが歩いている方向を示すプログラムを作成しようとしています。
つまり、ユーザーが前に歩いている場合、出力は次のようになります。UP
0 <= 8 <= // the user (8) is walking forward (<=) to the camera (0=kinect)
ユーザーが戻ってきた場合、出力はDOWNになっているはずです。ユーザーが左に歩いている場合、出力はLEFTになります。そして、RIGHTについても同じことが言えます。
私が持っているものまで:
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(".##"));
}
}
}
}
}
}
}
そして、これはあなたの左手の位置を教えてくれます。Kinectライブラリについてはよくわからないので、これを行うには少し助けが必要です。
投稿を見たことがありますが、これがどのように役立つのかまだわかりません。