Save kinect image with openni

448 views Asked by At

I used the example in openNI library called "SimpleViewer.net" to display images of kinect device with the library openNI.

Now, my aim is to save all the images that I display, I think that the place is:

lock (this)
{
    Rectangle rect = new Rectangle(0, 0, this.bitmap.Width, this.bitmap.Height);
    BitmapData data = this.bitmap.LockBits(rect, ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

    ushort* pDepth = (ushort*)this.depth.DepthMapPtr.ToPointer();

    // set pixels
    for (int y = 0; y < depthMD.YRes; ++y)
    {
        byte* pDest = (byte*)data.Scan0.ToPointer() + y * data.Stride;
        for (int x = 0; x < depthMD.XRes; ++x, ++pDepth, pDest += 3)
        {
            byte pixel = (byte)this.histogram[*pDepth];
            pDest[0] = 0;
            pDest[1] = pixel;
            pDest[2] = pixel;
        }
    }
    this.bitmap.UnlockBits(data);
}

before that I unlock the BitmapData....

I have not able to save a bmp image that containing the depth data.....

Thanks in advance

0

There are 0 answers