Operators |
decode_1d_bar_code — Decoding of a sequence of elements of a bar code.
decode_1d_bar_code is obsolete and is only provided for reasons of backward compatibility. New applications for reading bar codes should use the functionalities in the chapter Identification / Bar Code instead (see find_bar_code).
decode_1d_bar_code( : : BarCodeElements, BarCodeDescr : Characters, Reference, IsCorrect)
decode_1d_bar_code decodes a sequence of elements which have been extracted by find_1d_bar_code or get_1d_bar_code into a sequence of characters. As input the widths of the elements (in pixels) are used. The discrete form as it is returned from discrete_1d_bar_code can optionally be used. Otherwise decode_1d_bar_code creates the discrete form automatically.
The result of decode_1d_bar_code is a sequence of Characters and the corresponding reference numbers (Reference). In addition a parity check is applied, the result of which is returned in IsCorrect. If all characters are used to store user data (i.e. no parity is used) the value of this parameter has to be ignored.
For bar codes of type Pharmacode the reading direction cannot be determined from the bar code data because the bar code does not specify extra characters (like start, stop, or parity check characters) that enable the determination of a reading direction, and hence the bar code can always be decoded in both directions. Therefore, for PharmaCodes the results of decoding the code in both possible reading directions are returned as two values in Characters as well as Reference. The decision which Element of Characters and Reference contains the correct reading direction must be made by the caller based on the orientation of the bar code (as returned in the parameter Orientation in find_1d_bar_code and find_1d_bar_code_region). The respective first element of Characters and Reference corresponds to the standard reading direction in the orientation given by Orientation , while the second element corresponds to the opposite reading direction. If, for example, the orientation is 0, the first element corresponds to the reading direction from right to left. If the orientation is pi / 2, the first element corresponds to the reading direction from top to bottom.
Widths of the elements of the bar code.
Description of a bar code class.
Decoded characters in standard interpretation.
Decoded characters as numbers.
Information whether the bar code is correct.
List of values: 0, 1
HTuple empty; // empty list of values HTuple BarCodeDescr; HTuple BarcodeFound,Elements,Orientation; HTuple Characters,Reference,IsCorrect; Hobject Image,CodeRegion; gen_1d_bar_code_descr("EAN 13",13,13,&BarCodeDescr); find_1d_bar_code(Image,&CodeRegion,BarCodeDescr,empty,empty, &BarcodeFound,&Elements,&Orientation); if (BarcodeFound[0].l) { decode_1d_bar_code(Elements,BarCodeDescr, &Characters,&Reference,&IsCorrect); if (IsCorrect[0].l) for (int i=0; i<Characters.Num(); i++) { char *value = Characters[i]; } }
The operator decode_1d_bar_code returns the value 2 (H_MSG_TRUE) if the transfered bar code description is correct and the element list can be decoded.
find_1d_bar_code, get_1d_bar_code
Bar Code
Operators |