title: Detect visual gestures offline from .xef files
body: <p>I am trying to combine <a href="https://github.com/EmmettTan/SquatCounter_Hackathon_Project/blob/master/DiscreteGestureBasics-WPF.csproj" rel="nofollow">DiscreteGestureBasics</a> project which provided with the kinect sdk tool and with <a href="https://github.com/angelaHillier/RecordAndPlaybackBasics-WPF" rel="nofollow">RecordAndPlaybackBasics</a>. RecordAndPlaybackBasics code has two main methods playback a .xef file and record a .xef. I want to read a .xef file and evaluate the gestures using the code from DiscreteGestureBasics. In DiscreteGestureBasics I enter functionality for playback .xef files using the code from <a href="https://github.com/angelaHillier/RecordAndPlaybackBasics-WPF" rel="nofollow">RecordAndPlaybackBasics</a>. The code for playback file is the following:</p>
  
  <pre><code> private void PlaybackClip(string filePath)
      {
          using (KStudioClient client = KStudio.CreateClient())
          {
              client.ConnectToService();         
              using (KStudioPlayback playback = client.CreatePlayback(filePath))
              {
                  playback.LoopCount = this.loopCount;
                  playback.Start();
                  while (playback.State == KStudioPlaybackState.Playing)
                  {
  
                      Thread.Sleep(100);
                  }
              }
              client.DisconnectFromService();
          }
  
          // Update the UI after the background playback task has completed
          this.isPlaying = false;
          this.Dispatcher.BeginInvoke(new NoArgDelegate(UpdateState));
      }
  </code></pre>
  
  <p>I tried to add the code of GestureDetector.cs (script from DiscreteGestureBasics) inside the playbackClip function. I add a button with the playback function thus when I press the button a .xef file is begin to play. The xef is visualised normally, however the confidence score of detector is constantly zero. In the following code from GestureDetector.cs scirpt discreteResults is always null. Any idea what could it be wrong here? </p>
  
  <pre><code>VisualGestureBuilderFrameReference frameReference = e.FrameReference;
  using (VisualGestureBuilderFrame frame =frameReference.AcquireFrame())
  {// frame return always null
   if (frame != null)
   {
      IReadOnlyDictionary&lt;Gesture, ContinuousGestureResult&gt; discreteResults = frame.ContinuousGestureResults;
      if (discreteResults != null) //discreteResults  is always null.
      {
      }
   } 
  }
  </code></pre>
  
  <p>The initialization of gestureDetector could be found in    MainWindow():</p>
  
  <pre><code>     int maxBodies = this.kinectSensor.BodyFrameSource.BodyCount;
       for (int i = 0; i &lt; maxBodies; ++i)
       {
              GestureResultView result = new GestureResultView(i, false, false, 0.0f);
              GestureDetector detector = new GestureDetector(this.kinectSensor, result);
              this.gestureDetectorList.Add(detector);
  
              ContentControl contentControl = new ContentControl();
              contentControl.Content = this.gestureDetectorList[i].GestureResultView;
      ... 
      }
  </code></pre>
  
  <p>Moreover when I run VgbView.exe from PlayBack function <code>System.Diagnostics.Process.Start("VgbView.exe");</code> the viewer evaluate normally the gesture. Why in my case I cant access <code>ContinuousGestureResults</code>? Inside weekend I change something and I succeed in my scope (in counting repetition from .xef) but now I don't remember what I have changed (and unintenionally cancel the change). Why <code>IReadOnlyDictionary&lt;Gesture, ContinuousGestureResult&gt; discreteResults = frame.ContinuousGestureResults;</code>     Gesture and ContinuousGestureResult is constantly null?   More for every frame I am receiving the following method IsTrackingIdValid is constantly false.</p>