I need to convert a Drawing.Bitmap ("_MyBitmap") to an EmguCV.Image
To do that, I use the following code:
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)
However, the first line already raises the exception "Overflow for imageSize".
_MyBitmap is perfectly fine. I can show it in a picturebox. It's size is 1200 x 1000 pixels.
Does anybody see my mistake?
Thank you!