WPF Image控件&Emgu Image控件&WinForm PictureBox控件

2016-12-30 07:36:32来源:CSDN作者:cvMat人点击

/***************WPF Image控件***************/System.Windows.Controls;class Image : FrameworkElement, IUriContext, IProvidePropertyFallbackImage.Source = BitmapSource.Create(...);/***************Emgu ImageBox控件***************/Emgu.CV.UI;class ImageBox : PanAndZoomPictureBox//Image方法    Image<Bgr, Byte> img = new Image<Bgr, byte>(320, 240, new Bgr(255, 0, 0));//Mat方法     Mat img = new Mat(200, 400, DepthType.Cv8U, 3);        img.SetTo(new Bgr(255, 0, 0).MCvScalar);//cvCreateImage方法    IntPtr img = CvInvoke.cvCreateImage(CvInvoke.cvGetSize(scr),    Emgu.CV.CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1);    CvInvoke.cvCopy(scr, img, IntPtr.Zero);    ImageBox.Image = img;/***************WinForm PictureBox控件***************/System.Windows.Forms;class PictureBox : Control, ISupportInitializePictureBox.Image = //cvLoadImage&Image<Bgr, byte>方法    IntPtr scr = CvInvoke.cvLoadImage(filename, Emgu.CV.CvEnum.LOAD_IMAGE_TYPE.CV_LOAD_IMAGE_ANYCOLOR);    Image<Bgr, byte> img = new Image<Bgr, byte>(CvInvoke.cvGetSize(scr));    CvInvoke.cvCopy(scr, img, IntPtr.Zero);    PictureBox.Image = img.ToBitmap();

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台