I am trying to combine DiscreteGestureBasics project which provided with the kinect sdk tool and with RecordAndPlaybackBasics. 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 RecordAndPlaybackBasics. The code for playback file is the following:
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));
}
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?
VisualGestureBuilderFrameReference frameReference = e.FrameReference;
using (VisualGestureBuilderFrame frame =frameReference.AcquireFrame())
{// frame return always null
if (frame != null)
{
IReadOnlyDictionary<Gesture, ContinuousGestureResult> discreteResults = frame.ContinuousGestureResults;
if (discreteResults != null) //discreteResults is always null.
{
}
}
}
The initialization of gestureDetector could be found in MainWindow():
int maxBodies = this.kinectSensor.BodyFrameSource.BodyCount;
for (int i = 0; i < 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;
...
}
Moreover when I run VgbView.exe from PlayBack function System.Diagnostics.Process.Start("VgbView.exe");
the viewer evaluate normally the gesture. Why in my case I cant access ContinuousGestureResults
? 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 IReadOnlyDictionary<Gesture, ContinuousGestureResult> discreteResults = frame.ContinuousGestureResults;
Gesture and ContinuousGestureResult is constantly null? More for every frame I am receiving the following method IsTrackingIdValid is constantly false.