/// <summary> /// Gets the live view. /// </summary> public void GetLiveView() { LiveViewData liveViewData = CameraDevice.GetLiveViewImage(); if (liveViewData == null || liveViewData.ImageData == null) { return; } Image = new Bitmap(new MemoryStream(liveViewData.ImageData, liveViewData.ImageDataPosition, liveViewData.ImageData.Length - liveViewData.ImageDataPosition)); }
/// <summary> /// Gets the live view. /// </summary> public void GetLiveView() { LiveViewData liveViewData = CameraDevice.GetLiveViewImage(); if (liveViewData == null || liveViewData.ImageData == null) { return; } var image = new BitmapImage(); image.BeginInit(); image.StreamSource = new MemoryStream(liveViewData.ImageData, liveViewData.ImageDataPosition, liveViewData.ImageData.Length - liveViewData.ImageDataPosition); image.CacheOption = BitmapCacheOption.OnLoad; image.EndInit(); image.Freeze(); ImageView.Source = image; }
private void GetLiveView() { try { if (_isLiveViewPaused) { return; } _liveViewData = CameraDevice.GetLiveViewImage(); if (_liveViewData != null && _liveViewData.ImageData != null) { using ( MemoryStream stream = new MemoryStream(_liveViewData.ImageData, _liveViewData.ImageDataPosition, _liveViewData.ImageData.Length - _liveViewData.ImageDataPosition)) { //Rotation = LiveViewData.Rotation; //if (CameraDevice is CanonSDKBase) // Rotation = 90; BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.CacheOption = BitmapCacheOption.OnLoad; bi.StreamSource = stream; bi.EndInit(); //bi.Freeze(); var bitmap = BitmapFactory.ConvertToPbgra32Format(bi); bitmap.Freeze(); BitmapSource = bitmap; } } } catch (Exception ex) { Log.Debug("Live view error ", ex); } }