I do have some problems to display an image (uEye-Cam) in a wpf-Image form. The displayed image is completely white. Below is my used code:
//Get Cam Bitmap Image var cam = new uEye.Camera(); cam.Init(); cam.Memory.Allocate(); cam.Acquisition.Capture(uEye.Defines.DeviceParameter.DontWait); Int32 s32MemId; cam.Memory.GetActive(out s32MemId); cam.Memory.Lock(s32MemId); Bitmap bitmap; cam.Memory.ToBitmap(s32MemId, out bitmap); //WPF Image control var image1 = new System.Windows.Controls.Image(); //convert System.Drawing.Image to WPF image var bmp = new System.Drawing.Bitmap(bitmap); IntPtr hBitmap = bmp.GetHbitmap(); System.Windows.Media.ImageSource wpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); image1.Source = wpfBitmap; image1.Stretch = System.Windows.Media.Stretch.UniformToFill; image1.Visibility = Visibility.Visible; DeleteObject(hBitmap); Is there anything wrong with the image1 properties maybe or..?
Thanks