2D code reading and verification means reading the DataMatrix or QR code on a product or package with a camera on the production line, comparing its content with the expected information, and assessing whether the print is of sufficient quality. If the code cannot be read, if the content does not match, or if print quality falls below the defined limit, the product is removed from the line and the decision is recorded with its image. In Turkish, the word "karekod" is used both for QR codes and for the DataMatrix on medicine packs. Both codes carry information such as the product number, batch, expiry date and serial number in a single symbol. A code that leaves the line readable is a prerequisite for the other readers in the supply chain to read it too.
We covered checking the batch number and expiry date as plain text with optical character recognition (OCR) and verification (OCV) in label and date code inspection. This post focuses on two-dimensional codes only.
What is the difference between reading, verification and grading?
These three concepts are often confused, but each answers a different question.
| Concept | Question it asks | Result |
|---|---|---|
| Reading | Can the code be decoded? | Read or no-read; the decoded data |
| Content verification | Does the decoded data match the expected data, and is its structure correct? | Match or mismatch |
| Print quality grading | Is the symbol of a quality that other readers will also read reliably? | A numeric grade from 4 to 0 |
Reading is the most basic step: the camera finds the code in the image and decodes it. But the fact that this camera reads the code does not guarantee that another reader will. That is why the GS1 DataMatrix guideline stresses that scanning should not be confused with verification. At best, scanning is a go/no-go test of whether the code can be read by that particular reader.
Content verification means comparing the decoded data with the information in the product profile or production order. The product number (GTIN), batch number, expiry date and serial number must match the expected values. In the GS1 structure these fields are separated by Application Identifiers (AIs). Correct use of the identifiers and a correct check digit are also part of content verification. On serialised products, seeing the same number a second time can be handled as a separate error.
Print quality grading measures how well the symbol is printed. The method used for two-dimensional codes is defined in ISO/IEC 15415.
How is print quality graded under ISO/IEC 15415?
ISO/IEC 15415 defines how the print quality of two-dimensional symbols is measured and how the measurements are turned into an overall quality grade. The grade is given on a numeric scale from 4 to 0, to one decimal place; 4 is the best and 0 the worst result. On the older letter scale, this corresponds to A through F.
The main parameters described in the GS1 DataMatrix guideline are:
- Decode: Can the code be decoded with the reference decode algorithm? If it decodes, it gets 4; if not, 0.
- Symbol contrast: The difference in reflectance between the dark and light areas, including the quiet zone.
- Modulation: How consistent the dark and light cells are across the symbol.
- Fixed pattern damage: Whether there is damage to the L-shaped finder pattern, the clock track or the quiet zone.
- Axial and grid nonuniformity: Uneven scaling of the symbol along one axis, and deviation of the cell grid from its expected position.
- Unused error correction: How much of the code's error correction capacity is still unused, in other words the safety margin left for reading.
The lowest parameter grade in an image becomes the grade for that scan. The overall symbol grade is the average of several scans. A grade is meaningful when it is stated together with the measuring aperture, the light wavelength and, where needed, the angle of illumination. For example, "1.5/08/660" gives the grade, the aperture and the wavelength in that order.
The minimum acceptable grade depends on the application. The GS1 guideline says that an application standard must at least specify a measurement methodology and a minimum grade, and gives grade 1.5 under ISO/IEC 15415 as an example. In the EU, Delegated Regulation 2016/161 on the safety features of medicinal products for human use also presumes that a DataMatrix rated at least 1.5 under ISO/IEC 15415:2011 meets the print quality requirement.
Does a camera on the line replace a verifier?
Not entirely. A standards-compliant verifier works with the aperture, light and angle described in the standard, and is regularly calibrated with a test card. A camera on the line, by contrast, images a moving product at line speed and under the line's lighting conditions.
The GS1 guideline lists three complementary approaches to controlling print quality in production: adding verification to the normal quality control procedure, reading every code on the line to ensure readability, and taking samples at periodic intervals during production.
In practice, the camera on the line reads every code, verifies its content and tracks the quality parameters to show print degradation early. The formal grade report comes from samples measured on a verifier. The quality value reported by the line camera should be used as a trend indicator, not as a substitute for the verifier report.
A falling value usually points to a problem on the printer side: a dirty print head, running low on ink or ribbon, a change in laser power, a different packaging material or the product shifting in front of the printer. This trend can be shown to the operator before the code becomes completely unreadable.
What happens when a code cannot be read?
A no-read is treated as a defect; the product is not accepted as good and is removed from the line. Points to watch:
- No-reads and wrong codes are recorded separately: If the code could not be read at all, the problem most likely lies in the print, the position or the lighting. If the code was read but the content did not match, the problem is wrong data, a wrong label or a product mix-up. The two cases call for different actions.
- What happens to a rejected product depends on procedure: Whether a rejected product is re-inspected is decided by the site's own procedure. On serialised products, this step is recorded as well.
- Consecutive no-reads are a reason to stop: Successive no-reads point to a fault in the printer or the labeller. The system can alert the operator or stop the line via the PLC.
- Fail-safe: If no image is captured or no decision is made in time, the product is not accepted as good and is removed.
- Verifying rejection: At the start of a shift and at product changeover, known defective test codes are run through the line. It is checked that the camera finds the defect and that the rejector removes that product.
What needs attention during installation?
Print method and surface: Thermal transfer, inkjet and laser printing look different to a camera. The GS1 guideline notes that highly reflective metal surfaces and reflective inks can blind the reader, and that intermediate colours reduce contrast. For codes marked directly on parts (DPM), ISO/IEC 15415 alone is not considered sufficient; the ISO/IEC TR 29158 guideline is used for these codes.
Quiet zone: GS1 DataMatrix requires a clear area at least one module wide around the symbol. Printing the code too close to the label edge or to other print lowers its quality, even if it can still be read.
Lighting: Diffuse lighting works better for print on labels, and low-angle or dome lighting for codes engraved on metal surfaces. See machine vision lighting for details.
Resolution and position: The smallest cell of the code must be represented by enough pixels in the image. Code size, variation in the product's position in front of the camera and the field of view are considered together. When a code wraps around a curved surface, grid nonuniformity increases. We covered camera selection in industrial camera and lens selection.
Source of the expected data: The batch, expiry date and serial number range come from the PLC, MES or serialisation management system. For pharmaceuticals in Turkey, serial numbers are reported to İTS (the national pharmaceutical track and trace system) by the site's own serialisation management system; the camera reads and verifies the code.
What should be prepared before installation?
- Code types: DataMatrix, QR code or both; whether the GS1 structure is used
- Code size, its location on the product and the print method
- Line speed and variation in the product's position in front of the camera
- Which system the expected data will come from
- The minimum acceptable quality level and reference reports taken with a verifier
- Samples: well-printed codes, plus faded, offset, incomplete and damaged codes
We describe the components and working steps of the system on the label and code inspection system page, and other checks on packaging lines on the assembly and packaging inspection page. Contact us to assess where and how code inspection can be done on your line.




