OCR
Detects and recognizes characters in a binary image (white characters on black background).
Can use available TwinCAT Job Tasks for executing parallel code regions.
Syntax
Definition:
HRESULT OCR(
HRESULT hrPrev,
ITcVnImage* ipSrcImage,
ULONGLONG eModel,
ITcVnContainer*& ipCharacters,
float& fMinConfidence,
PCCH sPattern = "",
ULONG eOcrOptions = OO_NONE,
ITcVnContainer** pipBoundingBoxes = nullptr,
ITcVnContainer** pipConfidences = nullptr
)Parameters
Name | Type | Default | Description |
|---|---|---|---|
hrPrev |
| HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) | |
ipSrcImage |
| Source image (USINT elements, 1 or 3 channels). The required number of channels depends on the selected model type. | |
eModel | ULONGLONG |
| Selection of OCR model types (ETcVnOcrModelType) |
ipCharacters |
| Returns the recognized characters (ContainerType_Vector_String_SINT) | |
fMinConfidence | float& |
| Returns the minimum value of the confidences across all recognized characters. Characters rejected by the novelty detector are excluded from this minimum. Always computed, even if ipConfidences is not requested. |
sPattern | PCCH | "" | String pattern containing the format in which characters are presented. Pattern handling support depends on the selected model type. |
eOcrOptions | ULONG | OO_NONE | Specifies which options must be applied to the function (ETcVnOcrOptions) |
pipBoundingBoxes | nullptr | Returns the corresponding bounding boxes of the recognized characters (ContainerType_Vector_TcVnRectangle_DINT, optional, set to 0 if not required). Returns an empty container when bounding boxes are not supported by the selected model type. | |
pipConfidences | nullptr | Returns the corresponding classification confidences of the recognized characters (ContainerType_Vector_REAL, optional, set to 0 if not required). When the novelty detector is selected, the confidence value is a combination of the classification confidence and the novelty detection confidence. If a character is identified as unknown, the total confidence equals the novelty detection confidence. |
Required License
TC3 Vision OCR
System Requirements
Development environment | Target platform | PLC libraries to include |
|---|---|---|
TwinCAT V3.1.4024.59 or later | PC or CX (x64) with min. PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |
Return value