Pages Navigation Menu

Reliably Verify 2D Data Matrix Codes

The industry now has standards to reliably verify 2D Data Matrix codes. What metrics and methods can you use to assess a mark’s overall quality?

By Carl W. Gerst III, Cognex Corporation, Senior Director & Business Unit Manager, ID Products


Conventional bar codes (such as Universal Product Codes, or UPCs) have gained wide acceptance in
applications ranging from checkout and inventory control in retail sales to tracking printed-circuit-board serial
numbers in electronics manufacturing. To increase the character content and to store the information in
smaller spaces, companies have developed two-dimensional alternatives. One of these, called Data Matrix,
adopted as a standard, places square or round cells in a rectangular pattern. Its borders consist of two
adjacent solid sides (the “L”) with the opposite sides made up of equally spaced dots. This symbology allows
users to store information such as manufacturer, part number, lot number, and serial number on virtually any
component, subassembly, or finished good. For example, up to 50 characters can be stored in a
3mm square.
Using such a code successfully requires reading it at rates that meet or exceed what companies have
achieved with barcode technology. Guaranteeing that, in turn, means establishing a reliable standard
procedure to verify the code’s quality. Initial attempts to create such a standard assumed that 2D codes, like
their 1D bar-code predecessors, would be printed in black ink on white labels.
Manufacturers, however, had other ideas. Labels can become defaced or fall off. So companies began
applying the code directly to the product being identified. Marking parts by applying the codes using methods
such as dot peen or laser etching often produces codes with low contrast, poor cell position, or inconsistent
cell size. In addition, the surface being marked can be matted, cast, or highly reflective, and is seldom as
clean and uniform as a white label. Reading such marks has been an enormous challenge until recently.
Advancements in illumination techniques and machine-vision algorithms have permitted development of
robust and reliable reading solutions.

The first step in ensuring high read rates is to make sure that the marking process puts down a good code.
Although this sounds simple in principle, until now verifying code quality has been both problematic and
frustrating. Codes that a reader can decipher easily often failed the verification criteria designed for black on
white printing. The recently approved AIM (Association for Automatic Identification and Mobility) Direct Part
Mark (DPM) Quality Guideline DPM-1-2006 is intended to handle the variety of marking techniques and part
materials used in DPM applications.
Manufacturers can mark parts with lasers, as well as by dot-peening, electrochemical etching, and ink-jet
printing. Each technique addresses certain applications, depending on part life expectancy, material
composition, likely environmental wear and tear, and production volume. Surface texture also influences the
choice, as does the amount of data that the mark needs to contain, the available space for printing, and the
mark’s location. (See Figures 1-7)

Verify 2D Codes 1

With dot-peening, a carbide or diamond-tipped stylus pneumatically or electromechanically strikes the material surface. Some situations may require preparing the surface before marking to make the result more legible. A reader adjusts lighting angles to enhance contrast between the indentations forming the symbol and the part surface. The method’s success depends on assuring
adequate dot size and shape by following prescribed maintenance procedures on the marker and monitoring the stylus tip for excessive wear. The automotive and aerospace industries tend to use this approach.

In laser marking, the laser heats tiny points on the part’s surface, causing them to melt, vaporize, or
otherwise change to leave the mark. This technique can produce either round or square matrix elements.
For dense information content, most users prefer squares. Success depends on the interaction between the
laser and the part’s surface material. Laser marking offers high-speed, consistency and high precision, an
ideal combination for the semiconductor, electronics, and medical-device industries.
Electro-chemical etching (ECE) produces marks by oxidizing surface metal through a stencil. The marker
sandwiches a stencil between the part surface and a pad soaked with electrolyte. A low-voltage current does
the rest. ECE works well with round surfaces and stress-sensitive parts, including jet engine, automobile, and
medical device components.
Ink-jet printers for DPM work the same way as familiar PC printers do. They precisely propel ink droplets to
the part surface. The fluid of the ink evaporates, leaving the marks behind. Ink-jet marking may require
preparing the part’s surface in advance so that the mark will not degrade over time. Its advantages include
fast marking for moving parts and very good contrast.
In all cases, manufacturers should put a clear zone around the mark whenever possible, so that no features,
part edges, noise, or other interference comes in contact with the code.
The range of DPM techniques means that the appearance of the marks can vary dramatically from one
situation to the next. In addition to the selected marking method, the parts come in different colors or shapes
and can be made from different materials. Surfaces include smooth and shiny, furrowed, striped, streaked, or
coarse granular. Any verification method must provide reliable and consistent results under all conditions.


Until now, industry standard and end users of DPM applications had limited options for determining mark
quality. The ISO/IEC 16022 international specification defined how to print (or mark) a Data Matrix code (the
code structure, symbol formats, decoding algorithms, and so on). Although 16022 originally included a few
quality metrics, its authors never intended it to address verification. That job was left to ISO/IEC 15415, which
emerged about five years later.
Because 15415 assumed black marks on high-contrast white labels, it defined only one lighting method.
Verifying many DPM marks while observing that constraint would be like telling a photographer to go into a

dark room and try to take a picture without a flash. If the lighting is inadequate for the verifier to capture a
good image, none of the metrics used to evaluate mark quality make sense. If you start with garbage, you
end up with garbage.
The 15415 standard required calibrating the verifier prior to use with a white card exhibiting known white
values (such as a NIST-certified calibration card). Calibration involved adjusting imaging system settings
(camera exposure or gain, for example) so that the observed white values on the calibration card
corresponded to the known values. Once calibrated, these settings—including the lighting
characteristics—never change, regardless of marking method, material, or surface characteristics. Again,
such a requirement may yield acceptable images for paper labels. Fixed settings for DPM parts, however,
produce images that in most cases are either under or overexposed, depending on the marking method and
the part’s reflectivity.
Verification of a code includes analyzing a histogram of that code. Each pixel in an image acquired by an
8-bit camera can have any of 256 gray values. The histogram graphically depicts the number of pixels in the
image at each possible gray value, providing a picture of how the values are distributed. The histogram of a
well-marked code should show two distinct and well-separated peaks. Without distinct peaks, distinguishing
1s from 0s – and therefore decoding the information stored in the code— becomes more difficult, like trying to
read road signs while driving in the rain. (See Figure 2 and Figure 4)
One common problem that arises with DPM marks (such as an etched code on a piece of metal) when you
apply the single lighting configuration of the 15415 standard along with the mandated fixed camera settings is
that the image looks more like gray on black than black on white. The resulting histogram peaks appear
much less distinct.
One standard evaluation criterion is symbol contrast—the spread in histogram values between the lowest
(“black”) and the highest (“white”). Using fixed settings on DPM marks shifts the “white” far down the
measurement scale, producing low contrast scores and failing grades. We needed a standard auto-exposure
routine to optimize the light reflected off the part, described below.

Even with an optimal image, another problem crops up when analyzing the histograms in 15415. Because
they are created by independent processes, histograms of actual DPM codes do not generally exhibit
equal-sized or symmetric distributions for foreground and background.
So how do you distinguish between the foreground and the background?
ISO/IEC 15415 relied on an overly simplistic method based on the mid-point between the histogram’s darkest
value (minimum reflectance) and its brightest value (maximum reflectance). Of course, this method would
only yield the correct threshold if distribution of both peaks was identical, which never happens—not even for
paper labels. This problem is exacerbated if you include all of the pixels in the symbol region. Ideally, an
image of a good code contains only three types of gray-value distributions: foreground, background, and
edges. “Edge” pixels divide the foreground from the background.
The gray values in this region change rapidly. As you move across it, they transition from the foreground dark
value to the background bright value. The edge pixels contribute to the histogram region between the two
peaks, leaving the peaks less distinct than they should be, potentially compromising any information extracted
from the code. Using information only from the center of the foreground and background modules yields a
grid-center image. The histogram that corresponds to such an image—a grid-center histogram—contains no
edge pixels at all.
An additional image-processing step consists of applying a low-pass filter, referred to as a synthetic aperture
with an aperture size that is a certain fraction of the nominal cell size. Using a synthetic aperture prior to
computing the grid-center histogram helps to make the grid-center pixels more representative of the actual
module by eliminating hot spots and background noise such as machining marks.
A simple yet elegant algorithm to determine the correct threshold examines every gray-scale value from the
grid-center histogram, calculating the variance to its left and its right. The point where the sum of those two
variances reaches a minimum represents the optimum separation point between the foreground and
background peaks.
Another issue with 15415 was that it established a fixed synthetic aperture depending on the application,
determined by the smallest module size that the application encountered. The synthetic aperture was created

to connect dots of a dot-peen code so that they appeared connected after binarization. Although this
approach was not optimal in achieving that goal, it provided other benefits, such as reducing hot spots.
Nevertheless, the synthetic aperture should not remain fixed, but rather take on an appropriate value for each
mark being verified. Two values were selected for the new standard because marks and surfaces that create
a significant amount of background noise, like dot-peen codes on a cast surface, work better with a larger
aperture. Smaller apertures better address the requirements of well-marked codes.
Determining optimal aperture size is difficult. Based on empirical analysis, we selected two values: 50% and
80% of nominal cell size. The nominal cell size changes from mark to mark and hence the synthetic
apertures were dynamic instead of fixed as in 15415. The manufacturer performs the entire verification
process with both aperture sizes and selects the one that produces the better result.
The optimal image was obtained using an iterative process by analyzing the grid center histogram after
applying the synthetic aperture. The imaging system was adjusted iteratively so that the mean of the bright
pixels would approach an empirically determined value of 200 plus or minus 10% (on an 8 bit grayscale
camera). The beauty of this approach is that it works regardless of the marking method, material, or surface
characteristics. The camera settings may not be the same across marks, but it takes on the order of
milliseconds to adjust to the proper dynamic range for the camera. Once the optimal image is obtained, the
metrics must determine the mark’s quality. Some marks may require some extreme light energy for this
process to succeed. The minimum-reflectance metric was created to track this very aspect. The metric is
graded based on the light energy required to adjust the bright pixel mean to 200 compared to the light energy
required for a standardized white target such as a NIST calibration card.
We now have an optimal image, a well-formed histogram representing the gray-scale value for each cell, and
an optimal global threshold. We can finally start analyzing different aspects of the mark. ISO/IEC 15415 took
a significant leap in the right direction. It contained a number of good metrics. However, the inflexibility of the
surrounding conditions reduced their usefulness. The computation methods for these metrics also exhibited
limitations that would create problems for both DPM marks and paper labels.

The following metrics and methods comprise the AIM DPM standard for assessing a mark’s overall quality:
Decodability. This pass/fail metric uses a reference decoding algorithm that the AIM DPM standard
has improved to address and decode marks that have disconnected finder patterns. The reference
decode algorithm is responsible for establishing the grid center points required for verification.
Cell Contrast (CC). The name changed from symbol contrast in 15415 to reflect significant
differences in what it measures. Instead of determining differences between the brightest and
darkest values (which are highly variable), CC measures the difference between their means. The
ability to distinguish between a black and a white cell depends on the closeness of the two
distributions in the histogram.
Cell Modulation (CM). As noted above, a well-marked code requires a tight distribution for both light
and dark values. If the standard deviation of each peak increases, some center points will approach
the threshold and may even cross over. Cell modulation analyzes the grid center points within the
data region to determine the proximity of the grayscale value to the global threshold after considering
the amount of error correction available in the code. Typical problems that lead to poor modulation
include print growth and poor dot position.
Fixed Pattern Damage (FPD). This metric resembles cell modulation, but instead of looking at the
data region itself, it analyzes the finder “L” and clocking patterns as well as the quiet zone around the
code. The first step in reading a code is finding it. Problems with the finder pattern or the quiet zone
will reduce the fixed-pattern damage score.
Unused Error Correction (UEC). Data Matrix incorporates Reed/Solomon error correction. Every
grid center point should fall on the correct side of the global threshold. If so, the binarized image will
look like a perfect black and white representation of the code. It is not uncommon for some center
points to fall on the wrong side. Any such bit is considered a bit error that requires processing
through the Reed/Solomon algorithm. The amount of error correction needed increases with the
number of bit errors. A perfect mark that requires no error correction would achieve a UEC score of
100%. The more error correction, the lower the UEC score. A code with a score of 0 would not be
readable with one additional bit error.
Axial Non-Uniformity (ANU). This describes the modules’ squareness.
Minimum Reflectance (MR). The NIST-traceable card that is used to calibrate the system creates a
calibrated system reflectance value. The image brightness is adjusted on a new part, after which this
calibrated value is compared with the reflectance of that part. Parts that are less reflective than the
NIST standard card will need more light energy for the camera to achieve the appropriate image
brightness. MR is the ratio of the parts reflectance to the calibrated reflectance. Every part must
provide at least some minimum level of reflectance.

 Grid Non-Uniformity (GNU). This qualifies the module placement by comparing to a nominal evenly
spaced grid.
Final Grade. Like ISO/IEC 15415, the code’s final grade is the lowest of the individual metrics.
Because the grading system uses letter grades, users often feel compelled to achieve the best
possible grade (as college students do). In this case, however, grades of D or better denote
perfectly readable codes. In fact, most readers on the market today can reliably read codes graded
F. Companies that demand grades of, say, B or better are incurring very high additional costs with
little benefit. When using the AIM DPM guideline, we recommend passing marks that score C or
better and pass but investigate any code that gets a D.

Since our foundation in 1967, ABCON has supplied automation controls and sensor technology into most types of manufacturing process and industry sectors. We have always moved with the times, supplying the latest sensing technology as it becomes commercially available. Throughout our history we have continually formed alliances with some of the Worlds leading manufacturers of sensor technology.

+44 (0)114 244 2424

[dynamictext Application "CF7_get_post_var key='title'"]



Telephone Number

Your Message