C#OpenCvSharp 实现bitmap与mat的格式相互转换
//转为 bitmap:
Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
process_pictureBox.Image = map;
//Image img 转为Mat
Bitmap bitmap = new Bitmap(img);//Image img
OpenCvSharp.Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bitmap);//用
//bitmap转换为mat
C#中Bitmap 与 Image 之间的转换
Image img = pictureBox1.Image;
Bitmap map = new Bitmap(img);
//而Bitmap直接可以赋值 给 Image 对象
Image img = Bitmap;
欢迎讨论,相互学习。
cdtxw@foxmail.com