F_VN_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:
FUNCTION F_VN_AnalyzeBarcodeWalsh : HRESULT
VAR_INPUT
ipBarcodeImage : ITcVnImage;
END_VAR
VAR_IN_OUT
stParams : TcVnParamsWalshBarcodeDetection;
END_VAR
VAR_INPUT
hrPrev : HRESULT;
END_VARInputs
|
Name |
Type |
Description |
|---|---|---|
|
ipBarcodeImage |
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 indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
In/Outputs
|
Name |
Type |
Description |
|---|---|---|
|
stParams |
Returns the estimated parameters for use with F_VN_DetectBarcodesWalsh. The values of the other parameters are not changed. |
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:
nMaxBarDistance: Maximum distance in pixels between two consecutive dark or light barsfMinAspectRatio/fMaxAspectRatio: Minimum and maximum aspect ratios (width/height) for valid code regionsnIntensityDifference: Average intensity difference between dark and light code pixelsnMinArea: Expected minimum code area in pixelsnChannelIndex: Color channel index for internal processing
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 |