Emgu.CV怎麼載入Bitmap

張統發表於2020-10-02

 EmguCV 在4.0.1版本之後沒辦法用Bitmap建立Image了。 我給大家說下 EmguCV怎麼載入Bitmap

下邊是 EmguCV 官方文件寫的,意思是從4.0.1以後的版本不能直接Bitmap建立Image跟Mat了,bitmap被移到了擴充方法裡。

廢話不說 直接上程式碼了!

Bitmap bitmap = null;//宣告你的bitmap
Image<Gray, byte> grayimage = BitmapExtension.ToImage<Gray, byte>(bitmap);

 

哈哈,就是這樣兩句就能用 Bitmap建立Emgu的Image了,是不是很簡單!

 

  • 4.2.0 is based on the Open CV 4.2.0 release
  • The Emgu.CV dll is now targeting .NetStandard 2.0 instead of .Net 3.5
  • The Emgu.CV.UI dll is now targeting .Net 4.6.1 instead of .Net 3.5
  • The nuget package structures has been changed. Emgu.CV nuget package < 4.2.0 contains both the .Net 3.5 dll and the native dll for Windows. Starting from 4.2.0, Emgu.CV nuget package will contain only the .NetStandard 2.0 profile dll. The native dll comes in separate packages for different platforms. e.g. The Emgu.CV.runtime.windows package contains the native dll for Windows as well as the Emgu.CV.UI dll for Windows when targeting .netframework 4.6.1+. The Emgu.CV-CUDA nuget package has been replaced with Emgu.CV.runtime.windows.cuda nuget package.
  • Open CV CUDA DNN module required Compute 5.3 and higher. Our cuda build not longer build with cuda compute bin option < 5.3.
  • Conversion between Mat, UMat, GpuMat and Image<,> and Bitmap objects requires code changes. The constructors of the Mat, UMat, GpuMat and Image<,> that accepts Bitmap has been removed. It has been added to the Emgu.CV.UI.dll file as an extension method. The dll is part of the Emgu.CV.runtime.windows (or the similar Emgu.CV.runtime.windows.cuda) nuget pacakge. Prior to v4.2.0 this code can be use to create a Mat from Bitmap

相關文章