F_VN_ReadBarcodeExp

F_VN_ReadBarcodeExp 1:

Detect and interpret a 1d barcode within the provided image. Can be canceled by Watchdog.

Syntax

Definition:

FUNCTION F_VN_ReadBarcodeExp : HRESULT
VAR_INPUT
    ipSrcImage       : ITcVnImage;
    ipDecodedData    : Reference To ITcVnContainer;
    ipContours       : Reference To ITcVnContainer;
    eBarcodeType     : UDINT;
    nCodeNumber      : DINT;
    eSearchDirection : ETcVnBarcodeSearchDirection;
    hrPrev           : HRESULT;
END_VAR

F_VN_ReadBarcodeExp 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (USINT elements, 1 channel or 3 channel (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)

eBarcodeType

UDINT

Types of barcode to search for (ETcVnBarcodeType)

nCodeNumber

DINT

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

eSearchDirection

ETcVnBarcodeSearchDirection

Barcode search direction.

hrPrev

HRESULT

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

F_VN_ReadBarcodeExp 3: Return value

HRESULT

Further information

The function F_VN_ReadBarcodeExp is the expert version of F_VN_ReadBarcode. It contains additional parameters for returning the code position and for setting the search direction.

Parameter

Input image

The input image ipSrcImage must be a 1-channel or 3-channel image with the element type USINT (8-bit). 3-channel images will be interpreted as RGB and converted internally into grayscale images.

Read data

The data read from the code are returned as a string in the container ipDecodedData. The container is of the type ContainerType_Vector_String_SINT.

Barcode type

The parameter eBarcodeType defines the barcode types to be searched for in the image. All barcode types in the enum ETcVnBarcodeType are supported. It is possible to select more than one type. It is recommended to restrict the selection to the types actually occurring in the end application in order to improve the runtime.

eBarcodeType := TCVN_BT_EAN13 + TCVN_BT_CODE128;

Use TCVN_BT_ANY to search for all available barcode types.

Position of the code

The parameter ipContour returns the code position that is found as a contour.

Number of codes

The parameter nCodeNumber defines how many codes to search for.

F_VN_ReadBarcodeExp 4:

Search for more than one barcode not supported

Searching for several barcodes in one image is currently not supported. The parameter nCodeNumber therefore has to be set to 1.

Search direction

The search direction can be specified via eSearchDirection:

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