Find the first line
Visual Basic |
---|
Public Function FirstLine() As CiLine |
Lines are identified based on values of pLineCurvature, pMinLineLength, pMaxLineGap and pMaxLineAngle properties
Sub ListLines(imageFile As String) ' Open image file Dim ci As New CiServer Dim Tools As CiTools: Set Tools = ci.CreateTools Tools.Image.Open imageFile ' Do processing Dim Line As CiLine Tools.pLineCurvature = ciCurvVeryLow Tools.pMaxLineAngle = 4.5 Tools.pMaxLineGap = 5 Tools.pMinLineLength = 100 Tools.pLineDirection = ciLineVertAndHorz Set Line = Tools.FirstLine Do While Not Line Is Nothing Debug.Print " Line Angle=" & Line.Angle & " Thickness=" & Line.Thickness Debug.Print " Rect=" & "(" & Line.Rect.Left & "," & Line.Rect.Top & " - " & Line.Rect.Right & "," & Line.Rect.bottom & ")" Debug.Print " Start (" & Line.Start.x & "," & Line.Start.y & ") End (" & Line.End.x & "," & Line.End.y & ")" Debug.Print " Dir=" & Switch(Line.Direction = ciLineHorz, "Horz", Line.Direction = ciLineVert, "Vert") & vbCrLf Set Line = Tools.NextLine Loop End Sub