You are here: Start » Tutorial Exercises » Read the QR Code
Read the 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 text read from a QR Code. The read text should be drawn in 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 read data from it.
To get images from a directory, the EnumerateImages filter should be used. To find the QR Code in an image, use a high-level ReadSingleDataCode filter. The DrawStrings_SingleColor filter may be helpful to show the results.
Labeling connections is explained in this article.
Solution (AVS):
-
Add the EnumerateImages filter to the ACQUIRE section to obtain images from a directory. Enter the image directory path into the inDirectory input.
-
Add the ReadSingleDataCode filter to the PROCESS section. Connect the outImage output of the EnumerateImages filter to the inImage input of the ReadSingleDataCode filter.
-
Add the DrawStrings_SingleColor filter to the project and configure the inputs: inLocations and inColor. Set the inSize to 20.
-
Connect the outDataCode.Text output of the ReadSingleDataCode filter to the inStrings input of the DrawStrings_SingleColor filter.
-
Add the outImage of the DrawStrings_SingleColor filter to a preview window.
-
Use Auto-Tune functionality to automatically set the parameters of the ReadSingleDataCode filter. To do this, right-click on the filter and open Auto-Tune window. Select the Auto-Tune button to start the process. The filter will automatically adjust its parameters to achieve optimal performance.