【发布时间】:2015-06-24 22:21:15
【问题描述】:
我需要将深度帧保存为 Gray PNG 16 图像。 我只知道如何将它们保存为 32bgr 图像。 这是我的代码:
private byte[] depthFrame32;
using (DepthImageFrame imageFrame = e.OpenDepthImageFrame())
{
if (imageFrame != null)
{
int stride = imageFrame.Width * 4;
BitmapSource bmp = BitmapSource.Create(imageFrame.Width, imageFrame.Height,
96, 96, PixelFormats.Bgr32, null, this.depthFrame32, stride);
using (var fileStream = new FileStream(full_path, FileMode.Create))
{
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
encoder.Save(fileStream);
}
}
}
提前致谢
【问题讨论】: