Emgu CV 位图到图像不再有效

Emgu CV bitmap to image no longer working

我经常使用 emguCV。但是现在,我为 .Net 下载了最新的 CV3 库,并且从未遇到过将位图转换为图像的问题。现在我的代码不再工作,构造函数 Image 不再将位图作为参数。

        Bitmap bitmap = Sources.GetBitmap();
        Image<Bgr, byte> source = new Image<Bgr, byte>(bitmap);

有什么解决办法吗?

自 Emgu 版本 4.2.0 以来,没有以位图作为参数的图像构造函数。

现在,根据变更日志(http://www.emgu.com/wiki/index.php/Version_History),有位图扩展方法。所以现在,您必须像这样将位图转换为图像:

    Bitmap bitmap = Sources.GetBitmap();
    var Image = bitmap.ToImage<Bgr, byte>();

你需要引用单独的包Emgu.CV.Bitmap,然后110mat110的答案才有效。