You are here: Start » Tutorial Exercises » Read the Barcode (read_barcode)

Read the Barcode (read_barcode)

Aim

Create an application that reads data from a graphical barcode.

Input

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

Barcode image is stored in the read_barcode directory.

Output

Draw the read barcode value on an input image.

Hints

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

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

Solution (AVS)

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

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