title: Rendering out camera images to a WPF Image control
body: <p>I have a uEye camera and I take snapshots of images at a 1000ms interval and I want to  render them in a WPF <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.image.aspx" rel="nofollow"><code>Image</code></a> Control like so</p>
  
  <pre><code> Bitmap MyBitmap;
  
  // get geometry of uEye image buffer
  
  int width = 0, height = 0, bitspp = 0, pitch = 0, bytespp = 0;
  
  long imagesize = 0;
  
  m_uEye.InquireImageMem(m_pCurMem, GetImageID(m_pCurMem), ref width, ref height, ref bitspp, ref pitch);
  
  bytespp = (bitspp + 1) / 8;
  
  imagesize = width * height * bytespp; // image size in bytes
  
  // bulit a system bitmap
  MyBitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
  
  // fill the system bitmap with the image data from the uEye SDK buffer
  BitmapData bd = MyBitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
  m_uEye.CopyImageMem(m_pCurMem, GetImageID(m_pCurMem), bd.Scan0);
  MyBitmap.UnlockBits(bd);
  </code></pre>
  
  <p>I am trying to put these bitmaps in to an <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.image.aspx" rel="nofollow"><code>Image</code></a> control at the rate of 1 second. How can I get <a href="http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx" rel="nofollow"><code>Bitmap</code></a> to appear in the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.image.aspx" rel="nofollow"><code>Image</code></a> control and disposing them as soon as I'm done to leave minimal memory footprint to be a good little programmer :) ?</p>