This chapter provides an introduction to bar codes and the most important terms used when finding and reading bar codes in HALCON.
A bar code consists of several dark bars and bright spaces. For every bar code there is a smallest possible element, the narrowest possible bar or the narrowest possible space, which is called module. In general, the width of the bars and spaces is different, but always a multiple of the module. Several bars and spaces together form a pattern. This pattern encodes a symbol defined in a decoding table. The conventions how such a binary pattern encodes a symbol and the corresponding decoding table lead to the respective bar code type. In addition to the patterns encoding the symbols, there are also patterns with special tasks. Depending on the type there are further patterns which can or must be part of the bar code:
Quiet-zone: Zone in which no edges may occur. This zone is required before the start character and after the stop character to find the code.
Start and stop pattern: Define start, stop and direction. These patterns make it possible to read and decode the code from left to right as well as from right to left (and thus upside down).
Checksum: A digit which serves as a security check to ensure the code has been read correctly.
Guard pattern: Specific pattern, which can occur on the left, right, or in the center as additional symbol.
Finder patterns: Pattern used to locate the symbol.
Add-on symbol: Additional symbols for encoding of supplementary information. These symbols are encoded as bar codes with restricted length.
Composite bar codes consist of the following elements:
Linear bar code: As described above.
2D Code: For more information about 2D codes we refer to the
“Solution Guide II-C - 2D Data Codes”
.
Linking pattern: Combines the two codes mentioned before.
The following figure shows a schematic representation of a composite bar code.
To be able to read a bar code in an image, it must be found first. The regions in which HALCON assumes a bar code are called candidates.
To read a candidate, different lines are laid through the region, called scanlines. Although theoretically a single scanline would be sufficient, one tries to decode the bar code along all scanlines. This increases the chance of decoding the code correctly. In addition, several successfully decoded scanlines allow additional plausibility checks, i.e., reading several scanlines equally decreases the chance of false positives.
The workflow and various examples showing how to read bar codes in HALCON
can be found in the “`Solution Guide I - Basics
.
clear_bar_code_model
create_bar_code_model
decode_bar_code_rectangle2
deserialize_bar_code_model
find_bar_code
get_bar_code_object
get_bar_code_param
get_bar_code_param_specific
get_bar_code_result
query_bar_code_params
read_bar_code_model
serialize_bar_code_model
set_bar_code_param
set_bar_code_param_specific
write_bar_code_model