我使用名为“SimpleViewer.net”的openNI 库中的示例来显示带有openNI 库的kinect 设备的图像。
现在,我的目标是保存我显示的所有图像,我认为这个地方是:
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);
}
在此之前我解锁了 BitmapData ....
我无法保存包含深度数据的 bmp 图像.....
提前致谢