Auto-Restores Incomplete QR Codes and Data Matrix
Sometimes a physical barcode can be incomplete due to poor printing or damage. For QR Codes and Data Matrix codes, this can cause the finder patterns to be obscured.
The morphology of 2D matrix codes are made up of finder patterns. These finder patterns in QR Codes consist of three identical structures that are located in all corners except the bottom right. With a Data Matrix code, this L-shaped finder pattern and the dashed borders are vital for localizing. Naturally, partially missing finder patterns cause problems for a scanner to detect matrix codes.
Dynamsoft Barcode Reader has the capability to auto-restore - or auto-complete - missing portions of a QR code or a Data Matrix code from poor printing or damage.
This article is Part 4 in a 5-Part Series.
How Dynamsoft Barcode Reader Restores Incomplete QR Codes?
Our updated algorithm tries to complete any missing positioning information based on the FinderPattern, the TimingPattern, the Border, its size, etc.
Let’s look at the following QR code as an example:
In the image, the two square patterns of the QR Code at the left edge are damaged - a part of them has been cut off. In this case, the auto-restore algorithm will complete these two squares based on:
- the information of the known square pattern in the upper right corner
- the TimingPattern connected to the two partially missing squares
Below is how it looks after restoring the finder pattern.
How Dynamsoft Barcode Reader Restores Incomplete Data Matrix Codes?
When the barcode reader detects there is data missing from the L-shaped finder pattern or the dashed borders in a Data Matrix code, the completion algorithm kicks in. The first step is to determine whether there are blocks in the code area. Based on the size of the code, a Data Matrix code can consist of multiple blocks or only one block.
(1) Large Data Matrix codes with blocks
When a Data Matrix code has more than 26 x 26 modules (more than 24 x 24 modules for data), it is divided in blocks, as seen below. Each separated block does not exceed 24 modules on a side. This structure prevents distortion of the code.
For these codes, the restoration algorithm will use the alignment pattern closest to the missing border to estimate the missing border.
(2) Data Matrix codes without blocks
For smaller codes without blocks, the restoration algorithm will estimate the position of the missing border based on the size information of the code.
For more information, read this post on How to Read Damaged Barcodes.