Depth data saving to a binary file RRS feed

  • Question

  • Good evening, 

    Apologises if this question has been asked before, I could not find it. However in general this forum has been amazing, programming is not my field of expertise ( I am from the medical side). However the kinect has presented some very interesting areas to explore. In nutshel, I am looking to save the depth data to a binary file to later analysis (and display) - while I am aware of the kinect studio, I need to record the data intandem with other data collected. I have searched around and adapted a method, however I am at a loss.

    I hava created a call in the SensorDepthFrameReady method:


    This then passes the depth frame image to saveDepth, the writer is initialised when a "start" button is pressed:

     static void saveDepth(DepthImageFrame depthFrame)
     short[] pix = new short[depthFrame.PixelDataLength];
                    for (int i = 0; i < pix.Length; i++)
                        writer.Write(" ");
                        writer.Write(" ");

    The objective simply is to save the depth stream to a binary file to enable later analysis (possible matlab). 

    Hope you can help and thanks for read,


    Tuesday, December 4, 2012 6:44 PM

All replies

  • Is anyone able to help with this question? It will be much appreciated. 
    Thursday, December 6, 2012 1:53 PM
  • I wanted to provide an update to where I've got to far. As said previously programming is not my field of expertise, I'd be greatly if someone can validate my statement. The idea is to save the depth data to file for analysis in another program (for example Matlab). I invoke the saveDepth in the depthframe ready event and pass in the depthPixel byte[] array.

    public static void saveDepth( byte[] bytes)
        // create file io for write
        using (System.IO.FileStream stream = new System.IO.FileStream(file, System.IO.FileMode.Append, System.IO.FileAccess.Write))
            // write the passed byte buffer
            stream.Write(bytes, 0, bytes.Length);
            // close the file

    So what I am asking is, if the method above achieves the stated aims? As other it would be difficult to validate in Matlab if it is saving incorrectly.


    Saturday, December 8, 2012 3:38 PM
  • I'd also be interested to find out more about this method. Anyone able to confirm if it does what this person is saying?
    Wednesday, December 12, 2012 1:36 PM