ClearImage .NET API
ExtractObject Method (CiTools)
Example 





Inlite.ClearImage Namespace > CiTools Class : ExtractObject Method
a CiObject object returned by FirstObject or NextObject methods
Extract an object into a new image
Syntax
'Declaration
 
Public Function ExtractObject( _
   ByVal Object As CiObject _
) As CiImage
'Usage
 
Dim instance As CiTools
Dim Object As CiObject
Dim value As CiImage
 
value = instance.ExtractObject(Object)
public CiImage ExtractObject( 
   CiObject Object
)
public function ExtractObject( 
    Object: CiObject
): CiImage; 
public function ExtractObject( 
   Object : CiObject
) : CiImage;
public:
CiImage^ ExtractObject( 
   CiObject^ Object
) 

Parameters

Object
a CiObject object returned by FirstObject or NextObject methods

Return Value

An image of the size of Object.Rect containing all pixels of Object
Remarks
Method requires bi-tonal image (object.Image.BitsPerPixel = 1).
Example
void ExtractObjects(string imageFile)
{
    // Open image file
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiTools Tools = ci.CreateTools();
    Tools.Image.Open(imageFile, 1);
    // Do processing
    CiObject Obj;
    CiImage imageObject;   // Image of extracted object
    Obj = Tools.FirstObject();
    while (!(Obj == null))
    {
        imageObject = Tools.ExtractObject(Obj);
        // Do something with ObjImg  For Example:
        // imageObject.Append outFile
        Obj = Tools.NextObject();
    }
}
Sub ExtractObjects(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
    Dim imageObject As CiImage   '  Image of extracted object
    Obj = Tools.FirstObject()
    Do While Not Obj Is Nothing
        imageObject = Tools.ExtractObject(Obj)
        ' Do something with ObjImg  For Example:
        '  imageObject.Append outFile
        Obj = Tools.NextObject()
    Loop
End Sub
See Also

Reference

CiTools Class
CiTools Members
FirstObject Method
NextObject Method
ExtractObject Method