F_VN_ReadDataMatrixCodeRoi

F_VN_ReadDataMatrixCodeRoi 1:

Detect and interpret a data matrix code (ECC200) within the provided image. The code should be in the image center.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_ReadDataMatrixCodeRoi : HRESULT
VAR_INPUT
    ipSrcImage    : ITcVnImage;
    ipDecodedData : Reference To ITcVnContainer;
    fModuleWidth  : REAL;
    hrPrev        : HRESULT;
END_VAR
VAR_OUTPUT
    fAngleDeg     : REAL;
END_VAR

F_VN_ReadDataMatrixCodeRoi 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (USINT elements, 1 channel)

ipDecodedData

Reference To ITcVnContainer

Returns the decoded code (ContainerType_String_SINT)

fModuleWidth

REAL

Minimum module width of the code in the image (in pixels). Must be at least 3, preferably 5 - 8.

hrPrev

HRESULT

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

F_VN_ReadDataMatrixCodeRoi 3: Outputs

Name

Type

Description

fAngleDeg

REAL

Returns the clockwise rotation angle in degree

F_VN_ReadDataMatrixCodeRoi 4: Return value

HRESULT

Further information

The F_VN_ReadDataMatrixCodeRoi function is optimized for the detection of a single Data Matrix code (ECC200) within a defined image area. To do this, the function uses a customized algorithm that requires the code to be centered in the transferred image.

fModuleWidth

The fModuleWidth parameter defines the minimum expected module width of the Data Matrix code to be read in pixels. A module corresponds to a black or white square of the code. If the module size in the image differs more from this, this may result in longer calculation time or no result.

Required License

TC3 Vision Code Reading

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