Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
        // 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;
        }