ClearImage .NET API
FirstLine Method (CiTools)
Example 





Inlite.ClearImage Namespace > CiTools Class : FirstLine Method
Find the first line
Syntax
'Declaration
 
Public Function FirstLine() As CiLine
'Usage
 
Dim instance As CiTools
Dim value As CiLine
 
value = instance.FirstLine()
public CiLine FirstLine()
public function FirstLine(): CiLine; 
public function FirstLine() : CiLine;
public:
CiLine^ FirstLine(); 

Return Value

Nothing or null when no more lines are available.
Remarks

Lines are identified based on values of pLineCurvature, pMinLineLength, pMaxLineGap  and pMaxLineAngle  properties

Example
void ListLines(string imageFile)
{
    // Open image file
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiTools Tools = ci.CreateTools();
    Tools.Image.Open(imageFile, 1);
    // Do processing
    CiLine Line;
    Tools.pLineCurvature = ELineCurvature.ciCurvVeryLow;
    Tools.pMaxLineAngle = 4.5;
    Tools.pMaxLineGap = 5;
    Tools.pMinLineLength = 100;
    Tools.pLineDirection = ELineDirection.ciLineVertAndHorz;
    Line = Tools.FirstLine();
    while (Line != null)
    {
        Console.Write("  Line Angle=" + Line.Angle + "  Thickness=" + Line.Thickness);
        Console.Write("  Rect=" + "(" + Line.Rect.left + "," + Line.Rect.top + " - " + Line.Rect.right + "," + Line.Rect.bottom + ")");
        Console.Write("  Start (" + Line.Start.x + "," + Line.Start.y + ")  End (" + Line.End.x + "," + Line.End.y + ")");
        Console.Write("  Dir=" + Line.Direction.ToString() + Environment.NewLine);
        Line = Tools.NextLine();
    }
}
Sub ListLines(imageFile As String)
    ' Open image file
    Dim ci As CiServer = Inlite.ClearImageNet.Server.GetThreadServer()
    Dim Tools As CiTools = ci.CreateTools()
    Tools.Image.Open(imageFile, 1)
    ' Do processing
    Dim Line As CiLine
    Tools.pLineCurvature = ELineCurvature.ciCurvVeryLow
    Tools.pMaxLineAngle = 4.5
    Tools.pMaxLineGap = 5
    Tools.pMinLineLength = 100
    Tools.pLineDirection = ELineDirection.ciLineVertAndHorz
    Line = Tools.FirstLine()
    Do While Not Line Is Nothing
        Console.Write("  Line Angle=" + Line.Angle + "  Thickness=" + Line.Thickness)
        Console.Write("  Rect=" + "(" + Line.Rect.left + "," + Line.Rect.top + " - " + Line.Rect.right + "," + Line.Rect.bottom + ")")
        Console.Write("  Start (" + Line.Start.x + "," + Line.Start.y + ")  End (" + Line.End.x + "," + Line.End.y + ")")
        Console.Write("  Dir=" + Line.Direction.ToString() + Environment.NewLine)
        Line = Tools.NextLine()
    Loop
End Sub
See Also

Reference

CiTools Class
CiTools Members
FirstLine Method
NextLine Method
pLineCurvature Property
pLineDirection Property
pMaxLineAngle Property
pMinLineLength Property