原文:
WPF 将Bitmapsource转换到Emgu.cv.image
Transform WPF BitmapSource to Emgu.CV.Image*******
/// <summary> /// Original Img /// </summary> Image<Bgr, Byte> src; //从剪切板中取得bitmap,是WPF可接受的BitmapSource类型 BitmapSource bitmap = System.Windows.Clipboard.GetImage(); //Transform WPF BitmapSource to Emgu.CV.Image MemoryStream outStream = new MemoryStream(); BitmapEncoder enc = new BmpBitmapEncoder(); enc.Frames.Add(BitmapFrame.Create(bitmap ); enc.Save(outStream); System.Drawing.Bitmap Bmp = new System.Drawing.Bitmap(outStream); //src assignment //src是emgucv 提供的Image类型 src = new Image<Bgr, Byte>(Bmp); //show image1.Source= BitmapSourceConverter.ToBitmapSource(src);