To start development of ClearImage project:
- Run the ClearImage COM Demo program to familiarize yourself with most of the ClearImage capabilities. The various tools and operations can be applied interactively, and a built in viewer shows the resulting image. A continuing history documents the various steps taken. Options panels open prior to each operation to show the possible parameters, and recognition results are reported in a friendly information screen.
- Use "API Help" button in ClearImage Demo Options and Barcode results dialog boxes to obtain function-specific help and code snippets.
- Review Sample programs supplied with ClearImage SDK.
Load them from Start -> Programs -> ClearImage 8 SDK -> Examples.
The following shows typical elements of a ClearImage-based program.
To start Visual Basic development
See Example VB6 project
- From menu: Project -> References...
Check 'ClearImage COM Server'
- Create CiServer object:
Dim Ci As ClearImage. CiServer
Set Ci = New CiServer
- Create an CiImage object:
Dim Image as CiImage
Set Image=Ci.CreateImage
- Open image file:
Image.Open "MyImageFile.tif", 1
- Create some processing object and attach CiImage object to this object:
Dim Bc as CiBarcodePro
Set Bc = Ci.CreateBarcodePro
Bc.Image = Image
- Configure processing object properties (if needed):
Bc.AutoDetect1D = ciTrue
- Execute processing object methods (modify image or perform measurements):
Bc.Find
- Process results:
Dim Barcode as CiBarcode
For each Barcode in Bc.Barcodes
' Do something with Barcode
Next
- Do something else with Image (step 5) or open another image file (step 4).
To start C++ development
See C++ Example project. This example use COM Smart Pointers.
- Import ClearImage Type Library. Add to all source files using ClearImage objects:
#import "progid:ClearImage.ClearImage" exclude("LONG_PTR") no_namespace named_guids
- Compile Debug version project. This creates Type Library Header file: ClearImage.tlh.
Add it "Header Files" to have ClearImage object visible in ClassView
- Open COM
CoInitialize(NULL);
- Declare and create CiServer object
ICiServerPtr Ci;
HRESULT hr = Ci.CreateInstance(__uuidof(CiServer));
- Declare and create CiImage object
ICiImagePtr Image = Ci->CreateImage();
- Open image file
Image->Open (_bstr_t("MyImageFile.tif"), 1);
- Create some processing object and attach CiImage object to this object:
Bc = Ci->CreateBarcodePro ();
Bc->Image = Image;
- Configure processing object properties (if needed):
Bc->AutoDetect1D = ciTrue;
- Execute processing object methods (modify image or perform measurements):
Bc->Find(0);
- Process results:
for (int i = 1 ; i <= Bc->Barcodes->Count ; i++)
DisplayBarcode (Bc->Barcodes->Item[i]);
- Do something else with Image (step 7) or open another image file (step 6).
Development issues to consider
See additional programming elements in program examples:
- Error handling
- Zone processing vs. whole image