get_data_code_2d_param — Get one or several parameters that describe the 2D data code model.
The operator get_data_code_2d_param allows to query the parameters that are used to describe the 2D data code model. The names of the desired parameters are passed in the generic parameter GenParamNames, the corresponding values are returned in GenParamValues. All these parameters can be set and changed at any time with the operator set_data_code_2d_param. A list with the names of all parameters that are valid for the used 2D data code type is returned by the operator query_data_code_2d_params.
Note that the symbol structure of GS1 DataMatrix, GS1 QR Code, and GS1 Aztec is identical to the structure of ECC 200, QR Code, and Aztec Code, respectively. Therefore, all symbology specific parameters applying to ECC 200, QR Code, or Aztec Code apply to their corresponding GS1 variant as well. In the following, the explicit enumeration of the parameters for any particular GS1 code is omitted for sake of readability. Instead, the relevant parameters names are to be inferred from the parametes for the corresponding non-GS1 code type or can be explicitly queried by query_data_code_2d_params with parameter 'get_model_params'.
The following parameters can be queried - ordered by different categories and data code types:
Size and shape of the symbol:
Data matrix ECC 200 (including the finder pattern):
Minimum number of module columns in the symbol.
Maximum number of module columns in the symbol.
Minimum number of module rows in the symbol.
Maximum number of module rows in the symbol.
Possible restrictions concerning the module shape (rectangle and/or square): 'square', 'rectangle', 'any'. Since HALCON 7.1.1, the same search algorithm is used for both shapes.
QR Code (including the finder pattern):
Type of the QR Code model specification: 1, 2, 0 (for 'any')
Minimum symbol version to be read: [1..40] (Model 1: [1..14])
Maximum symbol version to be read: [1..40] (Model 1: [1..14])
Minimum symbol size (this value is directly linked to the version 'version_min'): [21..177] (Model 1: [21..73])
Maximum symbol size (this value is directly linked to the version 'version_max'): [21..177] (Model 1: [21..73])
Micro QR Code:
Minimum symbol version to be read: [1..4]
Maximum symbol version to be read: [1..4]
Minimum symbol size (this value is directly linked to the version 'version_min'): [11..17]
Maximum symbol size (this value is directly linked to the version 'version_max'): [11..17]
Minimum number of data columns in the symbol in codewords, i.e., excluding the codewords of the start/stop pattern and of the two row indicators.
Maximum number of data columns in the symbol in codewords, i.e., excluding the codewords of the start/stop pattern and of the two row indicators.
Minimum number of module rows in the symbol.
Maximum number of module rows in the symbol.
Aztec Code (including the finder pattern):
Format of the Aztec Code: space separated list with the values 'compact', 'full_range', or 'rune'
Minimum symbol size [11..151]
Maximum symbol size [11..151]
Appearance of the modules in the image:
All data code types:
Possible restrictions concerning the polarity of the modules, i.e., if they are printed dark on a light background or vice versa: 'dark_on_light', 'light_on_dark', 'any'.
Describes whether the symbol is or may be mirrored (which is equivalent to swapping the rows and columns of the symbol): 'yes', 'no', 'any'.
Minimum contrast between the foreground and the background of the symbol (this measure corresponds to the minimum gradient between the symbol's foreground and the background).
Robustness of the decoding of data codes with very small module sizes. Setting the parameter 'small_modules_robustness' to 'high' increases the likelihood of being able to decode data codes with very small module sizes. Additionally, in that case the minimum module size should also be adapted accordingly, thus 'module_size_min' and 'module_width_min' (PDF417) should be set to the expected minimum module size and width, respectively. Setting 'small_modules_robustness' to 'high' can significantly increase the internal memory usage of find_data_code_2d. Thus, in the default case 'small_modules_robustness' should be set to 'low'.
Values: 'low', 'high'
Default: 'low' (enhanced: 'low', maximum: 'high')
Data matrix ECC 200, QR Code, Micro QR Code, and Aztec Code:
Minimum module size in the image in pixels.
Maximum module size in the image in pixels.
With the following parameters it is possible to specify whether neighboring foreground modules are connected or whether there is or may be a gap between them (possible values are 'no' (no gap) < 'small' < 'big'):
Minimum gap in direction of the symbol columns.
Maximum gap in direction of the symbol columns.
Minimum gap in direction of the symbol rows.
Maximum gap in direction of the symbol rows.
Minimum module width in the image in pixels.
Maximum module width in the image in pixels.
Minimum module aspect ratio (module height to module width).
Maximum module aspect ratio (module height to module width).
Tolerance of the search with respect to a defect or partially occluded finder pattern. Depending on this parameter, different algorithms are used during the symbol search in find_data_code_2d. In one case ('low'), it is assumed that all rings of the finder pattern can be extracted. In the other case ('high') it is assumed that at least one of the rings of the finder pattern can be extracted.
To increase the robustness of the Aztec Code reader, a number of additional search levels (in addition to the search levels derived from the minimum and maximum module dimensions) can be specified via this parameter. [0..2]
Data matrix ECC 200:
Maximum slant of the L-shaped finder pattern (the angle is returned in radians and corresponds to the distortion that occurs when the symbol is printed or during the image acquisition).
Tolerance of the search with respect to a defect or partially occluded finder pattern. The finder pattern includes the L-shaped side as well as the opposite alternating side. Depending on this parameter, different algorithms are used during the symbol search in find_data_code_2d. In one case ('low'), it is assumed that the finder pattern is present to a high degree and shows almost no disturbances. In the other case ('high'), the finder pattern may be defect or partially occluded without influencing the recognition and the reading of the symbol. Note, however, that in this mode the parameters for the symbol search should be restricted as narrow as possible by using set_data_code_2d_param because otherwise the runtime of find_data_code_2d may increase significantly. Also note that the two algorithms slightly differ from each other in terms of robustness. This may lead to different results depending on the value of 'finder_pattern_tolerance' even if the finder pattern of the symbol is not disturbed. For example, if 'high' is chosen, only symbols with an equidistant module grid can be found (see below), and hence the robustness to perspective distortions is decreased. Finally, if 'finder_pattern_tolerance' is set to 'any' both algorithms are applied.
Describes whether the size of the modules may vary (in a specific range) or not. Dependent on the parameter different algorithms are used for the calculation of the module's center positions. If it is set to 'fixed', an equidistant grid is used. Allowing a variable module size ('variable'), the grid is aligned only to the alternating side of the finder pattern. With 'any' both approaches are tested one after the other. Please note that the value of 'module_grid' is ignored if 'finder_pattern_tolerance' is set to 'high'. In this case, an equidistant grid is assumed.
Describes the tolerance of the search with respect to local contrast variations (e.g., in the presence of glare or reflections). Depending on the value of the parameter two different algorithms are applied. If 'contrast_tolerance' is set to 'high' the robustness in the presence of strong local contrast variations is improved. In the case where 'contrast_tolerance' is set to 'low' the algorithm less robust to strong local contrast variations, however it is faster and still able to handle contrast variations under normal circumstances and therefore 'low' should be used in most cases. If 'contrast_tolerance' is set to 'any' both algorithms are applied.
Number of position detection patterns that have to be visible for generating a new symbol candidate (2 or 3).
General model behavior:
All data code types:
Controls whether certain intermediate results of the symbol search with find_data_code_2d are stored only temporarily or persistently in the model: 0 (temporary), 1 (persistent).
Controls the behavior of find_data_code_2d while detecting symbols that could be read but that do not fit the model restrictions concerning the size of the symbols: 'yes' (strict: such symbols are rejected), 'no' (not strict: all readable symbols are returned as a result independent of their size and the size specified in the model).
All data code types except Aztec Code:
Controls the behavior of find_data_code_2d while detecting symbols that could be read but show defects in their quiet zone. If 'strict_quiet_zone' is set to 'yes' the quiet zone of all decoded symbol is validated similiar to the method used for print quality inspection. Symbols with poor grades for their quiet zone are not returned as a result. Their 'status' is set to 'quiet zone is missing'. If 'strict_quiet_zone' is set to 'no' (this is the default case), all readable symbols are returned as a result.
It is possible to query the values of several or all parameters with a single operator call by passing a tuple containing the names of all desired parameters to GenParamNames. As a result a tuple of the same length with the corresponding values is returned in GenParamValues.
Handle of the 2D data code model.
Names of the generic parameters that are to be queried for the 2D data code model.
Default value: 'contrast_min'
List of values: 'additional_levels', 'contrast_min', 'contrast_tolerance', 'discard_undecoded_candidates', 'finder_pattern_tolerance', 'mirrored', 'model_type', 'module_aspect_max', 'module_aspect_min', 'module_gap_col_max', 'module_gap_col_min', 'module_gap_row_max', 'module_gap_row_min', 'module_grid', 'module_size_max', 'module_size_min', 'module_width_max', 'module_width_min', 'persistence', 'polarity', 'position_pattern_min', 'slant_max', 'small_modules_robustness', 'strict_model', 'strict_quiet_zone', 'symbol_cols_max', 'symbol_cols_min', 'symbol_rows_max', 'symbol_rows_min', 'symbol_shape', 'symbol_size_max', 'symbol_size_min', 'version_max', 'version_min'
Values of the generic parameters.
The operator get_data_code_2d_param returns the value 2 (H_MSG_TRUE) if the given parameters are correct. Otherwise, an exception is raised.
query_data_code_2d_params, set_data_code_2d_param, find_data_code_2d
query_data_code_2d_params, set_data_code_2d_param, get_data_code_2d_results, get_data_code_2d_objects, find_data_code_2d