private void Reader_FrameArrived(object sender, PreposeGestures.PreposeGesturesFrameArrivedEventArgs e) { var frame = e.FrameReference.AcquireFrame(); if (frame != null && frame.results != null) { this.FOutStatus.AssignFrom(frame.results); } }
void myBodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e) { if (this.IsPaused) { return; } PreposeGesturesFrame retFrame = null; PreposeGesturesFrameArrivedEventArgs upArgs = new PreposeGesturesFrameArrivedEventArgs(); using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame()) { if (bodyFrame != null) { // Perform the gesture matching on this frame var z3body = new Z3Body(); bodyFrame.GetAndRefreshBodyData(this.bodies); foreach (var body in this.bodies) { if (body.TrackingId == this.mySource.TrackingId) { // We are at the correct body - go ahead and feed it to the BodyMatcher IReadOnlyDictionary <Microsoft.Kinect.JointType, Joint> joints = body.Joints; z3body = Z3KinectConverter.CreateZ3Body(joints); var result = this.PreposeGesturesFrameSource.myMatcher.TestBody(z3body); // Fill in the gesture results for this frame retFrame = new PreposeGesturesFrame(); retFrame.results = result; break; } } } } // TODO: revisit the way the PreposeGesturesFrameReference is implemented to avoid keeping around massive amounts of frames PreposeGesturesFrameReference retFrameReference = new PreposeGesturesFrameReference(retFrame); upArgs.FrameReference = retFrameReference; // Signal that we have a new PreposeGesturesFrame arrived FrameArrived(this, upArgs); }
void pgr_FrameArrived(object sender, PreposeGesturesFrameArrivedEventArgs e) { using (var frame = e.FrameReference.AcquireFrame()) { if (frame != null) { //This check is almost certainly not needed for this sample, left in for debugging help if (pgfs.IsTrackingIdValid) { DiscreteGestureResult result = (DiscreteGestureResult)frame.GetDiscreteGestureResult(gesture); //If it is detected, and it this this gesture was not detected on the last frame, then call the gesture as hit //If you didn't require "FirstFrameDetected" every frame for the gesture would count as a unique instance //This case just uses "Detected" as a bool, we could tune our detection threshold by using result.Confidence and set our own min value if (result.Detected == true && result.FirstFrameDetected) { Console.WriteLine("Gesture detected!"); } } } } }
void myBodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e) { if (this.IsPaused) return; PreposeGesturesFrame retFrame = null; PreposeGesturesFrameArrivedEventArgs upArgs = new PreposeGesturesFrameArrivedEventArgs(); using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame()) { if (bodyFrame != null) { // Perform the gesture matching on this frame var z3body = new Z3Body(); bodyFrame.GetAndRefreshBodyData(this.bodies); foreach (var body in this.bodies) { if (body.TrackingId == this.mySource.TrackingId) { // We are at the correct body - go ahead and feed it to the BodyMatcher IReadOnlyDictionary<Microsoft.Kinect.JointType, Joint> joints = body.Joints; z3body = Z3KinectConverter.CreateZ3Body(joints); var result = this.PreposeGesturesFrameSource.myMatcher.TestBody(z3body); // Fill in the gesture results for this frame retFrame = new PreposeGesturesFrame(result, this.mySource, body.TrackingId, bodyFrame.RelativeTime); break; } } } } // TODO: revisit the way the PreposeGesturesFrameReference is implemented to avoid keeping around massive amounts of frames PreposeGesturesFrameReference retFrameReference = new PreposeGesturesFrameReference(retFrame); upArgs.FrameReference = retFrameReference; // Signal that we have a new PreposeGesturesFrame arrived FrameArrived(this, upArgs); }