三维姿态捕捉_Kinect 1.8 体感开发,手势,姿态(Pose) 捕捉判断方法以及一些辅方法...

该博客介绍了如何使用Kinect 1.8进行三维姿态捕捉,通过关节角度和位置判断不同姿态,如T型手势、左右手动作等,并实现相应的控制功能。通过计算关节间的距离和角度,实现对手势的精确识别,并在满足特定条件时触发对应的操作。
摘要由CSDN通过智能技术生成

///

///根据人体各种姿态的生理数据判断姿态///通过关节之间角度,关节之间的相关位置判断姿态///

/// 骨架数据

private voidProcessPosePerForming2(Skeleton sk)

{string mess = "";//T型姿态//double angelLeft = GetJointAngle(sk.Joints[JointType.ElbowLeft],sk.Joints[JointType.ShoulderLeft]);//double angelRight = GetJointAngle(sk.Joints[JointType.ElbowRight],sk.Joints[JointType.ShoulderRight]);

#region 获取数据

double angelLeft =GetJointAngle(sk.Joints[JointType.ShoulderLeft], sk.Joints[JointType.ElbowLeft], sk.Joints[JointType.WristLeft]);double angelRight =GetJointAngle(sk.Joints[JointType.ShoulderRight], sk.Joints[JointType.ElbowRight], sk.Joints[JointType.WristRight]);//胸关节空间位置

Vector4 shoulderCenter =GetJointVector4(sk.Joints[JointType.ShoulderCenter]);

Vector4 handLeft=GetJointVector4(sk.Joints[JointType.HandLeft]);

Vector4 handRight=GetJointVector4(sk.Joints[JointType.HandRight]);

Vector4 spine=GetJointVector4(sk.Joints[JointType.Spine]);double leftCentZ = Math.Round((shoulderCenter.Z - handLeft.Z), 2);double rightCenterZ = Math.Round((shoulderCenter.Z - handRight.Z), 2);double leftAndRightX = Math.Round(Math.Abs((handRight.X - handLeft.X)), 2);double leftAndRightY = Math.Round(Math.Abs((handRight.Y - handLeft.Y)), 2);#endregion

#region 姿势判断

//T型姿势

if (leftAndRightX >= 750 && leftAndRightY <= 10 && isOK == false)

{

mess= "T型姿势";

KinectTimer.Start();

isKinectControl= true;

(minWindow.FindName("gridMainMenu") as Grid).Visibility =Visibility.Collapsed;

(minWindow.FindName("gridPose") as Grid).Visibility =Visibility.Visible;

(minWindow.FindName("gridTuch") as Grid).Visibility =Visibility.Collapsed;if ((this.minWindow as MainMenu).mainWindow != null)

{

(this.minWindow as MainMenu).mainWindow.VRPControl.ExecuteVrpScript("执行内部函数,funReset");

}

}else

//左手举起,右手放下

if (leftAndRightY > 200 && handLeft.Y < handRight.Y &&isOK)

{

mess= "左手举起,右手放下";

(minWindow.FindName("gridMainMenu") as Grid).Visibility =Visibility.Collapsed;

(minWindow.FindName("gridPose") as Grid).Visibility =Visibility.Collapsed;

(minWindow.FindName("gridTuch") as Grid).Visibility =Visibility.Visible;

}else

//右手举起,左手放下

if (leftAndRightY > 200 && handLeft.Y > handRight.Y &&isOK)

{

mess= "右手举起,左手放下";

}else

//双手交叉

if ((handRight.X - handLeft.X) < 0 && handLeft.Y < 150 && handRight.Y < 150 && isOK) //handLeft.Y

{

mess= "双手交叉";

KinectTimer.Stop();

isKinectControl= false;

(minWindow.FindName("gridMainMenu") as Grid).Visibility =Visibility.Visible;

(minWindow.FindName("gridPose") as Grid).Visibility =Visibility.Collapsed;

(minWindow.FindName("gridTuch") as Grid).Visibility =Visibility.Collapsed;if ((this.minWindow as MainMenu).mainWindow != null)

{

(this.minWindow as MainMenu).mainWindow.VRPControl.ExecuteVrpScript("执行内部函数,funReset");

(this.minWindow as MainMenu).mainWindow.VRPControl.ExecuteVrpScript(&

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值