This project is read-only.

Delay when replaying some recorded movement.

Nov 19, 2012 at 4:24 PM

I recorded a one minute movement. When replaying it i noticed some delay between the color and the skeleton movoment, is there a way to syncronize it?

Feb 10, 2013 at 10:19 PM
I also noticed the same thing while trying this out today. I think using the AllFramesReady event instead of individual ready events might help, but I am curious if anybody else has figured out a solution
Feb 22, 2013 at 6:01 PM
I have the same problem. I tried to record all three streams in AllFramesReady event as follows:
//this event fires when Color/Depth/Skeleton are synchronized
        void newSensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            using (ColorImageFrame colorImageFrame = e.OpenColorImageFrame())
            {
                if (colorImageFrame == null)
                    return;
                // any other validations...
                if (Isrecording == true)
                    this.Recorder.Record(colorImageFrame);
            }

            using (DepthImageFrame depthImageFrame = e.OpenDepthImageFrame())
            {
                if (depthImageFrame == null)
                    return;
                // any other validations...
                if (Isrecording == true)
                    this.Recorder.Record(depthImageFrame);
            }

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame == null)
                    return;
                // any other validations...
                if (Isrecording == true)
                    this.Recorder.Record(skeletonFrame);
            }
        }
And the problem is that there is no "AllFrameReady" in the replay system, so I called three EventHandlers respectively as follows, which I feel causes non-synchronization.
        void replay_ColorImageFrameReady(object sender, ReplayColorImageFrameReadyEventArgs e)
        {
            ReplayColorImageFrame frame = e.ColorImageFrame;
            if (frame == null)
                return;
            this.colorManager.Update(frame);
            //System.Console.WriteLine("update color");

        }


        private void replay_DepthImageFrameReady(object sender, ReplayDepthImageFrameReadyEventArgs e)
        {
            ReplayDepthImageFrame frame = e.DepthImageFrame;
            if (frame == null)
                return;

            this.depthManager.Update(frame);
            //System.Console.WriteLine("update depth");
        }

        private void replay_SkeletonImageFrameReady(object sender, ReplaySkeletonFrameReadyEventArgs e)
        {
            ReplaySkeletonFrame frame = e.SkeletonFrame;

            if (frame == null)
                return;
            if (frame.Skeletons.All(s => s.TrackingState == SkeletonTrackingState.NotTracked))
                return;

            skeletonManager.Draw(skeletons, false);
            //System.Console.WriteLine("update skeleton");
        }
Feb 23, 2013 at 11:51 PM
I created my own replay framework based off the code in Kinect Toolbox, adding functionality to synchronize the recording and replaying and also audio recording. You can check it out at https://github.com/latish/Kinect.Replay. I'll try to blog about it soon at http://dotnetsurfers.com/blog/.
Feb 25, 2013 at 9:24 PM
Hi Latish, thanks a lot for your reply, it's like seeing a glimpse of light from the dark for me who is working on the final year project with very little experience of C# and Kinect. I tried your framework but got a error of Error while building the solution 1 Source file 'Properties\AssemblyInfo.cs' could not be found (The error is in Kinect.replay\CSC). I had a look at the code and it seems exactly what I want to achieve(recording + displaying at the same time , and replaying + displaying at the same time). Would be great if you could have a look into this, I am looking forward to read your blog!
Feb 25, 2013 at 9:40 PM
I checked in the missing file. If you have any more issues, you can report them on github.

Fyi, to anybody else wondering, I did try to incorporate my changes into Kinect Toolbox, but I was just diverging too much from the original intent of the code and ended up rewriting the record/replay bits as Kinect.Replay.
Feb 25, 2013 at 9:48 PM
Works like a charm! Thanks a lot!