Reading Data Matrix bar codes with missing information
Overview
For manufacturing engineers who use Data Matrix codes for part identification, this example code shows how to use IMAQ Vision to read partially occluded Data Matrix codes.
Table of Contents
Background
2-D barcodes like DataMatrix are being used extensively in several industries such as automotive, aerospace, consumer goods, electronics, semiconductor, and life sciences. Major benefits of 2D codes over 1D barcodes include:
- Small size - more information can be packed into a smaller area
- Do not require precise sizing of individual elements (cells), because all elements are the same size. This is a major improvement over 1D barcodes, where bar thickness is critical to decoding.
- Built in error correction allows all information to be recovered even when a portion of the code is missing.
DataMatrix codes have 3 basic areas of interest. The sample 2D code image in Figure 1 illustrates these regions.

Figure 1. A DataMatrix code has three areas of interest: the Locator, the alternating black and white boundary cells and the core Data area.
Example

(a)


(b) (c)


(d) (e)


(f) (g)
Figure 2. Original barcode (a) and the same bardcode with missing information (b - f) .
Demo Code
For most applications, the size of the 2D code to be read is known. Sometimes, for a variety of reasons the code gets damaged. As the structure of the Locator template and the matrix size information is pre-known, the 2D code can be reconstructed. The example presented here illustrates how this can be accomplished using LV and IMAQ Vision.

[+] Enlarge Image
(a)

[+] Enlarge Image
(b)
Figure 3 User interface (a) and Block Diagram (b) for a demo code illustrating use of the example VIs for Pre-processing of the Data Matrix codes
The inspection systems can be trained on the size of the barcode and the number of elements in it. When a damaged barcode comes into the system it is then read correctly. Figure 3(a) shows the damaged DataMatrix code is reconstructed with the missing information for the Locator and the alternating black and white cells. The resulting image is then passed through the DataMatrix reader VI and is read correctly.
The VIs used to regenerate the missing information and example code demonstrating their use are available through the link at the end of this document.
Reader Comments | Submit a comment »
Link to the sample code
Here is the link to the sample code:
http://zone.ni.com/devzone/cda/epd/p/id/3251
- Jul 14, 2008
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
