Herror ::discrete_1d_bar_code (
    const HTuple &Elements,
    const HTuple &BarCodeDescr,
    HTuple *DisrecteBarCode
)

Generate a discrete barcode from the elements widths.

::discrete_1d_bar_code converts the list of element widths (output from ::find_1d_bar_code or ::get_1d_bar_code) into a discrete barcode. Thus every element is then represented by its number of modules (1,2,..) and no longer as its width in pixels.

This operator is used if the barcode type is not available so that ::decode_1d_bar_code cannot be applied, thus the user wants to find the barcode with the help of HALCON operators and then himself decode the barcode. To create the barcode description the operator ::gen_1d_bar_code_descr_gen is used and with ::find_1d_bar_code the element widths are extracted. Then ::discrete_1d_bar_code is used to create the list of the multiple of the modules.


Parameters

Elements (input_control)
number-array -> HTuple.double
List of elements widths of the barcode.

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

DisrecteBarCode (output_control)
number-array -> HTuple.long *
Widths of elements as multiple of modules.


Example
HTuple   empty;   // empty list of values
HTuple   BarCodeDescr;
HTuple   BarcodeFound,Elements,Orientation;
HTuple   DiscreteBarCode;
Hobject  Image,CodeRegion;

gen_1d_bar_code_descr_gen(20,40,2,empty,empty,-1.0,"false",&BarCodeDescr);
find_1d_bar_code(Image,&CodeRegion,BarCodeDescr,empty,empty,
                 &BarcodeFound,&Elements,&Orientation);
if (BarcodeFound[0].l)
{
  discrete_1d_bar_code(Elements,BarCodeDescr,&DiscreteBarCode);
  for (int i=0; i<DiscreteBarCode.Num(); i++)
  {
    int NumModules = DiscreteBarCode[i];
  }
}

Result

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


Possible Predecessors

::find_1d_bar_code, ::get_1d_bar_code


See also

::decode_1d_bar_code


Module

Barcode reader



Copyright © 1996-2002 MVTec Software GmbH