Unity Kinect开发 获取人物数据

直接上代码,首先需要定义一个bool变量来判断设备是否准备好,在定义一个RawImage来显示人物的彩色和深度数据

public bool isAngetKinect;

public RawImage UserTexture;

void Update()

{

//判断设备是否准备好

isAngetKinect = KinectManager.Instance.IsInitialized();

if (isAgent )
        {
            if (UserTexture.texture == null)
            {
                //获取彩色数据
                 Texture2D texture = KinectManager.Instance.GetUsersClrTex();
                //获取深度数据
               // Texture2D texture = KinectManager.Instance.GetUsersLblTex();
                UserTexture.texture = texture;

            }

 //判断是否检测到玩家
            if (KinectManager.Instance.IsUserDetected())
            {
                //获取玩家的ID
                long userId = KinectManager.Instance.GetPrimaryUserID();
                //获取右手
                int jointType = (int) KinectInterop.JointType.HandRight;
                //获取左手
                int LeftType = (int) KinectInterop.JointType.HandLeft;

//KinectInterop.JointType 可以获取人物身上的任意骨骼点需要什么直接获取就行

//追踪到关节点
                if (KinectManager.Instance.IsJointTracked(userId,jointType))
                {
                    //获取右手位置
                    Vector3 rightHandpos = KinectManager.Instance.GetJointKinectPosition(userId, jointType);

}

//kinect人物的骨骼点

如果是才接触这个kinect开发的话可以去看看这个视频我感觉讲的挺细的

http://www.maiziedu.com/course/525-7199/

  • 0
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值