C# 从.xef文件脱机检测视觉手势
我正在尝试将kinect sdk工具提供的项目与。RecordAndPlaybackBasics代码有两种主要方法:播放.xef文件和录制.xef。我想读取一个.xef文件,并使用DiscreteGetureBasics中的代码计算手势。在DiscreteGetureBasics中,我使用中的代码输入播放.xef文件的功能。播放文件的代码如下所示:C# 从.xef文件脱机检测视觉手势,c#,kinect,gestures,C#,Kinect,Gestures,我正在尝试将kinect sdk工具提供的项目与。RecordAndPlaybackBasics代码有两种主要方法:播放.xef文件和录制.xef。我想读取一个.xef文件,并使用DiscreteGetureBasics中的代码计算手势。在DiscreteGetureBasics中,我使用中的代码输入播放.xef文件的功能。播放文件的代码如下所示: private void PlaybackClip(string filePath) { using (KStudioCl
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(来自DiscreteGetureBasics的脚本)代码。我添加了一个带有播放功能的按钮,因此当我按下按钮时,一个.xef文件开始播放。xef正常显示,但检测器的置信度得分始终为零。在以下来自GestureDetector.cs的代码中,scirpt discreteResults始终为空。你知道这里有什么不对吗
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.
{
}
}
}
VisualGestureBuilderFrameReference=e.frameReference;
使用(VisualGestureBuilderFrame=frameReference.AcquireFrame())
{//帧返回始终为空
如果(帧!=null)
{
IReadOnlyDictionary DiscreateResults=frame.ContinuousGestureResults;
if(discreteResults!=null)//discreteResults始终为null。
{
}
}
}
可以在MainWindow()中找到gestureDetector的初始化:
int maxbody=this.kinectSensor.BodyFrameSource.BodyCount;
对于(int i=0;i
此外,当我从回放函数System.Diagnostics.Process.Start(“VgbView.exe”)运行VgbView.exe时代码>观看者正常评估手势。为什么在我的情况下,我无法访问连续手势结果
?在周末内,我改变了一些事情,并且在我的范围内成功(从.xef计算重复次数),但现在我不记得我改变了什么(并且无意中取消了改变)。为什么IReadOnlyDictionary discreteResults=frame.continuousgesturesults代码>手势和连续手势结果是否始终为空?对于我接收到的每一帧,以下方法IsTrackingIdValid始终为false。若要使用VGB,您必须具有至少包含骨架和深度信息的扩展事件文件(XEF)。有关录制和查看扩展事件文件(XEF)的信息,请参阅Kinect Studio
因此,您在记录骨架和深度信息中添加了如下内容:
KStudioEventStreamSelectorCollection streamCollection = new KStudioEventStreamSelectorCollection();
streamCollection.Add(KStudioEventStreamDataTypeIds.Depth);
streamCollection.Add(KStudioEventStreamDataTypeIds.Body);
streamCollection.Add(KStudioEventStreamDataTypeIds.BodyIndex);
是的,当然有。xef已存储。录音功能(来自RecordAndPlaybackBasics,功能强大)。我的问题是,当我播放回放文件时,我无法使用手势检测器对其进行评估。我好像得到了一个空的手势框架。xef文件中的信息很好。我认为我的问题在于trackingId特性。也许我没有正确比较trackingId。
KStudioEventStreamSelectorCollection streamCollection = new KStudioEventStreamSelectorCollection();
streamCollection.Add(KStudioEventStreamDataTypeIds.Depth);
streamCollection.Add(KStudioEventStreamDataTypeIds.Body);
streamCollection.Add(KStudioEventStreamDataTypeIds.BodyIndex);