Esempio n. 1
0
 //Note, this is fairly processor intensive, try to run in a background thread if possible
 internal void UpdateRecognizer(KinectSkeleton[] latestSkeletons)
 {
     if (running)
     {
         for (int s = 0; s < latestSkeletons.Length; s++)
         {
             for (int i = 0; i < masterSettings.gestureCommands.Count; i++)
             {
                 if (latestSkeletons[s].TrackingId == masterSettings.gestureCommands[i].trackedSkeleton)
                 {
                     recognizers[i].AddDataPoint(latestSkeletons[s], masterSettings.gestureCommands[i].monitoredJoint);
                     double relativeProb = recognizers[i].TestGesture(masterSettings.gestureCommands[i].sensitivity);
                     if (relativeProb < 1.0)
                     {
                         if (!inGesture[i])
                         {
                             inGesture[i] = true;
                             GestureRecognizedEventArgs args = new GestureRecognizedEventArgs();
                             args.UtcTime     = DateTime.UtcNow;
                             args.GestureName = masterSettings.gestureCommands[i].gestureName;
                             OnGestureRecognized(args);
                         }
                     }
                     else
                     {
                         if (inGesture[i])
                         {
                             inGesture[i] = false;
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 private void OnGestureRecognized(GestureRecognizedEventArgs e)
 {
     if (GestureRecognizer != null)
     {
         GestureRecognizer(this, e);
     }
 }