ClassesClassesClassesClasses | | | | Operators

get_2d_bar_code_posT_get_2d_bar_code_posGet2dBarCodePosget_2d_bar_code_posGet2dBarCodePosGet2dBarCodePos (Operator)

Name

get_2d_bar_code_posT_get_2d_bar_code_posGet2dBarCodePosget_2d_bar_code_posGet2dBarCodePosGet2dBarCodePos — Extract the data values of the elements (in ECC 200: “modules”) inside a bar code region (“Data Matrix symbol”) and their positions in the image.

Warning

get_2d_bar_code_posget_2d_bar_code_posGet2dBarCodePosget_2d_bar_code_posGet2dBarCodePosGet2dBarCodePos is obsolete and is only provided for reasons of backward compatibility. New applications should use the functionality in the chapter Identification / Data Code for reading 2D data code symbologies instead (see create_data_code_2d_modelcreate_data_code_2d_modelCreateDataCode2dModelcreate_data_code_2d_modelCreateDataCode2dModelCreateDataCode2dModel).

Signature

get_2d_bar_code_pos(BarCodeRegion, Image : : BarCodeDescr, CodeRegDescr, GenParamNames, GenParamValues : BarCodeDimension, BarCodeData, DataElementRow, DataElementCol)

Herror T_get_2d_bar_code_pos(const Hobject BarCodeRegion, const Hobject Image, const Htuple BarCodeDescr, const Htuple CodeRegDescr, const Htuple GenParamNames, const Htuple GenParamValues, Htuple* BarCodeDimension, Htuple* BarCodeData, Htuple* DataElementRow, Htuple* DataElementCol)

Herror get_2d_bar_code_pos(Hobject BarCodeRegion, Hobject Image, const HTuple& BarCodeDescr, const HTuple& CodeRegDescr, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* BarCodeDimension, HTuple* BarCodeData, HTuple* DataElementRow, HTuple* DataElementCol)

HTuple HRegion::Get2dBarCodePos(const HImage& Image, const HTuple& BarCodeDescr, const HTuple& CodeRegDescr, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* BarCodeData, HTuple* DataElementRow, HTuple* DataElementCol) const

HTuple HBarCode2D::Get2dBarCodePos(const HRegion& BarCodeRegion, const HImage& Image, const HTuple& CodeRegDescr, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* BarCodeData, HTuple* DataElementRow, HTuple* DataElementCol) const

void Get2dBarCodePos(const HObject& BarCodeRegion, const HObject& Image, const HTuple& BarCodeDescr, const HTuple& CodeRegDescr, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* BarCodeDimension, HTuple* BarCodeData, HTuple* DataElementRow, HTuple* DataElementCol)

HTuple HImage::Get2dBarCodePos(const HRegion& BarCodeRegion, const HTuple& BarCodeDescr, const HTuple& CodeRegDescr, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* BarCodeData, HTuple* DataElementRow, HTuple* DataElementCol) const

HTuple HRegion::Get2dBarCodePos(const HImage& Image, const HTuple& BarCodeDescr, const HTuple& CodeRegDescr, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* BarCodeData, HTuple* DataElementRow, HTuple* DataElementCol) const

void HOperatorSetX.Get2dBarCodePos(
[in] IHUntypedObjectX* BarCodeRegion, [in] IHUntypedObjectX* Image, [in] VARIANT BarCodeDescr, [in] VARIANT CodeRegDescr, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues, [out] VARIANT* BarCodeDimension, [out] VARIANT* BarCodeData, [out] VARIANT* DataElementRow, [out] VARIANT* DataElementCol)

VARIANT HBarCode2DX.Get2dBarCodePos(
[in] IHRegionX* BarCodeRegion, [in] IHImageX* Image, [in] VARIANT BarCodeDescr, [in] VARIANT CodeRegDescr, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues, [out] VARIANT* BarCodeData, [out] VARIANT* DataElementRow, [out] VARIANT* DataElementCol)

VARIANT HImageX.Get2dBarCodePos(
[in] IHRegionX* BarCodeRegion, [in] VARIANT BarCodeDescr, [in] VARIANT CodeRegDescr, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues, [out] VARIANT* BarCodeData, [out] VARIANT* DataElementRow, [out] VARIANT* DataElementCol)

VARIANT HRegionX.Get2dBarCodePos(
[in] IHImageX* Image, [in] VARIANT BarCodeDescr, [in] VARIANT CodeRegDescr, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues, [out] VARIANT* BarCodeData, [out] VARIANT* DataElementRow, [out] VARIANT* DataElementCol)

static void HOperatorSet.Get2dBarCodePos(HObject barCodeRegion, HObject image, HTuple barCodeDescr, HTuple codeRegDescr, HTuple genParamNames, HTuple genParamValues, out HTuple barCodeDimension, out HTuple barCodeData, out HTuple dataElementRow, out HTuple dataElementCol)

HTuple HImage.Get2dBarCodePos(HRegion barCodeRegion, HTuple barCodeDescr, HTuple codeRegDescr, HTuple genParamNames, HTuple genParamValues, out HTuple barCodeData, out HTuple dataElementRow, out HTuple dataElementCol)

HTuple HRegion.Get2dBarCodePos(HImage image, HTuple barCodeDescr, HTuple codeRegDescr, HTuple genParamNames, HTuple genParamValues, out HTuple barCodeData, out HTuple dataElementRow, out HTuple dataElementCol)

Description

get_2d_bar_code_posget_2d_bar_code_posGet2dBarCodePosget_2d_bar_code_posGet2dBarCodePosGet2dBarCodePos extracts the 2D bar code data from a candidate symbol region given in BarCodeRegionBarCodeRegionBarCodeRegionBarCodeRegionBarCodeRegionbarCodeRegion and the corresponding image given in ImageImageImageImageImageimage elements. In contrast to get_2d_bar_codeget_2d_bar_codeGet2dBarCodeget_2d_bar_codeGet2dBarCodeGet2dBarCode, this operator also returns the positions of the data elements in the image in the parameters DataElementRowDataElementRowDataElementRowDataElementRowDataElementRowdataElementRow and DataElementColDataElementColDataElementColDataElementColDataElementColdataElementCol. This can be used to check the result of the operator, e.g., by displaying the data in the real image. For a description of the other parameters, see get_2d_bar_codeget_2d_bar_codeGet2dBarCodeget_2d_bar_codeGet2dBarCodeGet2dBarCode.

Attention

The operator get_2d_bar_code_posget_2d_bar_code_posGet2dBarCodePosget_2d_bar_code_posGet2dBarCodePosGet2dBarCodePos returns error codes to signal that the candidate region did not contain a valid 2D bar code. As the region candidates extracted by the operator find_2d_bar_codefind_2d_bar_codeFind2dBarCodefind_2d_bar_codeFind2dBarCodeFind2dBarCode can perfectly well encompass regions without a bar code, every call to get_2d_bar_code_posget_2d_bar_code_posGet2dBarCodePosget_2d_bar_code_posGet2dBarCodePosGet2dBarCodePos should be surrounded by error handling code (see example).

Parallelization

Parameters

BarCodeRegionBarCodeRegionBarCodeRegionBarCodeRegionBarCodeRegionbarCodeRegion (input_object)  region objectHRegionHRegionHRegionHRegionXHobject

Region that might contain a bar code.

ImageImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageHImageXHobject (byte)

Corresponding image.

BarCodeDescrBarCodeDescrBarCodeDescrBarCodeDescrBarCodeDescrbarCodeDescr (input_control)  barcode_2d HTupleHTupleHBarCode2D, HTupleHBarCode2DX, VARIANTHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double) (BSTR / Hlong / double) (char* / Hlong / double)

Description of the 2D bar code class.

CodeRegDescrCodeRegDescrCodeRegDescrCodeRegDescrCodeRegDescrcodeRegDescr (input_control)  string-array HTupleHTupleHTupleVARIANTHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double) (BSTR / Hlong / double) (char* / Hlong / double)

Additional parameters describing the bar code region. They can be used for extracting the data.

GenParamNamesGenParamNamesGenParamNamesGenParamNamesGenParamNamesgenParamNames (input_control)  attribute.name-array HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

List of names of (optional) generic control parameters.

Default value: []

List of values: 'border_width'"border_width""border_width""border_width""border_width""border_width", 'border_width_max'"border_width_max""border_width_max""border_width_max""border_width_max""border_width_max", 'border_width_min'"border_width_min""border_width_min""border_width_min""border_width_min""border_width_min", 'enlarge_region_rad'"enlarge_region_rad""enlarge_region_rad""enlarge_region_rad""enlarge_region_rad""enlarge_region_rad", 'gray_erosion_size'"gray_erosion_size""gray_erosion_size""gray_erosion_size""gray_erosion_size""gray_erosion_size", 'max_line_dist1'"max_line_dist1""max_line_dist1""max_line_dist1""max_line_dist1""max_line_dist1", 'max_line_dist2'"max_line_dist2""max_line_dist2""max_line_dist2""max_line_dist2""max_line_dist2", 'measure_sigma'"measure_sigma""measure_sigma""measure_sigma""measure_sigma""measure_sigma", 'measure_thresh'"measure_thresh""measure_thresh""measure_thresh""measure_thresh""measure_thresh", 'median_mask_rad'"median_mask_rad""median_mask_rad""median_mask_rad""median_mask_rad""median_mask_rad", 'min_cont_len'"min_cont_len""min_cont_len""min_cont_len""min_cont_len""min_cont_len", 'module_rad_ratio'"module_rad_ratio""module_rad_ratio""module_rad_ratio""module_rad_ratio""module_rad_ratio", 'smooth_cont'"smooth_cont""smooth_cont""smooth_cont""smooth_cont""smooth_cont", 'thresh_percent'"thresh_percent""thresh_percent""thresh_percent""thresh_percent""thresh_percent", 'thresh_step_width'"thresh_step_width""thresh_step_width""thresh_step_width""thresh_step_width""thresh_step_width", 'use_grayval_max'"use_grayval_max""use_grayval_max""use_grayval_max""use_grayval_max""use_grayval_max", 'use_grayval_min'"use_grayval_min""use_grayval_min""use_grayval_min""use_grayval_min""use_grayval_min", 'use_grayval_range'"use_grayval_range""use_grayval_range""use_grayval_range""use_grayval_range""use_grayval_range", 'use_grayvals'"use_grayvals""use_grayvals""use_grayvals""use_grayvals""use_grayvals"

GenParamValuesGenParamValuesGenParamValuesGenParamValuesGenParamValuesgenParamValues (input_control)  attribute.value-array HTupleHTupleHTupleVARIANTHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*) (double / Hlong / BSTR) (double / Hlong / char*)

List of values of the generic parameters.

Default value: []

Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 'yes'"yes""yes""yes""yes""yes", 'no'"no""no""no""no""no", -1, 1.5, 2.5, 3.5, 4.5, 5.5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50

BarCodeDimensionBarCodeDimensionBarCodeDimensionBarCodeDimensionBarCodeDimensionbarCodeDimension (output_control)  integer-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Tuple with the dimension of the extracted symbol. In the case of ECC 200: data field width, height, symbol index.

BarCodeDataBarCodeDataBarCodeDataBarCodeDataBarCodeDatabarCodeData (output_control)  integer-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Tuple with the data values of the extracted symbol. value > 0: logical 1, value < 0: logical 0, value = 0: module could not be classified.

DataElementRowDataElementRowDataElementRowDataElementRowDataElementRowdataElementRow (output_control)  real-array HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Tuple with the row positions of the data elements of the extracted symbol in the image.

DataElementColDataElementColDataElementColDataElementColDataElementColdataElementCol (output_control)  real-array HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Tuple with the column positions of the data elements of the extracted symbol in the image.

Example (HDevelop)

dev_set_check ('~give_error')
get_2d_bar_code_pos (ObjectSelected, Image, BarCodeDescr, \
                     CodeRegDescr, [], [], BarCodeDimension, BarCodeData, \
                     DataElementRow, DataElementCol)
err := ErrorCode
dev_set_check ('give_error')
if (err = 2)
  idx := 0
  dev_update_pc ('off')
  dev_update_time ('off')
  dev_update_var ('off')
  for m := 0 to BarCodeDimension[0]-1 by 1
    for n := 0 to BarCodeDimension[1]-1 by 1
      if (BarCodeData[idx]>0)
        set_color (WindowHandle, 'green')
      else
        if (BarCodeData[idx]<0)
          set_color (WindowHandle, 'red')
        else
          set_color (WindowHandle, 'blue')
        endif
      endif
      disp_circle (WindowHandle, DataElementRow[idx], \
                   DataElementCol[idx], 1)
      idx := idx+1
    endfor
  endfor
  dev_update_pc ('on')
  dev_update_time ('on')
  dev_update_var ('on')
  decode_2d_bar_code (BarCodeDescr, BarCodeDimension, BarCodeData, \
                      SymbolCharacters, CorrSymbolData, DecodedData, \
                      DecodingError, StructuredAppend)
endif

Result

The return value can signal incorrect parameters as well as the failure to extract a 2D bar code. Such a failure can be due to different causes: If no surrounding rectangle was found, the operator returns the error code 8808. Error code 8807 signals that the rectangle does not lie completely inside the image. If no finder pattern was detected inside the border search area, the error code 8810 is returned. If the two continuous lines forming the 'L' of the finder pattern could not be found, the error code 8809 is returned. In the case of the printing method 'engraved_darkfield'"engraved_darkfield""engraved_darkfield""engraved_darkfield""engraved_darkfield""engraved_darkfield", the error code 8811 signals that none of the gray value features can separate the test regions, i.e., that modules cannot be classified.

Module

Data Code


ClassesClassesClassesClasses | | | | Operators