/// <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) { float highScore = 0; 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.seatedGestureName) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { // update the GestureResultView object with new gesture result values this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); highScore = result.Confidence > highScore ? result.Confidence : highScore; } } } } } } tracker.addConfidenceID(highScore, this.vgbFrameSource.TrackingId); }
// Handles gesture detection results arriving from the sensor for the associated body tracking Id 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.gestureName) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { /**********************************************************************************************/ //Cuando el gesto es reconocido reproduce el sonido this.ReproducirSonido(result.Detected, result.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 var 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.GestureClapping) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (this.OnGestureDetected != null) { this.OnGestureDetected(this, new GestureEventArgs(true, result.Detected, result.Confidence, this.GestureClapping)); } } } if (gesture.Name.Equals(this.GestureHandShake_Right) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (this.OnGestureDetected != null) { this.OnGestureDetected(this, new GestureEventArgs(true, result.Detected, result.Confidence, this.GestureHandShake_Right)); } } } if (gesture.Name.Equals(this.GestureLeftRotation_Right) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (this.OnGestureDetected != null) { this.OnGestureDetected(this, new GestureEventArgs(true, result.Detected, result.Confidence, this.GestureHandShake_Right)); } } } } } } } }
/// <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) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (result.Confidence > 0 && gesture.GestureType == GestureType.Discrete) //gesture.Name.Equals(this.crossedArms) { // System.Diagnostics.Debug.WriteLine(vgbFrameSource.TrackingId); // update the GestureResultView object with new gesture result values this.GestureResultView.UpdateGestureResult(gesture.Name, true, result.Detected, result.Confidence); } if (result.Confidence < 0.15) { this.GestureResultView.UpdateGestureResult(gesture.Name, true, result.Detected, 0); } } } } } } }
private void Reader_GestureFrameArrived_Continuous(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { // get the continuous gesture results which arrived with the latest frame var continuousResults = frame.ContinuousGestureResults; if (continuousResults != 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.gestureName) && gesture.GestureType == GestureType.Continuous) { ContinuousGestureResult result = null; continuousResults.TryGetValue(gesture, out result); if (result != null) { if (this.OnGestureDetected != null) { this.OnGestureDetected(this, new GestureEventArgs(true, result.Progress <= 0.01, result.Progress)); } } } } } } } }
/// <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) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.Name.Equals(this.alertGestureTitle) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { // update the GestureResultView object with new gesture result values this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); } } } } } } }
private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; IReadOnlyDictionary <Gesture, ContinuousGestureResult> continuousResults = frame.ContinuousGestureResults; if (discreteResults != null) { DiscreteGestureResult SwipeFromLeftResult = null; DiscreteGestureResult SwipeFromRightResult = null; DiscreteGestureResult ZoomOutResult = null; discreteResults.TryGetValue(ZoomOut, out ZoomOutResult); discreteResults.TryGetValue(RightToLeft, out SwipeFromRightResult); discreteResults.TryGetValue(LeftToRight, out SwipeFromLeftResult); if (EnableSwipe && SwipeFromRightResult != null && SwipeFromRightResult.Detected && SwipeFromRightResult.Confidence > 0.35) { Trace.WriteLine("Swipe from right"); OnSwipe(GestureType.RightToLeft); EnableSwipe = false; ResetSwipe(gestureResetTime); } if (EnableSwipe && SwipeFromLeftResult != null && SwipeFromLeftResult.Detected && SwipeFromLeftResult.Confidence > 0.35) { Trace.WriteLine("swipe from left"); OnSwipe(GestureType.LeftToRight); EnableSwipe = false; ResetSwipe(gestureResetTime); } if (EnableZoom && ZoomOutResult != null && ZoomOutResult.Detected && ZoomOutResult.Confidence > 0.5) { OnZoomOut(); } } if (continuousResults != null) { ContinuousGestureResult ClapResult = null; continuousResults.TryGetValue(clapGesture, out ClapResult); if (EnableClap && ClapResult != null) { float clapProg = ClapResult.Progress; if (clapProg > 1.85 && clapProg < 3) { Trace.WriteLine("Clap detected"); EnableClap = false; ResetClap(gestureResetTime); } } } } } }
/// <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.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (gesture.Name.Equals(this.ASLStandGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } else if (gesture.Name.Equals(this.ASLWalkGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } else if (gesture.Name.Equals(this.ASLTurnLeftGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } else if (gesture.Name.Equals(this.ASLTurnRightGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } else if (gesture.Name.Equals(this.ASLTurnLeftGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } else if (gesture.Name.Equals(this.ASLSitGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } else if (gesture.Name.Equals(this.ASLStopGestureName)) { GestureResultView.UpdateGestureResult(true, gesture.Name, result.Detected, result.Confidence); } } } } } } } }
/// Handles gesture detection results arriving from the sensor for the associated body tracking Id protected virtual void 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 IDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in _Source.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { // Fire Event if (result.Detected) { //Debug.Log("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence); if (result.Confidence >= MinConfidence) { DetectedConfidence = result.Confidence; this.CurrentGestureName = gesture.Name; DetectedWork(); OnGesture(new EventArgs(gesture.Name, result.Confidence)); } else { this.CurrentGestureName = string.Empty; this.DetectedConfidence = 0.0f; } } else { this.CurrentGestureName = string.Empty; this.DetectedConfidence = 0.0f; NotDetectedWork(); } // OnGesture(new EventArgs(gesture.Name, result.Confidence)); // } } } } } } }
void vgbFrameReader_FrameArrived(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) { int i = 0; // we only have one gesture in this source object, but you can get multiple gestures foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { this.gesturedetected[i] = result.Detected; this.gestureconfidence[i] = result.Confidence; } } i++; } } IReadOnlyDictionary <Gesture, ContinuousGestureResult> continuousResults = frame.ContinuousGestureResults; if (continuousResults != null) { int i = 0; // we only have one gesture in this source object, but you can get multiple gestures foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Continuous) { ContinuousGestureResult result = null; continuousResults.TryGetValue(gesture, out result); if (result != null) { this.gestureprogress[i] = result.Progress; } } i++; } } } } }
/// <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) { Gesture localGesture = null; 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) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (result.Detected) { localGesture = gesture; } // update the GestureResultView object with new gesture result values //this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); } } } } } if (currentWantedGesture == gestureNames.Length) { OnGestureFired?.Invoke(); currentWantedGesture = 0; lastGesture = null; return; } if (gestureNames[currentWantedGesture] == localGesture?.Name) { lastGesture = localGesture; lastCoolGesture = DateTime.UtcNow; currentWantedGesture++; return; } if (lastGesture != null && DateTime.UtcNow - lastCoolGesture > TimeSpan.FromSeconds(5)) { currentWantedGesture = 0; lastGesture = null; } }
private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; lock (GestureResults) { using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { GestureResult gr = GestureResults.FirstOrDefault(n => n.Name == gesture.Name); gr.UpdateGestureResult(gesture.Name, true, result.Detected, result.Confidence); } } } } IReadOnlyDictionary <Gesture, ContinuousGestureResult> continuousResults = frame.ContinuousGestureResults; if (continuousResults != null) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Continuous) { ContinuousGestureResult result = null; continuousResults.TryGetValue(gesture, out result); if (result != null) { GestureResult gr = GestureResults.FirstOrDefault(n => n.Name == gesture.Name); gr.UpdateGestureResult(gesture.Name, true, true, result.Progress); } } } } } } } }
/// <summary> /// This function reads every input frame from Kinect using VisualGestureBuilder API /// A valid frame is stored in an array as soon as it is received /// recordbodydata is a flag that is a boundary condition to record the coordinates to know about the status of last detected frame. /// The 'result' is set to true when gesture received from frame matches either start or end position of gestures /// The function passes to DTW for sequence matching when the start and end position are of same gesture. /// </summary> private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); } try { //conditional statement to record body data if (RECORD_BODY_DATA == RECORD && result.Detected == false) { storebodycoordinates();//stores current frame } else if (result != null && result.Detected == true && result.Confidence >= 0.6) { if (KINECT_COORDINATES.Length != 0) { string result_gesture = passToDTW(); RECORD_BODY_DATA = EMPTY; break; } RECORD_BODY_DATA = RECORD; } } catch (Exception ex) { //do nothing } } } } } } }
/// <summary> /// This function reads every input frame from Kinect using VisualGestureBuilder API /// A valid frame is stored in an array as soon as it is received /// recordbodydata is a flag that is a boundary condition to record the coordinates to know about the status of last detected frame. /// The 'result' is set to true when gesture received from frame matches either start or end position of gestures /// The function passes to DTW for sequence matching when the start and end position are of same gesture. /// </summary> private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); } try { if (lastdetected == 1 && result.Detected == false) { storebodycoordinates(); } else if (result != null && result.Detected == true && result.Confidence >= 0.6) { if (KINECT_COORDINATES.Length != 0 && lastcountdetected == 0) { SaveToFile(KINECT_COORDINATES); lastdetected = 0; lastcountdetected = 1; break; } lastdetected = 1; } } catch (Exception ex) { } } } } } } }
private void gestureFrameReader_FrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null && waitingForOp()) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in this.gestureFrameSource.Gestures) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null && result.Detected) { switch (gesture.Name) { case "Plus": if (result.Confidence > 0.8) { AddOperator("+"); } break; case "Minus": if (result.Confidence > 0.95) { AddOperator("-"); } break; case "Times": if (result.Confidence > 0.90) { AddOperator("*"); } break; case "divide": if (result.Confidence > 0.90) { AddOperator("/"); } break; } } } } } } }
void _gestureFrameReader_FrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null && frame.DiscreteGestureResults != null) { if (AttachedObject == null) { return; } DiscreteGestureResult result = null; if (frame.DiscreteGestureResults.Count > 0) { result = frame.DiscreteGestureResults[_salute]; } if (result == null) { return; } if (result.Detected == true) { var progressResult = frame.ContinuousGestureResults[_saluteProgress]; if (AttachedObject != null) { var prog = progressResult.Progress; float scale = 0.5f + prog * 3.0f; AttachedObject.transform.localScale = new Vector3(scale, scale, scale); if (_ps != null) { _ps.emissionRate = 100 * prog; _ps.startColor = Color.red; } } } else { if (_ps != null) { _ps.emissionRate = 4; _ps.startColor = Color.blue; } } } } }
/// <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) { this.num_gestures_detected = 0; 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.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { // update the GestureResultView object with new gesture result values this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence, this.num_frames, this.num_frames_touchingface, this.num_frames_leaning); this.num_frames++; if (result.Detected && result.Confidence > .3) { this.num_gestures_detected++; if (gesture.Name == "TouchingFace") { this.num_frames_touchingface++; } if (gesture.Name == "Leaning") { this.num_frames_leaning++; } } } } } } } } // make call to change background with num_detected as a parameter }
/// Handles gesture detection results arriving from the sensor for the associated body tracking Id private void 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 IDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { List <EventArgs> Results = new List <EventArgs>(); foreach (Gesture gesture in _Source.Gestures) { //Debug.Log(gesture.Name); //Debug.Log(gesture.GestureType); if (gesture.GestureType == GestureType.Discrete) //离散型 { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (IsDetected(Priority[gesture.Name], result.Confidence)) //该动作是否完成 { Results.Add(new EventArgs(gesture.Name, result.Confidence)); //完成则加入判断列表 //Debug.Log("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence); // Fire Event //OnGesture(new EventArgs(gesture.Name, result.Confidence)); //return; } } } } EventArgs Result = GestureJudgement(Results); Debug.Log("Detected Gesture " + Result.name + " with Confidence " + Result.confidence.ToString()); OnGesture(Result); } } //OnGesture(new EventArgs("NO-Gesture", 0)); } }
void _gestureFrameReader_FrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null && frame.DiscreteGestureResults != null) { gesture1 = gesture2 = gesture3 = gesture4 = null; gesture1 = frame.DiscreteGestureResults[_gesture1]; gesture2 = frame.DiscreteGestureResults[_gesture2]; Do_things(frame); } } }
/// <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; IReadOnlyDictionary <Gesture, ContinuousGestureResult> continuousResults = frame.ContinuousGestureResults; if (continuousResults != 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.seatedGestureName) && gesture.GestureType == GestureType.Continuous) { ContinuousGestureResult result = null; continuousResults.TryGetValue(gesture, out result); if (result != null) { // update the GestureResultView object with new gesture result values // this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); var progress = result.Progress; if (progress > 1.48 && progress < 3) { //we're clapping but not finished this.GestureResultView.UpdateGestureResult(true, true, 1.0f); } else { this.GestureResultView.UpdateGestureResult(true, false, 1.0f); } } } } } } } }
/// <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.seatedGestureName) && gesture.GestureType == GestureType.Discrete) //{ // DiscreteGestureResult result = null; // discreteResults.TryGetValue(gesture, out result); // if (result != null) // { // // update the GestureResultView object with new gesture result values // this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); // } //} if (gesture.Name.Equals(this.handsAboveHeadGestureName) && gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null && result.Detected) { // update the GestureResultView object with new gesture result values this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); } } } } } } }
void _gestureFrameReader_FrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null && frame.DiscreteGestureResults != null) { result = frame.DiscreteGestureResults [wavehand_right]; } if (result == null) { return; } if (result.Detected == true && result.Confidence > 0.95) { } } }
/// <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.SkipSongLeft) || gesture.Name.Equals(this.SkipSongRight)) && gesture.GestureType == GestureType.Discrete) { //Left Arm Next song FALSE Right Arm Previous Song TRUE if (gesture.Name.Equals(this.SkipSongLeft)) { skipSong = false; } else { skipSong = true; } DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { // update the GestureResultView object with new gesture result values this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); this.vgbFrameReader.IsPaused = this.GestureResultView.GestureResponse(true, result.Detected, result.Confidence, skipSong); this.vgbFrameReader.IsPaused = false; } } } } } } }
//check result private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in this.vgbFrameSource.Gestures) { if (gesture.Name.Equals("Hamza") || gesture.Name.Equals("followGest2") || gesture.Name.Equals("syncGest") || gesture.Name.Equals("comeGesture")) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { this.GestureResultView.UpdateGestureResult(true, result.Detected, result.Confidence); if (result.Detected) { if (gesture.Name == "followGest2" && followSp[0]) { printNew = "follow max speech & gesture"; if (printNew != printOld) { Console.WriteLine(printNew); } printOld = printNew; } } } } } } } } }
/// Handles gesture detection results arriving from the sensor for the associated body tracking Id private void 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 IDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { foreach (Gesture gesture in _Source.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); // if (gesture.Name == "recognize") { // Debug.Log ("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence); // } // Fire Event // Debug.Log ("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence); if (OnGesture != null) { KinectGestureEvent eventData = new KinectGestureEvent(gesture.Name, result.Confidence); if (gesture.Name.Equals("recognize")) { eventData.addOpt("BodyId", _Source.TrackingId.ToString()); } OnGesture(this, eventData); } else { Debug.LogError("On Gesture is null"); } } } } } } }
/// <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.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (result.Detected) { gestureReceived = true; var arguments = new ChangedEventArgs(); arguments.gestureName = gesture.Name; OnGestureDetected(arguments); } } else { gestureReceived = false; } } } } } } }
/// <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); } } } } } } } }
/// <summary> /// Callback when posture is detected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Reader_GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { Dictionary <string, float> gestures = new Dictionary <string, float>(); MainWindow.persons[index].postures.Clear(); foreach (Gesture gesture in vgbFrameSource.Gestures) { if (gesture.GestureType == GestureType.Discrete) { DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null) { if (result.Detected) { gestures.Add(gesture.Name, result.Confidence); MainWindow.persons[index].postures.AddLast(new Posture(gesture.Name)); } } } } //Plot.DrawGesturesOnCanvas(MainWindow.persons[index], gestures, canvas); } } } }
private void OnGestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { if (frame != null) { IReadOnlyDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; IReadOnlyDictionary <Gesture, ContinuousGestureResult> continuousResults = frame.ContinuousGestureResults; if (discreteResults != null) { DiscreteGestureResult crossResult = null; discreteResults.TryGetValue(GesturesDictionary["Cross"], out crossResult); // Cross detection if (crossResult.Detected && crossResult.Confidence > CONFIDENCE_THRESHOLD && !CrossDetected) { CrossDetected = true; Console.WriteLine("Cross"); ApplicationService.Instance.Cross(); CrossDetectedInRow = CROSS_DETECTION_THRESHOLD; } else if (!crossResult.Detected) { if (CrossDetectedInRow == 0) { CrossDetected = false; } else { CrossDetectedInRow--; } } } } } }
/// Handles gesture detection results arriving from the sensor for the associated body tracking Id public void GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e) { //Debug.Log("GestureFrameArrived CALLED!"); VisualGestureBuilderFrameReference frameReference = e.FrameReference; using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) { //Debug.Log("frame: "+ frame); if (frame != null) { //Debug.Log("frame != null"); // get the discrete gesture results which arrived with the latest frame IDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults; if (discreteResults != null) { //Debug.Log("discreteResults != null"); foreach (Gesture gesture in _Source.Gestures) { if (gesture.GestureType == GestureType.Discrete) { //Debug.Log("G:" + gesture.Name); DiscreteGestureResult result = null; discreteResults.TryGetValue(gesture, out result); if (result != null && (result.Confidence > 0)) { // Fire Event //OnGesture(new EventArgs(gesture.Name, result.Confidence)); //Debug.Log("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence); //scoreValue = result.Confidence * 100; //Scoreup.score += scoreValue; //Debug.Log("SCORE:" + Scoreup.score); //scoreValue += result.Confidence*100; //text.text = "SCORE: " + scoreValue; //nameGesture = gesture.Name; //check = result.Confidence; //////////////////////////////////////////////// INTRO SET if (((getTimer.timer <= 0.831995) || (getTimer.timer > 2.197324 && getTimer.timer <= 3.370658) || (getTimer.timer > 4.053311 && getTimer.timer <= 5.077324) || (getTimer.timer > 6.527982 && getTimer.timer <= 7.274649)) && (gesture.Name.Equals("Intro_Left"))) { Debug.Log("TIME SET 1.1:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 0.831995 && getTimer.timer <= 2.197324) || (getTimer.timer > 3.370658 && getTimer.timer <= 4.053311) || (getTimer.timer > 5.077324 && getTimer.timer <= 6.527982) || (getTimer.timer > 7.274649 && getTimer.timer <= 8.405329)) && (gesture.Name.Equals("Intro_Right"))) { Debug.Log("TIME SET 1.2:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Onigiri SET else if (((getTimer.timer > 8.405329 && getTimer.timer <= 10.60265) || (getTimer.timer > 12.65066 && getTimer.timer <= 14.52798) || (getTimer.timer > 270.784 && getTimer.timer <= 272.6187) || (getTimer.timer > 274.9653 && getTimer.timer <= 275.2)) && (gesture.Name.Equals("Onigiri_Left"))) { Debug.Log("TIME SET 2.1:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 10.60265 && getTimer.timer <= 12.65066) || (getTimer.timer > 14.52798 && getTimer.timer <= 16.44798) || (getTimer.timer > 273.0453 && getTimer.timer <= 274.496)) && (gesture.Name.Equals("Onigiri_Right"))) { Debug.Log("TIME SET 2.2:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Move_on SET else if (((getTimer.timer > 16.44798 && getTimer.timer <= 17.94131) || (getTimer.timer > 19.86131 && getTimer.timer <= 21.75998)) && (gesture.Name.Equals("Move_on_Left"))) { Debug.Log("TIME SET 3.1:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 17.94131 && getTimer.timer <= 19.86131) || (getTimer.timer > 21.75998 && getTimer.timer <= 23.57331)) && (gesture.Name.Equals("Move_on_Right"))) { Debug.Log("TIME SET 3.2:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// SLOT01 else if ((getTimer.timer > 25.856 && getTimer.timer <= 26.26131) && (gesture.Name.Equals("Naja"))) { Debug.Log("TIME SET 4:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if ((getTimer.timer > 27.43465 && getTimer.timer <= 28.20265) || (getTimer.timer > 47.061 && getTimer.timer <= 47.744) && (gesture.Name.Equals("Bangloey"))) { Debug.Log("TIME SET 5:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 29.65331 && getTimer.timer <= 30.20798) || (getTimer.timer > 129.7707 && getTimer.timer <= 130.368)) && (gesture.Name.Equals("Nidnid"))) { Debug.Log("TIME SET 6:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 31.27465 && getTimer.timer <= 31.91465) || (getTimer.timer > 41.451 && getTimer.timer <= 42.027) || (getTimer.timer > 131.84 && getTimer.timer <= 132.5013) || (getTimer.timer > 135.467 && getTimer.timer <= 136.384)) && (gesture.Name.Equals("ChoeyMoey"))) { Debug.Log("TIME SET 7:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// TakeUpArm else if (((getTimer.timer > 32.61866 && getTimer.timer <= 33.92) || (getTimer.timer > 48.40533 && getTimer.timer <= 49.856) || (getTimer.timer > 137.8773 && getTimer.timer <= 138.432)) && (gesture.Name.Equals("TakeUpArm_Right"))) { Debug.Log("TIME SET 8.1:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 34.666 && getTimer.timer <= 35.75465) || (getTimer.timer > 50.432 && getTimer.timer <= 51.41331)) || (getTimer.timer > 139.1147 && getTimer.timer <= 140.012) && (gesture.Name.Equals("TakeUpArm_Left"))) { Debug.Log("TIME SET 8.2:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// DrawBigHeart else if (((getTimer.timer > 36.523 && getTimer.timer <= 38.016) || (getTimer.timer > 51.947 && getTimer.timer <= 53.76) || (getTimer.timer > 140.48 && getTimer.timer <= 142.0373)) && (gesture.Name.Equals("DrawBigHeart"))) { Debug.Log("TIME SET 9:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Yeah else if (((getTimer.timer > 38.571 && getTimer.timer <= 39.829) || (getTimer.timer > 54.29331 && getTimer.timer <= 55.70132) || (getTimer.timer > 142.4213 && getTimer.timer <= 144.1707)) && (gesture.Name.Equals("Yeah"))) { Debug.Log("TIME SET 10:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// TourPai else if ((getTimer.timer > 43.371 && getTimer.timer <= 43.733) && (gesture.Name.Equals("TourPai"))) { Debug.Log("TIME SET 11:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Tummada else if ((getTimer.timer > 45.291 && getTimer.timer <= 45.89) && (gesture.Name.Equals("Tummada"))) { Debug.Log("TIME SET 12:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Move_down else if (((getTimer.timer > 56.68265 && getTimer.timer <= 56.87465) || (getTimer.timer > 58.091 && getTimer.timer <= 60.07465) || (getTimer.timer > 61.376 && getTimer.timer <= 61.67465) || (getTimer.timer > 64.555 && getTimer.timer <= 64.91733) || (getTimer.timer > 69.184 && getTimer.timer <= 69.78132) || (getTimer.timer > 144.7466 && getTimer.timer <= 145.3013) || (getTimer.timer > 146.9866 && getTimer.timer <= 148.416) || (getTimer.timer > 149.7387 && getTimer.timer <= 150.1866) || (getTimer.timer > 152.7253 && getTimer.timer <= 153.152) || (getTimer.timer > 157.76 && getTimer.timer <= 158.2933)) && (gesture.Name.Equals("Move_down_Left"))) { Debug.Log("TIME SET 13.1:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 57.344 && getTimer.timer <= 57.68533) || (getTimer.timer > 60.75732 && getTimer.timer <= 61.184) || (getTimer.timer > 62.08 && getTimer.timer <= 64.043) || (getTimer.timer > 65.23733 && getTimer.timer <= 65.51465) || (getTimer.timer > 68.224 && getTimer.timer <= 68.672) || (getTimer.timer > 145.8347 && getTimer.timer <= 146.4533) || (getTimer.timer > 148.7146 && getTimer.timer <= 149.2693) || (getTimer.timer > 150.6773 && getTimer.timer <= 152.2987) || (getTimer.timer > 153.8133 && getTimer.timer <= 154.2827) || (getTimer.timer > 156.8 && getTimer.timer <= 157.248)) && (gesture.Name.Equals("Move_down_Right"))) { Debug.Log("TIME SET 13.2:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// DownLeg else if (((getTimer.timer > 65.77066 && getTimer.timer <= 67.776) || (getTimer.timer > 69.952 && getTimer.timer <= 71.403) || (getTimer.timer > 154.752 && getTimer.timer <= 156.352) || (getTimer.timer > 158.7413 && getTimer.timer <= 160.0426)) && (gesture.Name.Equals("Down_leg"))) { Debug.Log("TIME SET 14:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// LoveorNot else if (((getTimer.timer > 72.91773 && getTimer.timer <= 73.49331) || (getTimer.timer > 74.667 && getTimer.timer <= 75.477) || (getTimer.timer > 161.1946 && getTimer.timer <= 161.856) || (getTimer.timer > 163.1147 && getTimer.timer <= 163.904)) && (gesture.Name.Equals("LoveorNot"))) { Debug.Log("TIME SET 15:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Come_on else if (((getTimer.timer > 75.92533 && getTimer.timer <= 77.93066) || (getTimer.timer > 164.5013 && getTimer.timer <= 166.4) || (getTimer.timer > 223.488 && getTimer.timer <= 225.4933)) && (gesture.Name.Equals("ComeOn"))) { Debug.Log("TIME SET 16:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// LetsCookie else if (((getTimer.timer > 78.61331 && getTimer.timer <= 79.7227) || (getTimer.timer > 167.168 && getTimer.timer <= 168.0853) || (getTimer.timer > 226.3893 && getTimer.timer <= 227.2213)) && (gesture.Name.Equals("LetsCookie"))) { Debug.Log("TIME SET 17:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Koisuru else if (((getTimer.timer > 80.10664 && getTimer.timer <= 80.64) || (getTimer.timer > 167.168 && getTimer.timer <= 168.0853) || (getTimer.timer > 168.6613 && getTimer.timer <= 169.0027) || (getTimer.timer > 184.2346 && getTimer.timer <= 184.832) || (getTimer.timer > 227.584 && getTimer.timer <= 228.1387) || (getTimer.timer > 243.115 && getTimer.timer <= 243.5413)) && (gesture.Name.Equals("Koisuru_Right"))) { Debug.Log("TIME SET 18:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 80.87465 && getTimer.timer <= 81.451) || (getTimer.timer > 95.53065 && getTimer.timer <= 96.04266) || (getTimer.timer > 169.344 && getTimer.timer <= 169.728) || (getTimer.timer > 185.2373 && getTimer.timer <= 185.792) || (getTimer.timer > 228.288 && getTimer.timer <= 228.9492) || (getTimer.timer > 244.0533 && getTimer.timer <= 244.6507)) && (gesture.Name.Equals("Koisuru_Left"))) { Debug.Log("TIME SET 18:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// FortuneCookies else if (((getTimer.timer > 81.92 && getTimer.timer <= 83.62664) || (getTimer.timer > 96.34132 && getTimer.timer <= 97.088) || (getTimer.timer > 170.1973 && getTimer.timer <= 171.84) || (getTimer.timer > 185.8347 && getTimer.timer <= 187.5627) || (getTimer.timer > 229.3546 && getTimer.timer <= 231.0613) || (getTimer.timer > 245.1413 && getTimer.timer <= 245.7413)) && (gesture.Name.Equals("FurtuneCookies"))) { Debug.Log("TIME SET 19:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// LetsWish else if (((getTimer.timer > 83.968 && getTimer.timer <= 84.459) || (getTimer.timer > 172.2453 && getTimer.timer <= 172.928) || (getTimer.timer > 231.4026 && getTimer.timer <= 232) || (getTimer.timer > 247.3173 && getTimer.timer <= 247.744)) && (gesture.Name.Equals("LetsWish_Right"))) { Debug.Log("TIME SET 20.1:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 84.62932 && getTimer.timer <= 85.119) || (getTimer.timer > 173.248 && getTimer.timer <= 173.8027) || (getTimer.timer > 232.3627 && getTimer.timer <= 232.8746) || (getTimer.timer > 248.128 && getTimer.timer <= 248.4693)) && (gesture.Name.Equals("LetsWish_Left"))) { Debug.Log("TIME SET 20.2:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// HenWing else if (((getTimer.timer > 85.52533 && getTimer.timer <= 87.38132) || (getTimer.timer > 100.0746 && getTimer.timer <= 103.2107) || (getTimer.timer > 174.2933 && getTimer.timer <= 176.864) || (getTimer.timer > 189.867 && getTimer.timer <= 191.808) || (getTimer.timer > 233.28 && getTimer.timer <= 235.008) || (getTimer.timer > 249.0453 && getTimer.timer <= 250.752)) && (gesture.Name.Equals("HenWing"))) { Debug.Log("TIME SET 21:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// HeyHey else if (((getTimer.timer > 88.08533 && getTimer.timer <= 93.056) || (getTimer.timer > 104.1065 && getTimer.timer <= 108.6933) || (getTimer.timer > 176.6613 && getTimer.timer <= 181.184) || (getTimer.timer > 192.512 && getTimer.timer <= 197.3973) || (getTimer.timer > 235.84 && getTimer.timer <= 240.6187) || (getTimer.timer > 251.4987 && getTimer.timer <= 256.32)) && (gesture.Name.Equals("Heyhey"))) { Debug.Log("TIME SET 22:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Clap else if (((getTimer.timer > 112.2987 && getTimer.timer <= 113.1307) || (getTimer.timer > 116.267 && getTimer.timer <= 116.928) || (getTimer.timer > 120.2987 && getTimer.timer <= 120.7893) || (getTimer.timer > 200.8746 && getTimer.timer <= 201.5573) || (getTimer.timer > 204.8213 && getTimer.timer <= 205.3546) || (getTimer.timer > 208.8746 && getTimer.timer <= 209.472) || (getTimer.timer > 259.8613 && getTimer.timer <= 260.5226) || (getTimer.timer > 263.8933 && getTimer.timer <= 264.4266) || (getTimer.timer > 267.776 && getTimer.timer <= 268.3733)) && (gesture.Name.Equals("Clap"))) { Debug.Log("TIME SET 23:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Up_down else if (((getTimer.timer > 121.5573 && getTimer.timer <= 128.0213) || (getTimer.timer > 210.0907 && getTimer.timer <= 215.1253)) && (gesture.Name.Equals("Up_down"))) { Debug.Log("TIME SET 24:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Hairoo else if ((getTimer.timer > 133.6747 && getTimer.timer <= 134.2507) && (gesture.Name.Equals("Hairoo"))) { Debug.Log("TIME SET 25:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Rotate else if ((getTimer.timer > 268.6507 && getTimer.timer <= 270.528) && (gesture.Name.Equals("Rotate"))) { Debug.Log("TIME SET 26:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// End else if ((getTimer.timer > 276.8427 && getTimer.timer <= 280.448) && (gesture.Name.Equals("End"))) { Debug.Log("TIME SET 27:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Point else if (((getTimer.timer > 216.6187 && getTimer.timer <= 217.4507) || (getTimer.timer > 218.88 && getTimer.timer <= 219.3493)) && (gesture.Name.Equals("Point_Left"))) { Debug.Log("TIME SET 28:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } else if (((getTimer.timer > 215.616 && getTimer.timer <= 216.32) || (getTimer.timer > 218.048 && getTimer.timer <= 218.5173)) && (gesture.Name.Equals("Point_Right"))) { Debug.Log("TIME SET 28:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } //////////////////////////////////////////////// Side else if ((getTimer.timer > 220.3847 && getTimer.timer <= 223.3173) && (gesture.Name.Equals("Side"))) { Debug.Log("TIME SET 29:" + getTimer.timer + "Confidence :" + result.Confidence); scoreValue = result.Confidence * 100; } ///////// CONDITION ITEM if (scoreValue >= 20) { countCombo++; Debug.Log("COMBO ::::: " + countCombo); if (countCombo >= 2 && countCombo < 4) { itemx2 = true; scoreValue *= 2; //Debug.Log("COMBO COMBO COMBO COMBO COMBO AND scoreValue ="+ scoreValue); } else if (countCombo >= 4) { //Debug.Log("BONUS TIME BONUS TIME BONUS TIME BONUS TIME BONUS TIME BONUS TIME"); timeTemp = getTimer.timer + 10; itemTime = true; } } else if (scoreValue < 10) { itemx2 = false; countCombo = 0; //Debug.Log("NO COMBO NO COMBO NO COMBO NO COMBO NO COMBO"); } else if (getTimeout.timeout == false) { //Debug.Log("BONUS TIME *** BONUS TIME *** BONUS TIME *** BONUS TIME *** BONUS TIME *** BONUS TIME "); } else if (getTimeout.timeout == true) { //Debug.Log("OUT BONUS TIME *** OUT BONUS TIME *** OUT BONUS TIME *** OUT BONUS TIME *** OUT BONUS TIME *** OUT BONUS TIME "); timeTemp = 0; } Scoreup.score += scoreValue; scoreValue = 0; Debug.Log("SCORE:" + Scoreup.score); if (getTimer.timer > 5) { Debug.Log("********** 5 SECONDS**********"); loadScene = true; } } else { //Debug.Log("result is NULL:"+result); } } } } } } }