How to Perfect QR Code Quality

QR Code Quality_Large

What are QR Codes? 

Masahiro Hara developed the quick response system symbol, better known as the QR code, to speed up code reading on car parts. He achieved his goal and much more; the technology became an ISO standard thanks to the multiple advantages it offered over traditional bar codes, including:

  • Up to 10x faster decode times
  • Greater data storage capacity
  • Flexible sizes
  • Readability in any orientation
  • Readability with up to 30% of the code damaged

These benefits depend on the quality of the QR code, though. Companies producing QR codes for internal or public use need to make sure they’re easily decoded, and the best way to do that is by using a barcode verifier. Barcode verifiers analyze QR codes by testing several parameters to determine an overall quality grade.

Before diving into the grading process, let’s review the parts of a QR code. 

Beginners Guide to Barcode Verification

Understanding the Structure of QR Codes

large-QR Code Structure_04

Quiet Zone: Space around the edge of the code that helps separate the code from nearby design elements or markings. The minimum size is 1 module – the size of the smallest squares in the code – in the ISO 16480 standard for QR codes or 4 modules in the ISO 18004 standard for QR codes meant to be read on mobile devices.

Finder Pattern: Three identical nested sets of black and white squares that make it faster and easier for scanners to determine orientation and read the code.

Alignment Pattern: Smaller black and white nested squares that ensure the code can be read even if the code is skewed or on a curved surface. They tell the reader software where to place the grid. 

  • The larger the code, the more alignment patterns it will need. 
  • QR codes more than 45 modules require multiple alignment patterns. 

Timing Pattern: An L-shaped line that runs between the three finder pattern squares helps readers determine how large the modules are and where the data is located. 

Format Information: Specific areas of the code that specify error tolerance and a data masking pattern

Version Information: Specific areas of the code that identify which of the 40 versions of QR codes is being used, and identifies the data mask, error correction levels, and link values used in the symbol. As with extra alignment patterns, this information is only listed in symbols bigger than 45 x 45 modules. 

Data and Correction Keys: The bulk of the code, using light and dark modules for data and error correction. 

  • Error correction allows up to 30% of the code to be damaged but still be decoded. 

The QR Code Grading Process

QR codes are graded based on the steps of the decoding process. The details are set out in the ISO 15415 standard for label-printed codes, and ISO 29158 for codes directly marked onto parts (DPM).  

Symbol reading software begins decoding by locating the three large finder patterns in the corners of a code. Once those patterns are found, the clock track and alignment patterns establish a character grid. Each module's color is measured at the intersection of the grid lines, which fall near the center of the modules, and that color is compared to the color the module is supposed to be.

Circular Sampling for Color Measurement

The color of a module is measured within a circular sample called the aperture, centered on the intersection of the grid lines. Since the image will often have varying shades of gray within the aperture, readers use the average color within that area to evaluate the module. 

Circular Sampling for Color Measurement QR Code

Determining Dark or Light Modules

The average values for all the modules in a code are plotted on a graphic called a histogram. The gray midway between the darkest and lightest levels found in the code is then set as the global threshold. Each module is interpreted as light or dark based on whether it’s lighter or darker than the global threshold. This allows readers to adapt to varying lighting conditions and printed backgrounds. 

Light and Dark Modules

Grading QR Code Modules

Once a module is determined to be dark or light, the actual color level is evaluated to see how close it is to the global threshold. More distance from the global threshold is better: light modules should be among the brightest spots in the images and darks should close to the darkest.

To reflect this, modules get higher grades based on their distance from the middle of the histogram, and lower grades as they get closer to the global threshold.

The overall grade of a QR code depends on the grades of all its component parts: finder patterns, clock tracks, version information blocks, format information blocks, alignment patterns, and regular data modules.

The grading rules for each module are different depending on how much they affect the readability of the QR code. 

Finder Pattern Grading Parameters

After cell colors have been determined, the next phase in the decode process is to identify the finder pattern: 

Finder grader pattern for QR Code Explained

Grade assingment for finder patterns: 

  • 0 incorrect modules-A
  • 1 incorrect module-B
  • 2 incorrect modules-C
  • 3 incorrect modules-D
  • 4 or more incorrect modules-F

Timing Patterns

Timing pattern: horizontal and vertical clock tracks

Timing pattern Qr horizontal and vertical

Grade assignments based on clock tracks

  • 0 incorrect modules-A
  • ≤ 7% incorrect modules-B
  • ≤11% incorrect modules-C
  • ≤14% incorrect modules-D
  • > 14% incorrect modules-F

Alignment Patterns

Alignment Patterns QR

Each alignment pattern is examined to see if it contains any incorrect modules, then graded based on the percentage of alignment patterns with errors. If there is only one alignment pattern, any damage to that pattern will result in an F grade. 

Grade assignment based on alignment patterns

  • 0 damaged alignment patterns-A
  • ≤ 10% damaged alignment patterns-B
  • ≤ 20% damaged alignment patterns-C
  • ≤ 30% damaged alignment patterns-D
  • > 30% damaged alignment patterns-F

Version Information Block

Version information blocks only occur in QR Code symbols with 45 x 45 modules or more. These blocks are repeated in two places in the symbol to provide redundancy protection against damage.

Grade assignmets based on version information blocks

  • 0 incorrect modules-A
  • 1 incorrect module-B
  • 2 incorrect modules-C
  • 3 incorrect modules-D
  • > 3 incorrect modules-F

Format Information Block

Because there are two of them, the format information block grade is the average of two grades. If one is damaged and gets an F, and the other gets an A, the overall grade for format information blocks will be a C.

Grade assignments based on formation information blocks

  • 0 incorrect modules-A
  • 1 incorrect module-B
  • 2 incorrect modules-C
  • 3 incorrect modules-D
  • > 3 incorrect modules-F

Formation Block

Additional Grading Parameters for QR Code Symbols

In addition to the patterns specific to QR codes, the following parameters are used when grading all 2D barcodes.

Decoding Success

Any QR code must be decodable by following the process given in the QR code specification. Any code so damaged that it cannot be decoded is given an F. A symbol that is successfully decoded earns an A, which means that the actual grade of the symbol will depend upon the grade of the fixed pattern or the other parameters below.

Unused Error Correction

Like most 2D symbology, QR Code symbols contain error correction, which enables the decoder to recover bits of data even if some of the modules are unreadable. However, the error correction capability is limited to a certain number of modules, and the percentage of error correction capability that is used determines the grade for unused error correction (UEC).

Grade assingments based on UEC

  • ≥ 62% unused error correction-A 
  • ≥ 50% unused error correction-B
  • ≥ 37% unused error correction-C
  • ≥ 25% unused error correction-D
  • <25% unused error correction-F

Axial Non-Uniformity

QR codes and their component cells are expected to be. Any distortion affecting the symbol’s aspect ratio is measured as axial non-uniformity (ANU). The value of ANU is computed by dividing the difference in the lengths of the two axes by the average size of the two axes.

Grade assignment based on ANU

  • ≤ 6% ANU-A
  • ≤ 8% ANU-B
  • ≤ 10% ANU-C
  • ≤ 12% ANU-D
  • > 12% ANU-F

Grid Non-Uniformity

The decoding process results in a grid of intersecting lines, which should be located at the centers of modules. Ideally, the grid is equally spaced vertically and horizontally.

However, in actual use the grid adapts to the positions of the clock track modules and the alignment patterns, so it may not be identical to the ideal grid. 

Grid non-uniformity (GNU)measures the largest difference between the grid intersections of the actual and ideal grids as a percentage of the X dimension.

Grade assignments based on GNU 

Amount of Grid Non-Uniformity Grade: 

  • ≤ 38% GNU-A
  • ≤ 50% GNU-B
  • ≤ 63% GNU-C
  • ≤ 75% GNU-D
  • > 75% GNU-F

Modulation (MOD and RM) 

Modulation is a comparison of the actual color of data modules to the global threshold and their expected colors.  The closer to the global threshold, the more uncertain they are, and the lower the grade for that module. The percentage of modules with each color level determines the grade. A more straightforward way to think about modulation is localized areas with contrast issues.

Since QR codes have error correction, a small number of uncertain modules doesn’t make a symbol unreadable. As more modules become uncertain, however, the symbol becomes more challenging to read and less resilient to dirt or damage. 

Grading Process for MOD and RM

To produce the modulation grade, modules with grades lower than A are counted as errors and a grade is computed based on the formula for unused error correction. Then, the process is repeated for modules graded lower than B, C, and D. The grade is calculated as the "best of the worst," meaning that for each limiting grade, the lower of the limiting grade and the UEC result is selected, and the final grade for MOD or RM is the highest of these selections.

Differences Between MOD and RM

The difference between MOD and RM is that for MOD, modules that are the wrong color are not automatically counted as errors. Instead, their distance from the global threshold is used to assign their grades, without regard for the actual color the module should be. For RM, incorrect modules are always counted as errors.

The MOD approach is effective for evaluating a printing process – not for judging how accurate or readable a symbol is. On the other hand, RM is more useful for gauging the readability of a symbol because all modules that are the wrong color are counted as errors.

Determining the Final Modulation Grade

Since the overall grade of a symbol will be the lower of all the parameters, the lower of MOD and RM will determine the final grade. Moreover, since RM will always be equal to or less than MOD, RM will always select the final grade rather than MOD. In this sense, MOD is unnecessary to decide on the final grade of a symbol but may help evaluate a printing process in some cases.

Understanding QR Code Quality

Manufacturers and producers of all kinds can optimize QR code quality by understanding the structure, grading process, and modulation evaluation. Correct usage of all the elements, including quiet zones, finder patterns, alignment patterns, timing patterns, and version information, helps create well-formed QR codes.

The grading process is important to identify potential contrast issues and improve readability. Striking the right balance between error correction and color grading is crucial for a reliable and efficient QR code. By adhering to best practices and implementing comprehensive evaluation techniques, organizations can ensure high-quality QR codes that enhance user experiences and successfully serve their intended purposes in today's digital landscape.

More Posts on

GET ACCESS TO SUPPORT & TRAINING FOR PRODUCTS & MORE

Join MyCognex