You are here: Start » Program Examples » Bars

Bars

Aim

Reads a barcode with a basic 1D Edge Detection filter.

Input

An image containing a EAN13 barcode.

Output

Decoded barcode.

Solution (AVS)

  1. Add the LoadImage filter to the ACQUIRE section in order to load a single image from a file.
  2. Add the ScanMultipleStripes filter to detect stripes that create a barcode.

    • Click the "..." button at the inScanPath input to open the GUI for drawing paths of scanning. Draw a horizontal path that intersects the stripes roughly at the vertical center of the stripes. The path shouldn't be longer than a bright rectangle that contains the barcode have the same length as an image width. Click OK to close the GUI.
    • Set the inScanWidth parameter to 15.
    • In filter parameters set the value of ProfileInterpolation to Quadric3. Make sure the StripePolarity parameter is set to Any.
    • Click on Show/Hide Ports at the bottom of the filter and check the Width option in the outStripes submenu. This will allow us to see the width of the detected stripes.
  3. Add the DecodeBarcode filter to read the barcode. Connect it to the outStripes.Width output of the ScanMultipleStripes.

  4. Set the inBarcodeFormat parameter to EAN13.
  5. Show the decoded text on a new preview window.

Macrofilter Main

Used Filters

Icon Name Description
ScanMultipleStripes Very fast detection of multiple pairs of opposite edges - usually for counting or width measurements.
DecodeBarcode Decoding of barcodes whose bars have been measured in a non-standard way.
LoadImage Loads a single image from a file.