You are here: Start » Tutorial Exercises » Read the Barcode

Read the Barcode

Aim:

Create an application that reads data from a graphical barcode.

Input:

A single image which contains a 1D barcode of EAN13 type.

Barcode image is stored in the read_barcode directory.

Output:

Draw the read barcode value on the input image.

Hints:

This exercise presents a way to extract data from a graphical 1D code (barcode).

To find and read the barcode, the ReadSingleBarcode filter may be used.

Labeling connections is explained in this article.

Solution (FIS):

  1. Add the LoadImage filter to the ACQUIRE section to read an image from the file.
  2. Add the ReadSingleBarcode filter to the PROCESS section as the second filter in the program.
  3. To draw the recognized value on the image use the DrawStrings_SingleColor filter. Set the text position at inLocations and connect outBarcode.Text with inStrings.
  4. Parameters of the drawn text can be set using inSize and inColor inputs or in the Properties window.
  5. Add outImage output of the DrawStrings_SingleColor filter to a preview window.
  6. Add the value of outBarcode.Position to the preview window to show the location of the found barcode.

Main macrofilter uses basic filters to obtain data from a barcode.