Kinect第一天:翻译

一、从Asset Store获取kinect包


这里写图片描述


其目录结构如下:


这里写图片描述


/**************************
今天我的任务就是把四个pdf说明文档看一遍:
**************************/

How to Use Gestures or Create Your Own Gestures

如何使用手势 | 创建你自己的手势

There are two ways to add gesture detection and gesture recognition to your Unity-project.
-此处有两种添加手势检测和在你的Unity项目中手势识别的方法

For the first one look at KinectManager – a component of MainCamera in the example scene. There are two lists - “Player1 Gestures” (these are the gestures expected from player 1) and “Player2 Gestures” (expected from player 2).
-方法一:浏览KinectManager(示例场景中MainCamera的一个组件)。上面有两个列表——“Player1 Gestures”(玩家1的手势预测)和“Player2 Gestures”(玩家2的手势预测)。
这里写图片描述

The gestures in these lists will be detected during the entire game.
-游戏运行时,列表中的这些手势会一直被检测。

The second way is to specify user specific gestures programmatically. To add such gestures or to handle any of the specified gestures (in 1. or 2. way), you need to implement KinectGestures.GestureListenerInterface. For an example look at the KinectScripts/Extras/SimpleGestureListener.cs-script. Here is a short description of its methods:
-方法二是用编程的方式指定特定的手势。为了添加手势或者标记特定手势(通过方法一或方法二)
,你需要实现KinectGestures.GestureListenerInterface这个接口。举个例子,参考KinectScripts/Extras/SimpleGestureListener.cs这个脚本。下面是对其方法的简介:

UserDetected() can be used to start gesture detection programmatically. UserLost() can be used to clear variables or to free the allocated resources. You don’t need to remove the gestures added by UserDetected()-method explicitly. They are removed automatically, before the invocation of UserLost().
-代码里可以用UserDetected()来开始检测手势。用UserLost()明确变量或者释放资源。通过UserDetected()方法添加的手势,你不需要显示地移除。它们会在调用UserLost()之前被自动移除。

GestureInProgress()-method is invoked when a gesture is started, but not yet completed or cancelled. GestureCompleted() is invoked when the gesture is completed. You can add your own code there to handle the completed gestures. GestureCancelled() is invoked, if the gesture is cancelled.
-当有手势开始时,调用GestureInProgress()方法,此时手势还没完成或者被取消。手势完成时调用GestureCompleted()。你可以在这个方法里添加手势完成时的指令。手势被取消时,调用GestureCancelled()。


Currently Recognized Gestures

-当前识别的手势

The following gestures are currently recognized:
-目前能识别以下手势:

  • RaiseRightHand / RaiseLeftHand – left or right hand is raised over the shoulder and stays so for at least 1.0 second. 举左手 /举右手 ——左 / 右手举过肩保持1.0s以上
  • Psi – both hands are raised over the shoulder and the user stays in this pose for 1.0 seconds. Psi(这个暂时不知道翻译成啥,目前翻译成Ψ,动作象形)——双手举过肩,保持这个姿势1.0s以上
  • Tpose – the hands are to the sides, perpendicular to the body (T-pose), for 1.0 seconds. T型动作——双手两侧平举,与身体垂直(T-型),1.0s。这里写图片描述
  • Stop – right hand is down and left hand is slightly to the side, but below the waist, or left hand is down and right hand is slightly to the side, but below the waist. 停——右手向下,左手稍偏,但是要在腰部以下(或者互换,同样)。
  • Wave – right hand is waved left and then back right, or left hand is waved right and then back left. 挥手——右手朝左挥动然后回到右侧(左手亦然)。
  • SwipeLeft – right hand swipes left.左滑——右手向左滑动。
  • SwipeRight – left hand swipes right.右滑——左手向右滑动
  • SwipeUp / SwipeDown – swipe up or down with left or right hand下滑 / 上滑——左手或右手滑上或者滑下
  • Click – left or right hand stays in place for at least 2.5s. Useful in combination with cursor control.点击——左/右手在一个地方保持至少2.5s。结合光标控制非常有用。
  • RightHandCursor / LeftHandCursor – pseudo gesture, used to provide cursor movement with the right or left hand. 右手光标 / 左手光标——模拟手势,提供左/右手的移动光标
  • ZoomOut – left and right hands are to the front and put together at the beginning, then the hands move in different directions.放大——左右手朝前,一开始时放在一起,然后双手朝不同方向移动
  • ZoomIn - left and right hands are at least 0.7 meter apart and to the front at the beginning, then the hands get closer to each other.缩小——左右手朝前,至少相隔0.7m,然后相互靠近。
  • Wheel - left and right hands are shoulder size apart and to the front at the beginning, then the hands start to turn an imaginary wheel left (positive angle) or right (negative angle). 旋转——左右手朝前,一肩之距,然后双手开始绕假想轮盘转动。左转为正角,右转为负角。
  • Jump – the hip center gets at least 15cm above its last position within 1.5 seconds.跳——骨骼中心点在1.5s之内比原位置高15cm以上
  • Squat - the hip center gets at least 15cm below its last position within 1.5 seconds蹲——骨骼中心点在1.5s之内比原位置低15cm以上
  • Push – push forward with left or right hand within 1.5 seconds推——1.5s之内,左手或右手向前推
  • Pull - pull backward with left or right hand within 1.5 seconds拉——1.5s之内,左手或右手往后拉

How to Add Your Own Gestures

-如何添加你自己的手势


Here are some hints on how to add your own gestures to the Kinect gesture-detection procedure. You need some C# coding skills and a bit of basic understanding on how the sensor works. It reports the 3d-coordnates of the tracked body parts in the Kinect coordinate system, in meters.
-关于怎样在kinect手势检测程序中添加你自己的手势,此处有一些建议。你需要有一些C#编码技能以及传感器工作原理的一点基础理解。kinect坐标系统以米为单位,反馈追踪到的人体四肢的3D坐标。

To add detection of custom gesture, open Assets/KinectScripts/KinectGestures.cs. Then:
-添加自定义手势的检测,需要先打开Assets/KinectScripts/KinectGestures.cs脚本,然后:

  1. Find the Gestures-enum. First you need to add the name of your gesture at the end of this enum.
    -找到Gestures枚举。你第一步需要在这个枚举的后面添加你的手势名。
  2. Find the CheckForGesture()-function. There is a long switch() there, and its cases process the detection of each gesture, defined in the Gestures-enum. You need to add a case for your gesture at the end of this switch(), near the end of the script. There you will implement the gesture detection.
    -找到CheckForGesture()方法。这里面有一个比较长的switch()表达式,它的case处理每个在Gestures枚举中定义的手势的检测。你需要在这个脚本底部的switch()尾部为你的手势添加一个case。这里你将实行手势检测。
  3. For an example on how to do that, look at the processing of some simple gestures, like RaiseLeftHand, RaiseRightHand, SwipeLeft or SwipeRight.
    -想找怎样实现的例子,可以参照比如RaiseLeftHand, RaiseRightHand, SwipeLeft or SwipeRight这些处理一些简单手势的样本。
  4. As you see, each gesture has its own internal switch() to check and change the gesture’s current state. Each gesture is like a state machine with numerical states (0, 1, 2, 3…). Its current state along with other data, is stored in an internal structure of type GestureData. This data-structure is created for each gesture that needs to be detected in the scene.
    -如你所见,每个手势都有与自己相关的switch()来检查和改变手势的当前状态。每个手势就像一个数值状态机*(0,1,2,3…)。当前的状态伴随着其他被存储在相关联的结构体或者手势数据存储器中。这个数据结构为每个在场景中需要被检测的手势而创建。
  5. The initial state of each gesture is 0. At this state, the code needs to detect if the gesture is starting or not. To do this, it checks and stores the position of a joint, usually the left or right hand. If the joint position is suitable for a gesture start, it increments the state. At the next state, it checks if the joint has reached the needed position (or distance from the previous position), usually within a time interval, let’s say within 1.0 - 1.5 seconds.
    -每个手势的初始状态是0。这个状态下,指令需要检测手势是否正要开始。为了做到这样,指令需要检测和储存相关的位置,通常是左手和右手。假如相关位置适合手势开始,它就增加这个状态。在下一个状态,它会检测相关的关节是否到达了所需位置(或者是从上一个位置的距离),一般是在一个时间间隔之内,通常为1.0-1.5s。
  6. If the joint has reached its target position (or distance) within the time interval, the gesture is considered completed. Otherwise - it is considered cancelled. Then, the gesture state may be reset back to 0 and the gesture-detection procedure will start again.
    -假如关节在时间间隔内到达了目标位置(或者距离),手势就被认为完成。或者——被认为取消。那么,手势状态可能重设回0,手势检测又会再一次进行。

    To add detection of your own gestures, first try to understand how relatively simple gestures, like RaiseHand or Swipes, work. Then find a gesture similar to the one you need. Copy and modify its code to fit your needs. Hope this helps for a start ;)
    -想要添加你自己的手势检测,首先尝试理解相关的简单手势,例如举手或者滑动的检测原理。然后找到一个与你的需求相似的手势。复制和修改里面的代码来适应你的需求。希望这篇文章能有助于入门。

Support, Examples and Feedback
-支持,案例和反馈

E-mail: rumen.filkov@gmail.com;

Web: http://rfilkov.com

Skype: roumenf

Twitter: roumenf

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值