You are here: Start » Tutorial Exercises » Read the QR Code (read_qr_code)

Read the QR Code (read_qr_code)

Aim

Devise an algorithm that reads QR codes from images.

Input

A set of images with QR Codes captured under different lighting conditions.

Images are stored in the ''read_qr_code'' directory.

Output

A position and a text read from a QR Code. The read text should be drawn on the input image.

Hints

This exercise shows the concept of performing one of the most typical vision problems. It can be solved using a predefined set of filters. In this case, only a single filter is used to determine the code position and to read data from it.

To get images from a directory filter EnumerateImages should be used. To find the QR Code in an image use a high-level ReadSingleQRCode filter. Filter DrawStrings_SingleColor may be helpful to show the results.

Solution (AVS)

  1. Add EnumerateImages filter to obtain images from a directory. Enter image directory path on the inDirectory input.

  2. Add ReadSingleQRCode filter to the program. Connect outImage from EnumerateImages to inImage input of ReadSingleQRCode filter.

  3. Add DrawStrings_SingleColor filter to the project and configure inputs: inLocations and inColor.

  4. Connect outQRCode.Text of filter ReadSingleQRCode to inStrings input of DrawStrings_SingleColor filter.

  5. Add outImage of filter DrawStrings_SingleColor to a preview window.

Main macrofilter reads data from a QR code and writes result on an input image.