我正在關注來自kinect工具包的代碼以記錄和重放幀,我知道問題是它永遠不會識別新的replay_SkeletonFrameReady,因此我無法繪製我記錄的骨架。請注意,我讀取的文件中確實有數據(也通過kinect toolkit方法保存了數據)。KinectReplay類的SkeletonFrameReady事件處理程序不執行
void replay_SkeletonFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
{
//..The code never makes it to this part, why is this?
processFrame(e.SkeletonFrame);
}
private void processFrame(ReplaySkeletonFrame frame)
{
if (frame != null)
{
skeletonsReplay = new Skeleton[frame.Skeletons.Length];
skeletonsReplay = frame.Skeletons;
Console.WriteLine("attempting draw");
drawMe(); //..Function that draws skeleton
}
}
private void LaunchReplay()
{
Console.WriteLine("replay launched");
Stream readFS = File.OpenRead(@Global.localDirectory +
"\\localStorage\\MySwing.replay");
replay = new KinectReplay(readFS);
//..This line of code should cause the first function to be called right?
replay.SkeletonFrameReady += replay_SkeletonFrameReady;
replay.Start();
}
我很抱歉,但如果你已經知道問題是什麼,什麼是你的題?你想讓它識別skeletonFrameReady? – streppel
只要它從文件中讀取一個新的幀,它應該調用replay_skeletonframeready,但這種情況從未發生過。所以問題是每當它讀取一個新的幀時,處理該幀的函數都不會被調用。 'replay.SkeletonFrameReady + = replay_SkeletonFrameReady;'應該調用replay_skeletonframeready –
@EJ_Westhuizen你有沒有在方法的各個部分設置斷點?那麼你是如何確定代碼從未達到這一點的,還是僅僅因爲你看不到骨架? –