F_VN_ReadPharmaCodeExp2

F_VN_ReadPharmaCodeExp2 1:

Detect and interpret a pharma code within the provided image. Can be canceled by Watchdog.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_ReadPharmaCodeExp2 : HRESULT
VAR_INPUT
    ipSrcImage    : ITcVnImage;
    ipDecodedData : Reference To ITcVnContainer;
    ipContours    : Reference To ITcVnContainer;
    nCodeNumber   : DINT;
    nMinBarNumber : INT;
    ipAngles      : Reference To ITcVnContainer;
    hrPrev        : HRESULT;
END_VAR

F_VN_ReadPharmaCodeExp2 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (1 channel (all element types) or 3 channel with elements of type TCVN_ET_USINT, TCVN_ET_UINT or TCVN_ET_REAL (3 channel input is expected to be RGB and internally converted to Gray))

ipDecodedData

Reference To ITcVnContainer

Returns the decoded code (ContainerType_Vector_String_SINT)

ipContours

Reference To ITcVnContainer

Returns the code positions as contours (optional, set to 0 if not required; ContainerType_Vector_Vector_TcVnPoint2_DINT)

nCodeNumber

DINT

Number of pharma codes that should be detected within the provided image (currently only 1 supported).

nMinBarNumber

INT

Minimal number of (dark) bars that codes must have.

ipAngles

Reference To ITcVnContainer

Returns the clockwise code rotation angles (optional, set to 0 if not required; ContainerType_Vector_REAL)

hrPrev

HRESULT

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

F_VN_ReadPharmaCodeExp2 3: Return value

HRESULT

Further information

This Expert function extends the function F_VN_ReadPharmaCode as follows:

Angle of rotation

The parameter ipAngles returns the approximate rotation angle of the codes found in a clockwise direction from -90° to +90° in degrees. The container is of the type ContainerType_Vector_REAL. This parameter is optional and can be set to 0 if it is not required.

F_VN_ReadPharmaCodeExp2 4:

Differences in the reading direction

As a Pharmacode does not contain a start or stop identifier, the result varies depending on the reading direction. Therefore, whether the code has been rotated 180° cannot be determined from the rotation angle. To ensure that the code is in the expected orientation, the image must be rotated by 180° and the code read again. Both read results can then be compared with an expected value in order to clearly determine the orientation.

Examples

Related functions

Required License

TC3 Vision Code Reading

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision