Herror ::decode_1d_bar_code (
    const HTuple &BarCodeElements,
    const HTuple &BarCodeDescr,
    HTuple *Characters,
    HTuple *Reference,
    HTuple *IsCorrect
)

Decoding of a sequence of elements of a barcode.

::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.


Parameters

BarCodeElements (input_control)
number-array -> HTuple.double
Widths of the elements of the barcode.

BarCodeDescr (input_control)
string-array -> HTuple.char * / long / double
Description of a bar code class.

Characters (output_control)
string-array -> HTuple.char *
Decoded characters in standard interpretation.

Reference (output_control)
integer-array -> HTuple.long *
Decoded characters as numbers.

IsCorrect (output_control)
integer -> HTuple.long *
Information whether the barcode is correct.
List of values: 0, 1


Example
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];
    }
}

Result

The operator ::decode_1d_bar_code returns the value H_MSG_TRUE if the transfered barcode description is correct and the element list can be decoded.


Possible Predecessors

::find_1d_bar_code, ::get_1d_bar_code


Module

Barcode reader



Copyright © 1996-2002 MVTec Software GmbH