F_VN_ReadPharmaCode
Detect and interpret a pharma code within the provided image.
Can be canceled by Watchdog.
Can use available TwinCAT Job Tasks for executing parallel code regions.
Syntax
Definition:
FUNCTION F_VN_ReadPharmaCode : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
ipDecodedData : Reference To ITcVnContainer;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image (1 channel (all element types) or 3 channel with elements of type TCVN_ET_USINT, TCVN_ET_UINT or TCVN_ET_REAL (3 channel input is expected to be RGB and internally converted to Gray)) | |
ipDecodedData |
Reference To ITcVnContainer |
Returns the decoded code (ContainerType_Vector_String_SINT) |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_ReadPharmaCode
detects and reads a pharmacode in the input image ipSrcImage
. The Pharmacode is a barcode standard. It is designed for good legibility but can only encode integers in the range 3 to 131070. The aim of this standard is high reading speed with few misreadings.
Do not mix up pharmacodes The Pharmacode Standard should not be confused with the Italian or Swiss pharmacodes. These only designate drug identification numbers with a Code39 representation. |
Structure of Pharmacodes
A Pharmacode consists of thick and thin bars (dark) and gaps between them (light). For good legibility, sufficient size and contrast of the code in the image are recommended. Decoding is based on the following table:
Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Thin line | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Thick line | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 |
Detailed information on the specification of Pharmacodes can be found online: Pharmacode Guide from Laetus
Parameter
Input image
The input image ipSrcImage
must have 1 or 3 channels. 3-channel images must be of the type USINT
, UINT
or REAL
and must be in the RGB color space. They are converted internally into a grayscale image.
Read data (Return value)
The data read from the code are returned as a string in the container ipDecodedData
. The container is of the type ContainerType_Vector_String_SINT
.
Expert parameters
The expert version F_VN_ReadPharmaCodeExp contains additional parameters.
Read data from container
If the code was successfully found and decoded, the code content is returned in the container ipDecodedData
and can be exported to a string using the function F_VN_ExportSubContainer_String.
hr := F_VN_ExportSubContainer_String( ipDecodedData, 0, sText, nMaxLength, hr);
Samples
Related functions
- F_VN_ReadPharmaCode for reading pharmacodes
- F_VN_ReadBarcode for reading barcodes
- F_VN_ReadDataMatrixCode for reading data matrix codes
- F_VN_ReadQRCode for reading QR codes
Required License
TC3 Vision Code Reading
System Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT V3.1.4024.54 or later | PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |