Created
January 14, 2015 23:58
-
-
Save thomasweng15/b3e84805be1c832fd534 to your computer and use it in GitHub Desktop.
Converting byte array back into iplimage
This file contains hidden or 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
BitmapSource bitmap = BitmapSource.Create( | |
640, 480, | |
96, 96, pf, null, | |
buffer, rawStride); | |
// save image to stream | |
MemoryStream ms = new MemoryStream(); | |
BitmapEncoder encoder = new PngBitmapEncoder(); | |
encoder.Frames.Add(BitmapFrame.Create(bitmap)); | |
encoder.Save(ms); | |
ms.Seek(0, SeekOrigin.Begin); | |
// load as a System.Drawing.Bitmap | |
System.Drawing.Bitmap b = new System.Drawing.Bitmap(ms); | |
IplImage ipl = b.ToIplImage(); | |
Cv.ShowImage("Object Segmentation", ipl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment