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;

posted @ 2023-10-09 17:19  txwtech  阅读(930)  评论(0编辑  收藏  举报