简体   繁体   中英

Emgu CV bitmap to image no longer working

I am working with emguCV pretty often. But now, I downloaded latest CV3 libs for.Net and never had problem with converting bitmap to image. Now my code is no longer working and constructor Image no longer takes bitmap as paramter.

        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.

Now, according to changelog ( http://www.emgu.com/wiki/index.php/Version_History ) there is Extension method for bitmap. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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