F_VN_DetectBarcodesWalsh

F_VN_DetectBarcodesWalsh 1:

Detect barcodes using the Walsh transform.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_DetectBarcodesWalsh : HRESULT
VAR_INPUT
    ipSrcImage : ITcVnImage;
    ipBarcodes : Reference To ITcVnContainer;
    eOptions   : UDINT;
END_VAR
VAR_IN_OUT
    stParams   : TcVnParamsWalshBarcodeDetection;
END_VAR
VAR_INPUT
    hrPrev     : HRESULT;
END_VAR

 Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (USINT or SINT)

ipBarcodes

Reference To ITcVnContainer

Returns the code positions as rotated rectangles (ContainerType_Vector_TcVnRotatedRectangle; Non-zero interface pointers are reused.)

eOptions

UDINT

General flags controlling the detection process. (see ETcVnDetectBarcodesWalshOptions; default: TCVN_DBWO_HORIZONTAL)

hrPrev

HRESULT

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

 In/Outputs

Name

Type

Description

stParams

TcVnParamsWalshBarcodeDetection

Parameters for configuring the individual detection steps.

 Return value

HRESULT

Further information

The function F_VN_DetectBarcodesWalsh locates barcodes (1D codes) in an image using the Walsh transform and returns their position and orientation. Unlike code-reading functions, this function does not decode the code's content; rather, it serves to pre-locate the code regions.

These code regions can be decoded in the next step using the corresponding Code reading functions. Due to the specified region, the execution time is reduced as the localization of the code is restricted to a small image area. This also enables the direct use of code reading functions that require a predefined ROI.

Compared to neural network-based code recognition using F_VN_DetectCodesNeuralNetwork, Walsh-based detection offers shorter execution times in many scenarios, but can recognize only barcodes (1D codes). Whether the function is actually faster depends on the choice of parameters and the image content.

Parameter

ipSrcImage

The input image ipSrcImage must be of the type USINT or SINT.

ipBarcodes

The parameter ipBarcodes returns the localized barcode positions as a container of type ContainerType_Vector_TcVnRotatedRectangle.

eOptions

The parameter eOptions, of type ETcVnDetectBarcodesWalshOptions, specifies the orientations in which to search for barcodes. Multiple values can be combined using an OR operator. Default value: TCVN_DBWO_HORIZONTAL.

If the orientation of the barcodes in the application is known, it is recommended to select only the relevant option, since each additional search direction increases computing time. TCVN_DBWO_ALL_DIRECTIONS offers the highest robustness when the orientation is unknown, but is correspondingly more computationally intensive.

stParams

The parameter stParams, of type TcVnParamsWalshBarcodeDetection, configures the individual steps of barcode detection. The code parameters can be estimated automatically from a reference image using F_VN_AnalyzeBarcodeWalsh.

Code parameters:

The following parameters describe the characteristic properties of the barcodes to be recognized and are typically estimated by F_VN_AnalyzeBarcodeWalsh:

Filter parameters:

The following parameters control the performance and robustness of the detection

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