F_VN_AnalyzeBarcodeWalsh

F_VN_AnalyzeBarcodeWalsh 1:

Analyze an exemplary barcode image and estimate the following parameters for calls of F_VN_DetectBarcodesWalsh: nMaxBarDistance, fMinAspectRatio, fMaxAspectRatio, nIntensityDifference, nMinArea, and nChannelIndex. The depicted barcode must be representative for the barcodes to be detected by F_VN_DetectBarcodesWalsh.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_AnalyzeBarcodeWalsh : HRESULT
VAR_INPUT
    ipBarcodeImage : ITcVnImage;
END_VAR
VAR_IN_OUT
    stParams       : TcVnParamsWalshBarcodeDetection;
END_VAR
VAR_INPUT
    hrPrev         : HRESULT;
END_VAR

 Inputs

Name

Type

Description

ipBarcodeImage

ITcVnImage

Image showing a horizontal barcode surrounded by a narrow non-barcode region in each direction. The total size of the non-barcode region must not exceed 30% of the image size.

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

Returns the estimated parameters for use with F_VN_DetectBarcodesWalsh. The values of the other parameters are not changed.

 Return value

HRESULT

Further information

The function F_VN_AnalyzeBarcodeWalsh analyzes a reference image containing a representative barcode and estimates some of the detection parameters for later use by F_VN_DetectBarcodesWalsh.

Parameter

ipBarcodeImage

The input image ipBarcodeImage must contain a single, horizontally aligned barcode surrounded by a narrow margin area (quiet zone) with no content. The total area of this quiet zone must not exceed 30% of the image area. The image should be free of noise, severe perspective distortion, or rotation.

To ensure a reliable estimate, the reference image must match the conditions of the images to be analyzed as closely as possible: the same barcode type, comparable module width (width of the narrowest stroke), and similar brightness contrast between dark and light modules. The same applies to the hardware setup, since it determines, for example, the line resolution and the brightness of the image, and thus the contrast.

stParams

stParams, of type TcVnParamsWalshBarcodeDetection, is used to configure the individual parameters of barcode detection using F_VN_DetectBarcodesWalsh. F_VN_AnalyzeBarcodeWalsh estimates and overwrites only the following fields:

All other fields nWalshFilterNum, fOutlierReductionFactor, fBarConnectionFactor, fRegionFilterFactor, fPostProcessingResizeFactor, and eInterpolationType remain unchanged and retain their initial values or previously set values.

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