I'm trying to display a camera image (which I obtain through an unmanaged code callback -- that was a whole other problem). It's going to be a WPF application. I started out trying to fill in a Bitmap type. After doing some online research and trying to set an Image.Source equal to the Bitmap, it looked like that wasn't the way things worked in WPF. WPF seems to use all sorts of types like BitmapSource, BitmapFrame, etc. Now I'm trying again using BitmapSource.
Here's my callback code:
Marshal.Copy(Here, the pixel buffer is a pointer to a custom structure containing pData (the actual image data byte array), the width, and height. This copies from my unmanaged memory to managed memory (imageData is a Byte[] array). I have already assigned an image to have its source as a BitmapSource which was .Create()-ed using the imageData byte array. So why do I see a black image when I run the application?
pPixelBuffer->pData,
imageData,
0,
pPixelBuffer->nPitch * pPixelBuffer->nHeight
);
No comments:
Post a Comment