我目前正在使用VB.NET中的EmguCV。 我的程序无法打开图像,我也不明白为什么。
注意:打开文件的行由软件从C#转换为VB.NET。
代码中可能存在什么问题?
Imports Emgu.CV
Imports Emgu.CV.Util
Imports Emgu.CV.Structure
Module analyse
' module général d'analyse
' on assume que les images soient dans le dossier /images/...
' les images ont déjà été tresholdé par le backend
Sub detect_lines()
Dim RhoRes As Double = 2
Dim Threshold As Double = 100
Dim MinLineWidth As Double = 1
Dim linegap As Integer = 3
Dim ThetaRes As Double = Math.PI / 180
Dim image = CvInvoke.cvLoadImage("frame3.jpg", 1)
Dim img As New Image(Of Bgr, Byte)("frame3.jpg")
Dim Linez()() As LineSegment2D = img.HoughLinesBinary(RhoRes, ThetaRes, Threshold, 0, 0)
If Linez(0).Length = 0 Then 'Greater than or equal to
For i = 0 To Linez(0).Length - 1
If Linez(0)(i).Length = 10 And Linez(0)(i).Length = 30 Then 'Greater than and less than or equal to
img.Draw(Linez(0)(i), New Bgr(0, 255, 0), 3)
End If
If Linez(0)(i).Length = 30 And Linez(0)(i).Length = 60 Then 'Greater than and less than or equal to
img.Draw(Linez(0)(i), New Bgr(255, 0, 0), 3)
End If
If Linez(0)(i).Length = 60 Then
img.Draw(Linez(0)(i), New Bgr(0, 0, 255), 3)
End If
Next
End If
MsgBox(Linez.ToString)
End Sub
End Module