public GestureEventArgs(string gestureName, bool isBodyTrackingIdValid, bool isGestureDetected, float detectionConfidence, GestureDetector detector = null) { this.GestureName = gestureName; this.IsBodyTrackingIdValid = isBodyTrackingIdValid; this.IsGestureDetected = isGestureDetected; this.DetectionConfidence = detectionConfidence; this.Detector = detector; }
// Use this for initialization private void Start() { // check if (string.IsNullOrEmpty(m_VGBDatabaseFilename)) { Debug.LogError("The VGBDatabaseFilename is null or empty."); return; } // 获得kinect设备对象 m_Sensor = KinectSensor.GetDefault(); // if (m_Sensor == null) { Debug.LogError("There is not Kinect Device."); return; } int nBodyCount = m_Sensor.BodyFrameSource.BodyCount; for (int i = 0; i < nBodyCount; ++i) { GestureDetector detector = new GestureDetector(m_Sensor, m_VGBDatabaseFilename); detector.OnGesture += this.OnGestureInLocal; m_GestureDetectorList.Add(detector); } // 加载手势特征库 var databasePath = Path.Combine(Application.streamingAssetsPath, m_VGBDatabaseFilename); using (VisualGestureBuilderDatabase database = VisualGestureBuilderDatabase.Create( databasePath )) { List<string> names = new List<string>(); foreach (Gesture gesture in database.AvailableGestures) { names.Add(gesture.Name); } m_GestureNames = names.ToArray(); } // m_bInit = true; }