Skip to content

Instantly share code, notes, and snippets.

@jeanpimentel
Created December 12, 2011 12:41
Show Gist options
  • Save jeanpimentel/1466975 to your computer and use it in GitHub Desktop.
Save jeanpimentel/1466975 to your computer and use it in GitHub Desktop.
[C#] [Kinect] Save a frame
void SaveFrame(ImageFrame frame)
{
var filePath = frame.Timestamp.ToString() + ".bmp";
using (var bitmap = new Bitmap(frame.Image.Width, frame.Image.Height, PixelFormat.Format32bppRgb))
{
var rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
var data = bitmap.LockBits(rect, ImageLockMode.ReadWrite, bitmap.PixelFormat);
Marshal.Copy(frame.Image.Bits, 0, data.Scan0, frame.Image.Bits.Length);
bitmap.UnlockBits(data);
using (var stream = new FileStream(filePath, FileMode.Create))
bitmap.Save(stream, ImageFormat.Bmp);
}
}
@awais045
Copy link

hi i need your complete source code.. send it to awaiszulifqar52@gmail.com
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment