我正在尝试将提供kinect sdk工具的DiscreteGestureBasics项目与RecordAndPlaybackBasics结合使用。 RecordAndPlaybackBasics代码有两个主要方法播放.xef文件并记录.xef。我想阅读.xef文件并使用DiscreteGestureBasics中的代码评估手势。在DiscreteGestureBasics中,我使用RecordAndPlaybackBasics中的代码输入播放.xef文件的功能。播放文件的代码如下:
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));
}
我尝试在playbackClip函数中添加GestureDetector.cs代码(来自DiscreteGestureBasics的脚本)。我添加了一个带播放功能的按钮,因此当我按下按钮时,开始播放.xef文件。 xef正常可视化,但探测器的置信度得分始终为零。在以下来自GestureDetector.cs scirpt的代码中,discreteResults始终为null。知道这里有什么不对吗?
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.
{
}
}
}
可以在MainWindow()中找到gestureDetector的初始化:
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;
...
}
此外,当我从PlayBack函数System.Diagnostics.Process.Start("VgbView.exe");
运行VgbView.exe时,查看器通常会评估该手势。为什么在我的情况下我无法访问ContinuousGestureResults
?在周末我改变了一些东西,我在我的范围内成功(从.xef计算重复),但现在我不记得我改变了什么(并且无意中取消了改变)。为什么IReadOnlyDictionary<Gesture, ContinuousGestureResult> discreteResults = frame.ContinuousGestureResults;
Gesture和ContinuousGestureResult一直为空?我收到以下方法的每个帧的更多内容IsTrackingIdValid经常是假的。
答案 0 :(得分:-1)