| Developers' Corner

Introduction to new sub-pixel feature of bar code reader

Do you have small resolution bar codes to read but don't get any good results? Then please try our new feature – the subpixel bar code reader.
image without new feature
New feature off
image with new feature
New feature on
Image with bar code rotation
Bar code identified under rotation

The sub-pixel bar code reader now decodes bar codes with very small (<1.3 pixel) element sizes more robustly. It is even able to read bar codes with element sizes smaller than one pixel.

Let's see what it can achieve with our example script barcode_small_elements_robustness.hdev, which you find in HALCON installation in %HALCONEXAMPLES% \hdevelop\Identification\Bar-Code since HALCON 20.05 Progress and HALCON 20.11 Steady.

Performance w.r.t pixel size

To activate the feature, the parameter 'small_elements_robustness' has to be set to 'true', which is the default value. Additionally 'element_size_min' has to be set to a value smaller than 2.0 (via set_bar_code_param, values between 0.6 and 2.0 are possible for this feature).

If optical conditions are optimal (small amount of blur and slight rotation with respect to the bar code), bar codes with element size smaller than one pixel can be read robustly. Fig.1 shows the reading of a bar code with element size of 0.69 pixel with new feature and without.

Performance w.r.t rotation

An additional decoding algorithm is performed within the new feature, which is specialized for small elements and works for (non-stacked) codes without occlusions. For this algorithm, it is beneficial to slightly rotate the camera sensor with respect to the bar code (e.g. around 7 degrees). This is important because in such low resolution cases the bar code information is contained in multiple rows/columns of the perceived image only if it is rotated.

General recommendations

Since the reading of such small bar codes is really challenging, a few pre-conditions have to be kept in mind as following:

Acquisition requirements:

  • Use the advantages of rotation: by rotation more information can be contained in the image.
  • Avoid blur: especially for codes with very low resolution it is recommended that images are as focused as possible.

Image requirements:

  • Use byte images.
  • Ensure that the bar code is higher than 30 pixels.
  • Avoid occlusions in small bar codes for the subpixel feature to perform.

Other remarks:

  • Please don't preprocess the images, e.g., emphasize, zoom, rotate.
  • Our new subpixel feature is not applicable for stacked/composite codes yet.
  • PQI still works, but will result in failing grade 0 / F.