ImgRecognizeExternal |
Top Previous Next |
Prototype
strResult:=ImgRecognizeExternal (intImageHandle,strDLLName,strCustomData)
Description
It makes a recognition operation on the image using an external DLL where is implemented a function extracting string data from the image.
The DLL can be written with every programming language if export a "Recognize" function with standard call style accepting as parameter a 32 bit integer (the DIB handle), a string pointer (the custom initialiting parameters) and a string buffer for result data:
Here a C/C++ declaration sample:
void Recognize(int handle, char *parameters, char *outbuffer)
Here a Pascal/Delphi declaration sample:
procedure Recognize(handle: integer; parameters:pchar; outbuffer:pchar)
The resulting buffer is allocated by the script engine and can contain up to 1024 charactes. The function need to give as result into the buffer a string null terminated.
Parameters
ImageHandle: numerical value with image handle.
strDLLName: the name of DLL to call.
strCustomData: string with custom value to pass to this function.
Returned value
The result is a string with the data extracted from the DIB handle and/or any custom data.
Example
// Retrieve the DIB handle from current image DIBhandle:=ImgGetDIBHandle(_CurrentImage);
// Call the recognition function implemented in the external DLL // we suppose the result string is built by confidence (first 3 characers) and recognized data (ramainer characters) PackedResult:=ImgRecognizeExternal(DIBHandle,'CMC7REC.DLL','MyCustomData');
// Get the confidence, packed in the result buffer first three characters 000 - 100 Confidence:=StrToInt(Copy(PackedResult,1,3));
// Get the result skipping the confidence Data:=Copy(PackedResult,4,Length(PackedData)); |