我需要将Drawing.Bitmap(“ _MyBitmap”)转换为EmguCV.Image
为此,我使用以下代码:
Dim nCVImage As New Emgu.CV.Image(Of Bgr, Byte)("c:\users\myuser\desktop\1.png")
MsgBox("Width: " & nCVImage.Width)'this work fine!! :-)
'Now (after the messagebox), the error is shown.
Stop'this is just some Stop statement for me to see to which point VB.NET executes the code when OpenCV throws the message. Stop is not hit. This means that the error must have occured in the very first line already.
Dim m As Mat = nCVImage.Mat
Dim imagez0 As Image(Of Gray, Byte) = m.ToImage(Of Gray, Byte)
Dim imagez1 As Image(Of Bgr, Byte) = m.ToImage(Of Bgr, Byte)
Dim imagez2 As Image(Of Gray, Byte) = imagez0.Canny(150, 60)
但是,第一行已经引发了异常“ imageSize溢出”。
_MyBitmap很好。我可以在图片框中显示它。它的大小是1200 x 1000像素。
有人看到我的错误吗?
谢谢!
找到一个解决方案:
缺少“ cvextern.dll”。
我所做的就是下载
https://vorboss.dl.sourceforge.net/project/emgucv/emgucv/4.4.0/libemgucv-windesktop-4.4.0.4099.exe
并按照建议安装。
(不确定我怎么到达那里)
我编译了以下文件:
C:\ Emgu \ emgucv-windesktop 4.4.0.4099 \ Solution \ Windows.Desktop \ Emgu.CV.Example.sln
然后,将\ x86 \ cvextern.dll复制到我的\ Debug \ x86文件夹中。
另外,我将项目升级到框架4.7.2,并使用了Nuget的Emug.CV v4.4.0.4099。
不知道为什么它不会自动将cvextern.dll放到我的应用程序目录中。完全不安!!!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句