This project is read-only.

usage of kinect toolbox record and replay

Feb 14, 2013 at 4:24 PM
Hi, I am new to Kinect SDK. I am currently working on my final year project which involves Record/Replay Colour/Depth and skeleton data from Kinect. Kinect Toolbox was found which enables this and I am integrating the Toolbox with the SDK sample projects (Colour/Depth/skeleton basics C# WPF) to make a program that could display all those stream from the .replay file recorded previously.

The problem I have for now is due to the differences of the KinectReplay Class from the Toolbox and the KinectSensor Class in the SDK. In the Depth Basics Sample code, in order to display the streams, the following lines in WindowLoaded() which allocate space for data retrieved from the Kinect :


/ Allocate space to put the depth pixels we'll receive
this.depthPixels = new DepthImagePixel[this.sensor.DepthStream.FramePixelDataLength];
            // Allocate space to put the color pixels we'll create
            this.colorPixels = new byte[this.sensor.DepthStream.FramePixelDataLength * sizeof(int)];

            // This is the bitmap we'll display on-screen
            this.colorBitmap = new WriteableBitmap(this.sensor.DepthStream.FrameWidth, this.sensor.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null);
//The code below came from "Skeleton basics C# WPF", which I need to find the correspondence of "CoordinateMapper" in KinectReplay Class
// We are not using depth directly, but we do want the points in our 640x480 output resolution.
             DepthImagePoint depthPoint = this.sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(skelpoint, DepthImageFormat.Resolution640x480Fps30);
In the original sample code, the parameter for the size of above objects were retrieved from KinectSensor Object, which I need to do similar things but took data from KinectReplay Object, for example, how do I get the equivalent of “this.sensor.DepthStream.FramePixelDataLength” from a KinectReplay object as “this.replay = new KinectReplay(recordStream);” ?

The only solution that I can think of is to call “this.depthPixels = new DepthImagePixel[e.FramePixelDataLength]; ” in the replay_DepthImageFrameReady(object sender, ReplayDepthImageFrameReadyEventArgs e) which is invoked each time a depth image frame is received from the KinectReplay. Thus an array of DepthImagePixel will be initialised many times which is inefficient, and in the sample code this will be done only once.

Any idea or sample code which demonstrate the usage of record and replay will be appreciated. Thanks!