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

 

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

ipSrcImage

ITcVnImage*

 

Source image (USINT, 1 channel, binary)

eModel

ULONGLONG

 

Selection of OCR model types (ETcVnOcrModelType)

ipCharacters

ITcVnContainer*&

 

Returns the recognized characters (ContainerType_Vector_String_SINT)

fMinConfidence

float&

 

Returns the minimum value of the confidences

sPattern

PCCH

""

String pattern containing the format in which characters are presented

eOcrOptions

ULONG

OO_NONE

Specifies which options must be applied to the function (ETcVnOcrOptions)

pipBoundingBoxes

ITcVnContainer**

nullptr

Returns the corresponding bounding boxes of the recognized characters (ContainerType_Vector_TcVnRectangle_DINT, optional, set to 0 if not required)

pipConfidences

ITcVnContainer**

nullptr

Returns the corresponding classification confidences of the recognized characters (ContainerType_Vector_REAL, optional, set to 0 if not required)

OCR 1: Return value

HRESULT

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