How Do I Read Multiple QR Codes Using NI-Vision?

Updated Oct 26, 2020



  • Vision Development Module
  • LabVIEW

I am using IMAQ Read QR Code VI to read QR codes in my image. Can I read multiple QR codes in the same image using this VI?

The IMAQ Read QR Code VI has no input to specify the number of QR codes to detect. The expectation is that the ROI specified to this VI will only contain one QR code which can be read.
However, there is no such limitation while using Pattern Matching, either using Vision Assistant or IMAQ VIs. The number of matches to find can be specified in pattern matching. This can be leveraged to read multiple QR codes as shown below:

Figure 1: Block Diagram
  1. This snippet is from the Main VI (Read Multiple QR in the attached LabVIEW project. 
  2. In this VI, the image is loaded (QR CODES.png) and pattern matching is performed on it. Note that the template used (TestTemplate.png) is created using NI-Vision Template editor in NI-Vision Assistant Express VI.
  3. The pattern matching results, i.e., the bounding boxes are overlaid and then converted to ROIs using Convert Bounding Box to ROI and in the for loop.
  4. Now that we have the individual ROIs, we can now perform QR code read on them individually.
  5. The front panel results are shown below:

Figure 2: The snip on left shows the Front panel after loading the main image. The snip on the right shows the front panel after Pattern Matching and QR Read.

Additional Information

Depending on the type of QR Codes to be read in the image, the template used in the pattern matching block inside the Vision Assistant Express VI can be changed.