MVisionPro Engineering Library · method

Working out the camera resolution a code needs

In short

First exclude the quiet zone, the clear margin around the symbol. Divide the remaining width by the module count on that axis. Use your decoder's documented pixels-per-module range to calculate the required resolution. Check the installed lens against those limits, including any upper limit, then test the read rate on your codes. Motion, focus, light and print quality are outside this calculation.

The standard describes the code, the decoder sets the pixels

A module is one square cell of a 2D code or the narrowest bar of a 1D code. Pixels per module is how many image pixels span one module, on the axis you control.

The symbology standards, the ISO documents for each code type, give no such number. ISO/IEC 16022:2024 (Data Matrix), ISO/IEC 18004:2024 (QR Code) and ISO/IEC 15417:2007 with its 2026 amendment (Code 128) cover symbol characteristics, dimensions, decoding and related parameters (normative). Pixels per module belongs to the decoder, the software that reads the code, and changes with its version and mode.

Get the module size right first

A QR Code Version 3 symbol has 29 modules per side. At 0.254 mm per module, it measures 29 × 0.254 = 7.366 mm across (DENSO WAVE, vendor documentation).

The first trap is the quiet zone. It holds no data, but it takes space on the part. The QR guidance asks for four clear modules on every side. The same symbol then takes 37 module widths, or 9.398 mm. Divide 9.398 mm by 29 and the module comes out 27.6% too large (both calculated).

The second trap is guessing the matrix. A 10 mm Data Matrix is not automatically 22 × 22 modules. The count follows the data, the encoding and the error correction. Read it from the marking specification or count it on a known-good sample. For permitted sizes and print quality, use the symbol specification tables (GS1 2D in retail guideline, normative guidance). Those tables call the module or narrow bar the X-dimension.

Decoders usually publish a range, not one number

Code typeDecoderPublished limits (vendor documentation)
Data MatrixBasler Data Matrix ReaderStarter: at least 3 px. Basic: 6–20 px. Pro Enhanced: 2–100 px. Pro Maximum: 1–100 px.
QR CodeBasler QR Reader, summary tableStarter: 2–80 px. Basic: 6–20 px. Pro: 1–100 px.
1D, including Code 128Basler Barcode ReaderStarter and Basic: line width at least 2 px. Pro: at least 1 px.
1D and 2DCognex DataMan 503 with 25 mm lens, scan maps1D: at least 1.2 px. 2D: at least 2.5 px.

Where the documentation gives only a minimum, do not invent an upper limit.

The Cognex figures hold only for the DataMan 503 Series with a 25 mm lens (DataMan Fixed-Mount Reference Manual, revision 25.4.1.1, dated 2025-12-17, page 147).

The Basler QR page contradicts itself. Its summary table gives Basic as 6 to 20 px, but its detection paragraph says 2 to 100 px. Use the figures for your installed version and confirm them on a test set.

Worked example: a 10 mm Data Matrix and a Code 128 label

Both cases use the MV-CA050-12UM, 2448 × 2048 px with 3.45 µm pixels (datasheet). It is a known camera for the arithmetic, not a reader recommendation.

Working distance is measured from the lens principal plane, the reference plane used by the thin-lens formula, not from the camera housing. Field of view is the area the camera sees at the code. Sampling is the image pixels per millimetre across it.

StepData MatrixCode 128Origin
Code input10 mm side excluding quiet zone, 22 × 22 modulesnarrow bar 0.5 mmassumption
Working distance500 mm300 mmassumption
Requested field of view100 × 83.7 mm50 × 41.8 mmassumption
Module or narrow bar0.455 mm0.5 mmcalculated; assumption
Decoder limit (Basler Basic)6–20 px per moduleline width at least 2 pxvendor documentation
Pixels needed across the field1320 px200 pxcalculated
Sampling at the requested field24.5 px/mm49.0 px/mmcalculated
Module in the image11.1 px24.5 pxcalculated
Standard lens and its field35 mm, 112.2 mm35 mm, 63.9 mmcalculated
Sampling with that lens21.8 px/mm38.3 px/mmcalculated
Module with that lens9.9 px19.1 pxcalculated
Against the published limitsinside 6–20 pxabove 2 pxvendor documentation

The calculated module size is 10 ÷ 22 ≈ 0.455 mm. At six pixels per module, the code spans 132 px (calculated). For Code 128, 2 px across 0.5 mm gives 4 px/mm (calculated). The label width cannot replace the narrow bar, because a barcode's width depends on its content and quiet zones.

The calculator picks a standard 35 mm lens in both cases. It sees a wider field than requested, so sampling drops. Both results still meet their documented decoder limits.

These fields are thin-lens estimates. After focusing, measure the real field and recalculate the sampling, as choosing a lens when the working distance is fixed explains.

The 1320 px and 200 px minimums use different fields, features and decoder conditions. Do not use them to rank cameras or code types.

Calculate for your case

Open the Data Matrix case or the Code 128 case. Each link carries the example's inputs. Replace the camera, the field and the distance with your own. The field of view reference page explains the formulas.

Enter the module or narrow bar as the feature size. Entering the whole 10 mm code answers a different question.

The pixels-per-feature quick buttons offer 3, 5, 10 and 16 px. For other values from 2 to 20, edit nPx in the link. Outside that range, such as 1.2 px or 100 px, work it out by hand. Pixels needed equal the field width divided by the module size, times the pixels per module. Delivered pixels per module equal the module size times the sensor pixels on that axis, divided by the field width.

Both links set the line speed to 0 mm/s. Enter your real speed to get the longest exposure that keeps blur in check, as exposure, motion blur and strobe explains.

What a reader datasheet has to state

A reader's datasheet distances must name the symbology and X-dimension. The MV-IDH9000B entry lists 1280 × 1024 px. For a 5 mil Data Matrix, it gives a reading distance of 5 to 79 mm for that variant (datasheet). A mil is a thousandth of an inch. These distances fit neither the 300 mm nor the 500 mm example. The entry only shows what a checkable specification looks like.

Common mistakes

When this rule breaks

These calculations assume a still, well-lit, focused frame. The decoder pages above also limit contrast, slant and polarity, meaning dark on light or the reverse. They also limit gaps between elements and the finder patterns used to locate the code.

Motion blur eats into the pixels the module needs. Defocus softens module edges without changing the pixel count. Glare and damaged marks reduce contrast. See why a code does not read.

The calculator's minimum feature, about 0.245 mm for the Data Matrix, is the module that gets 6 px at the requested field. It is not the smallest code your line will read. Find that with images across your real code range and measured read and false-read rates.

Next step

Send the reader part number, symbology, code size and module count, whether that size includes the quiet zone, the field at the code and your decoder. We will recalculate the sampling, confirm the variant's datasheet limits and name the tests your samples need.

Sources

Related

How this material was prepared

Prepared by MVisionPro from the stated sources and the MVisionPro calculation engine. A physical test is claimed only when the material says so explicitly. Read the editorial method.

Editorial status: verified. Content updated 2026-09-23.