简体   繁体   English

Emgu CV bitmap 到图像不再有效

[英]Emgu CV bitmap to image no longer working

I am working with emguCV pretty often.我经常使用 emguCV。 But now, I downloaded latest CV3 libs for.Net and never had problem with converting bitmap to image.但是现在,我为.Net 下载了最新的 CV3 库,并且在将 bitmap 转换为图像时从未遇到过问题。 Now my code is no longer working and constructor Image no longer takes bitmap as paramter.现在我的代码不再工作,构造函数 Image 不再将 bitmap 作为参数。

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

Is there any workaround?有什么解决方法吗?

Since Emgu version 4.2.0 there is no Image constructor with bitmap as parameter.从 Emgu 版本 4.2.0 开始,没有以位图作为参数的 Image 构造函数。

Now, according to changelog ( http://www.emgu.com/wiki/index.php/Version_History ) there is Extension method for bitmap.现在,根据变更日志( http://www.emgu.com/wiki/index.php/Version_History )有位图的扩展方法。 So now, you have to convert bitmap to Image like this:所以现在,你必须像这样将位图转换为图像:

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

You need to reference the separate package Emgu.CV.Bitmap, then 110mat110's answer will work.您需要参考单独的 package Emgu.CV.Bitmap,然后 110mat110 的答案才有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM