【发布时间】:2022-01-16 19:51:43
【问题描述】:
我正在尝试做一个可以将 Emgu.Cv.Mat 图像转换为 System.Drawing.Bitmap 图像的方法。
public Bitmap convertCvToBitmap(Mat img)
{
byte[] temp_img = this.convertCvToImage(img);
Bitmap mp;
using (var ms = new MemoryStream(temp_img))
{
mp = new Bitmap(ms);
}
return mp;
}
首先我将 Emgu.Cv.Mat 图像转换为 byte[] 图像,然后将此 byte[] 图像转换为 System.Drawing.Bitmap 图像。
此方法适用于桌面,但在 Xamarin Android 应用程序中使用时不起作用,我收到此错误:“System.PlatformNotSupportedException: '此平台不支持操作。' ”。
我知道它来自这行代码:mp = new Bitmap(ms);(我在使用Console.WriteLine之前检查过)
谁能知道问题所在,或者是否有其他路径可以将 Emgu.Cv.Mat 图像转换为 System.Drawing.Bitmap 图像?
谢谢!
【问题讨论】:
-
对于逐个像素的比较,请使用 SkiaSharp
标签: c# android xamarin bitmap emgucv