public override void GestureCaptured(GestureEventArgs args) { if (args.Name.Equals("Wave")) { Console.WriteLine(args.Name + " - Confidence: " + args.Confidence); } }
/// <summary> /// Handles gesture detection results arriving from the sensor for the associated body tracking Id /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { // get the discrete gesture results which arrived with the latest frame IReadOnlyDictionary<Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { // we only have one gesture in this source object, but you can get multiple gestures foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.Name.Equals(this.waveGestureName) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { GestureEventArgs args = new GestureEventArgs(); args.Confidence = result.Confidence; args.Name = gesture.Name; // Fire off event to KinectModel if (GestureDetected != null && args != null) { GestureDetected(args); } } } } } } } }
private void NotifyGestureCaptured(GestureEventArgs args) { // put in some threshold if (args.Confidence < 0.1) return; foreach (IReceptionistView view in ActiveViews) { view.GestureCaptured(args); } }
private void detector_GestureDetected(GestureEventArgs e) { NotifyGestureCaptured(e); }
public virtual void GestureCaptured(GestureEventArgs args) { }