public Bitmap GetBitmap(ColorImageFrame frame)
{
byte[] data = new byte[frame.PixelDataLength];
frame.CopyPixelDataTo(data);
Rectangle rect = new Rectangle(0, 0, frame.Width, frame.Height);
Bitmap bitmap = new Bitmap(frame.Width, frame.Height);
BitmapData bd = bitmap.LockBits(rect, ImageLockMode.ReadWrite, bitmap.PixelFormat);
IntPtr ptr = bd.Scan0;
System.Runtime.InteropServices.Marshal.Copy(data, 0, ptr, data.Length);
bitmap.UnlockBits(bd);
return bitmap;
}
Kinect Winform程序中 彩色图像帧转化为Bitmap
最新推荐文章于 2024-05-31 20:41:32 发布