SystemAccessViolation 将 Drawing.Bitmap 转换为 Emgu.CV.Image
SystemAccessViolation converting Drawing.Bitmap to Emgu.CV.Image
我需要将 Drawing.Bitmap ("_MyBitmap") 转换为 EmguCV.Image
为此,我使用以下代码:
Dim nCVImage As New Emgu.CV.Image(Of Bgr, Byte)("c:\users\myuser\desktop.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)
但是,第一行已经引发异常“图像大小溢出”。
_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 放入我的应用程序目录。
完全令人不安!!!
我需要将 Drawing.Bitmap ("_MyBitmap") 转换为 EmguCV.Image
为此,我使用以下代码:
Dim nCVImage As New Emgu.CV.Image(Of Bgr, Byte)("c:\users\myuser\desktop.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)
但是,第一行已经引发异常“图像大小溢出”。
_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 放入我的应用程序目录。 完全令人不安!!!