AnalyzeBarcodeWalsh

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:

HRESULT AnalyzeBarcodeWalsh(
    HRESULT                          hrPrev,
    ITcVnImage*                      ipBarcodeImage,
    TcVnParamsWalshBarcodeDetection& stParams
)

Parameters

Name

Type

Description

hrPrev

HRESULT

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

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.

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.4026 or later

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

Tc3_Vision