1
我已经实现了示例代码并使用'Joint.ID'而不是'Joint.Type',我只需要计算出该代码是否/如何可以在循环内连续检查。任何意见将不胜感激。谢谢。建议使用Kinect创建一个简单的静态手势的手势定义 - 第2部分
注: -
void newSensor_AllFramesReady
火灾时,颜色/深度/骷髅是同步的。 我不太确定该放置该方法的位置。checkHand
方法需要在每一轮的线程中检查。
到目前为止的代码: -
void newSensor_AllFramesReady(object sender, SkeletonFrameReadyEventArgs e)
{
//Get a skeleton
SkeletonFrame skeletonSet = e.SkeletonFrame;
SkeletonData skeleton = (from s in skeletonSet.Skeletons
where s.TrackingState == SkeletonTrackingState.Tracked
select s).FirstOrDefault();
if (skeleton == null)
{
return;
}
else if (skeleton != null)
{
checkHand(skeleton.Joints[JointID.Head], skeleton.Joints[JointID.HandRight], skeleton.Joints[JointID.HandLeft]);
}
}
public void checkHand(Joint head, Joint rhand, Joint lhand)
{
if (rhand.Position.X > head.Position.Y)
{
MessageBox.Show("Right hand up!");
}
else if (lhand.Position.Y > head.Position.Y)
{
MessageBox.Show("Left hand up!");
}
}