(三)Kinect姿勢識別


Kinect給我們內置了許多姿勢如舉手等,具體可參考枚舉KinectGestures.Gestures,也可以通過Kinect姿勢管理器,自定義姿勢導入(坑較多,內置的基本夠用了)也可以根據關節坐標自己程序定義姿勢。本節主要講解內置姿勢使用。

此部分可參考插件場景KinectGesturesDemo1和KinectGesturesDemo2,使用內置姿勢只需要在自己的腳本中實現接口ModelGestureListener : MonoBehaviour, KinectGestures.GestureListenerInterface即可。參考腳本ModelGestureListener和CubeGestureListener

接口方法:

1)public void UserDetected(long userId, int userIndex)

通過此方法來注冊檢測的姿勢,即對要檢測的姿勢進行定義

2)public void UserLost(long userId, int userIndex)

UserDetected中通過userIndex定義的用戶丟失時執行此方法

3)public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
                                  float progress, KinectInterop.JointType joint, Vector3 screenPos)

姿勢進行時激發方法

4)public bool GestureCompleted (long userId, int userIndex, KinectGestures.Gestures gesture,
                                  KinectInterop.JointType joint, Vector3 screenPos)

當姿勢完成時激活此方法

5)public bool GestureCancelled (long userId, int userIndex, KinectGestures.Gestures gesture,
                                  KinectInterop.JointType joint)
當取消時激活此方法

 

注:通過代碼自定義姿勢時可以采用獲取到的關節點screenPos來進行匹配,也可以通過joint來獲取joint實際位置進行判斷

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM