Created
December 12, 2011 12:41
-
-
Save jeanpimentel/1466975 to your computer and use it in GitHub Desktop.
[C#] [Kinect] Save a frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi i need your complete source code.. send it to awaiszulifqar52@gmail.com
thanks