F_VN_ReadBarcodeRoi

F_VN_ReadBarcodeRoi 1:

Detect and interpret a 1d barcode within the provided image. For best performance, the code should be horizontally aligned and in the image center.

Syntax

Definition:

FUNCTION F_VN_ReadBarcodeRoi : HRESULT
VAR_INPUT
    ipSrcImage    : ITcVnImage;
    ipDecodedData : Reference To ITcVnContainer;
    eBarcodeType  : ETcVnBarcodeType;
    hrPrev        : HRESULT;
END_VAR
VAR_OUTPUT
    fAngleDeg     : REAL;
END_VAR

 Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (USINT, 1 channel)

ipDecodedData

Reference To ITcVnContainer

Returns the decoded data (ContainerType_String_SINT)

eBarcodeType

ETcVnBarcodeType

Type of the barcode (supported: CODE39, CODE128, EAN8, EAN13, ITF, UPCA, UPCE)

hrPrev

HRESULT

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

 Outputs

Name

Type

Description

fAngleDeg

REAL

Returns the approximate clockwise rotation angle in degree

 Return value

HRESULT

Further information

The F_VN_ReadBarcodeRoi function is optimized for the detection of a single barcode within a defined image area (ROI).

Algorithm

To do this, the function uses a customized algorithm that requires the code to be centered in the transferred image. The function first searches for horizontally aligned codes and then for vertically aligned codes in the image.

Parameter

Input image

The ipSrcImage input image must be an 1-channel image with USINT element type (8 bits). The code must be aligned horizontally or vertically in the center of the image.

Read data

The data read from the code are returned as a string in the ipDecodedData container. The container is of the type ContainerType_String_SINT. Once the code has been successfully found and decoded, the content can be exported to a string using the F_VN_ExportContainer_String function.

hr := F_VN_ExportContainer_String(ipDecodedData, sText, nMaxLength, hr);

Barcode type

The eBarcodeType parameter defines the barcode type to be read. Only one barcode type can be transferred per function call. The following barcode types from the ETcVnBarcodeType enum are supported:

  • TCVN_BT_CODE39
  • TCVN_BT_CODE128
  • TCVN_BT_EAN8
  • TCVN_BT_EAN13
  • TCVN_BT_ITF
  • TCVN_BT_UPCA
  • TCVN_BT_UPCE

Rotation angle (Return value)

The fAngleDeg return value returns the clockwise rotation angle in 90° steps.

Expert parameters

The expert version F_VN_ReadBarcodeRoiExp contains additional parameters.

Required License

TC3 Vision Code Reading

System Requirements