EmguCV 在4.0.1版本之后沒辦法用Bitmap創建Image了。 我給大家說下 EmguCV怎么加載Bitmap
下邊是 EmguCV 官方文檔寫的,意思是從4.0.1以后的版本不能直接Bitmap創建Image跟Mat了,bitmap被移到了Emgu.CV.UI拓展方法里。
我們首先要用nuget安裝Emgu.CV.UI,然后就能使用拓展方法了。
廢話不說 直接上代碼了!
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