ClearImage .NET API
FirstObject Method (CiTools)
Example 





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

Return Value

Nothing or null when no more objects are available.
Remarks
Method requires bi-tonal image (object.Image.BitsPerPixel = 1).
Example
void ListObjects(string imageFile)
{
    // Open image file
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiTools Tools = ci.CreateTools();
    Tools.Image.Open(imageFile, 1);
    // Do processing
    CiObject Obj;
    Obj = Tools.FirstObject();
    while (Obj != null)
    {
        Console.Write("  Rect=" + "(" + Obj.Rect.left + "," + Obj.Rect.top + " - " + Obj.Rect.right + "," + Obj.Rect.bottom + ")");
        Console.Write("  Pixels=" + Obj.Pixels + "   Intervals=" + Obj.Intervals + Environment.NewLine);
        Obj = Tools.NextObject();
    }
}
Sub ListObjects(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 Obj As CiObject
    Obj = Tools.FirstObject()
    Do While Not Obj Is Nothing
        Console.Write("  Rect=" + "(" + Obj.Rect.left + "," + Obj.Rect.top + " - " + Obj.Rect.right + "," + Obj.Rect.bottom + ")")
        Console.Write("  Pixels=" + Obj.Pixels + "   Intervals=" + Obj.Intervals + Environment.NewLine)
        Obj = Tools.NextObject()
    Loop
End Sub
See Also

Reference

CiTools Class
CiTools Members
FirstObject Method
NextObject Method
ExtractObject Method