find_2d_bar_code ( Image : CodeRegion : BarCodeDescr, GenParamNames, GenParamValues : CodeRegDescr )

Find regions that might contain a 2D bar code.

find_2d_bar_code searches in the image Image for regions that might contain a 2D bar code. Candidate regions are returned in the array of regions CodeRegion. Whether such a region really contains a (readable) 2D bar code can only be determined with the help of the operator get_2d_bar_code (or get_2d_bar_code_pos).

Besides regions that might contain a 2D bar code, the operator passes further, internal information about the regions to the operator for extracting the data from a symbol (get_2d_bar_code or get_2d_bar_code_pos). This information is stored in a region descriptor and returned in the parameter CodeRegDescr.

Depending on the method for printing the bar code ('mode'), different image processing steps are performed. Together with other information about the 2D bar code, the actual printing method is part of a descriptor created with the help of the operator gen_2d_bar_code_descr and passed in the parameter BarCodeDescr.

In the case of difficult conditions, additional control parameters can be passed to the operator with the help of the (optional) generic parameters GenParamNames nd GenParamValues, in the form of descriptor-value pairs. One group of parameters describes the appearance of the symbols in the actual images, e.g., the expected size of data elements in pixels. The operator will then check candidate regions against the specified criteria. Suitable values can be determined from the real images, e.g., by manually selecting a region with a bar code and then applying the corresponding operator. If the specification of such parameters does not lead to successfully extracted regions, the user can influence the underlying image processing operators directly with the help of a second group of parameters. As the image processing steps taken depend on the printing method, different parameters are to be applied.

Parameter that will be passed on in CodeRegDescr:

   'module_width'   Mean size of a module (data element) in pixels.

                    From this quantity, a set of other parameters will be derived.
                    A module should have a size of 4 to 16 pixels 
                    in order to be recognized successfully.

                    GenParamValues: > 0
                    default:        10

Parameters for the printing method 'printed':

   The following parameters are used to limit the set of candidate regions
   with the help of region features. To prevent the use of a certain feature,
   the corresponding parameter must be set to -1.

   'anisometry_max'   Maximum anisometry (see operator eccentricity)
                      GenParamValues: > 1  (-1: feature not used)
                      default:        1.45

   'compactness_min'  Minimum compactness (see operator compactness)
                      GenParamValues: > 1  (-1: feature not used)
                      default:        1.2

   'compactness_max'  Maximum compactness 
                      GenParamValues: >= 'compactness_min'  (-1: feature not used)
                      default:        3.0

   'circularity_max'  Maximum circularity (see operator circularity)
                      GenParamValues: 0...1  (-1: feature not used)
                      default:        0.8

   'circularity_min'  Minimum circularity
                      GenParamValues: <= 'circularity_max'  (-1: feature not used)
                      default:        0.45

   'deviation_min'    Minimum deviation of gray values (see operator intensity)
                      GenParamValues: > 1.0
                      default:        20.0

   The following parameters are automatically derived from the size of a module, 'module_width', 
   and from parameters of the bar code descriptor BarCodeDescr (see operator 
   gen_2d_bar_code_descr). However, they can be adjusted individually, too.
   ATTENTION: If you want to set 'module_width' together with other parameters, 
   make sure set 'module_width' BEFORE the others!

   'mean_mask_size_1' Mask size for the first smoothing of the image.
                      GenParamValues: >= 3
                      default:        2.5*'module_width'

   'mean_mask_size_2' Mask size for the second smoothing of the image.
                      GenParamValues: >= 5
                      default:        10.0*'module_width'

   'area_min'         Minimum size of the symbol in pixels squared.
                      GenParamValues: > 0
                      default:        0.25 * 'module_width'^2 * 'columns_min' * 'rows_min'

   'area_max'         Maximum size of the symbol in pixels squared.
                      GenParamValues: >= 'area_min'
                      default:        4.00 * 'module_width'^2 * 'columns_min' * 'rows_min'

   'closing_mask_rad' Mask size for calling the operator closing_circle with a test region.
                      GenParamValues: > 0
                      default:        'module_width'


Parameters for the printing method 'engraved_darkfield':

   'compactness_min'  Minimum compactness (see operator compactness)
                      GenParamValues: > 1.0  (-1: feature not used)
                      default:        1.2

   'compactness_max'  Maximum compactness
                      GenParamValues: >= 'compactness_min'  (-1: feature not used)
                      default:        3.0

   'edge_thresh'      Threshold in the edge image
                      GenParamValues: 0...255
                      default:        120

   'region_rect2_rel' Relation between the areas of the region and the 
                      smallest surrounding rectangle.
                      GenParamValues: < 1.0
                      default:        0.7

   'median_mask_rad'  Mask size for the initial median filtering (see operator median_image).
                      GenParamValues: > 0
                      default:        0.1 * 'module_width' + 0.5


Parameters for the printing method 'engraved_lightfield':

   'anisometry_max'   Maximum anisometry (see operator eccentricity)
                      GenParamValues: > 1  (-1: feature not used)
                      default:        1.45

   'compactness_min'  Minimum compactness (see operator compactness)
                      GenParamValues: > 1  (-1: feature not used)
                      default:        1.2

   'compactness_max'  Maximum compactness 
                      GenParamValues: >= 'compactness_min'  (-1: feature not used)
                      default:        3.0

   'circularity_max'  Maximum circularity (see operator circularity)
                      GenParamValues: 0...1  (-1: feature not used)
                      default:        0.8

   'circularity_min'  Minimum circularity
                      GenParamValues: <= 'circularity_max'  (-1: feature not used)
                      default:        0.45

   'deviation_min'    Minimum deviation of gray values (see operator intensity)
                      GenParamValues: > 1.0
                      default:        20.0

   'mean_mask_size'   Mask size for smoothing the image.
	              GenParamValues: >= 3
                      default:        1.5*'module_width'

   'area_min'         Minimum size of the symbol in pixels squared.
                      GenParamValues: > 0
                      default:        0.25 * 'module_width'^2 * 'columns_min' * 'rows_min'

   'area_max'         Maximum size of the symbol in pixels squared.
                      GenParamValues: >= 'area_min'
                      default:        4.00 * 'module_width'^2 * 'columns_min' * 'rows_min'

   'closing_mask_rad' Mask size for calling the operator closing_circle with a test region.
                      GenParamValues: > 0
                      default:        'module_width'

   'opening_mask_rad' Mask size for calling the operator opening_circle with a test region.
                      GenParamValues: > 0
                      default:        1.5*'module_width'



Parameters

Image (input_object)
image -> object
Image of one or more bar codes.

CodeRegion (output_object)
region(-array) -> object
Regions that might contain a bar code.

BarCodeDescr (input_control)
string-array -> string / integer / real
Description of a 2D bar code class to look for.

GenParamNames (input_control)
string(-array) -> string
List of names of (optional) generic parameters controlling the image processing.
Default value: '[]'

GenParamValues (input_control)
number(-array) -> real / integer / string
List of values of generic parameters controlling the image processing.
Default value: '[]'

CodeRegDescr (output_control)
string-array -> string / integer / real
Additional parameters describing the bar code regions. They can be used for extracting the data (see decode_2d_bar_code).


Result

The operator find_2d_bar_code returns the value 2 (H_MSG_TRUE) if the given parameters are correct. Otherwise, an exception will be raised.


Possible Predecessors

gen_2d_bar_code_descr


Possible Successors

get_2d_bar_code, get_2d_bar_code_pos


Module

Barcode reader


Copyright © 1996-2000 MVTec Software GmbH