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 type | Decoder | Published limits (vendor documentation) |
|---|---|---|
| Data Matrix | Basler Data Matrix Reader | Starter: at least 3 px. Basic: 6–20 px. Pro Enhanced: 2–100 px. Pro Maximum: 1–100 px. |
| QR Code | Basler QR Reader, summary table | Starter: 2–80 px. Basic: 6–20 px. Pro: 1–100 px. |
| 1D, including Code 128 | Basler Barcode Reader | Starter and Basic: line width at least 2 px. Pro: at least 1 px. |
| 1D and 2D | Cognex DataMan 503 with 25 mm lens, scan maps | 1D: 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.
| Step | Data Matrix | Code 128 | Origin |
|---|---|---|---|
| Code input | 10 mm side excluding quiet zone, 22 × 22 modules | narrow bar 0.5 mm | assumption |
| Working distance | 500 mm | 300 mm | assumption |
| Requested field of view | 100 × 83.7 mm | 50 × 41.8 mm | assumption |
| Module or narrow bar | 0.455 mm | 0.5 mm | calculated; assumption |
| Decoder limit (Basler Basic) | 6–20 px per module | line width at least 2 px | vendor documentation |
| Pixels needed across the field | 1320 px | 200 px | calculated |
| Sampling at the requested field | 24.5 px/mm | 49.0 px/mm | calculated |
| Module in the image | 11.1 px | 24.5 px | calculated |
| Standard lens and its field | 35 mm, 112.2 mm | 35 mm, 63.9 mm | calculated |
| Sampling with that lens | 21.8 px/mm | 38.3 px/mm | calculated |
| Module with that lens | 9.9 px | 19.1 px | calculated |
| Against the published limits | inside 6–20 px | above 2 px | vendor 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
- Exclude the quiet zone before you calculate the module size. In the QR example, including it makes the module 27.6% too large.
- Use your own decoder's documented limits. Another product's 1.2, 2, 2.5, 3 or 6 px minimum does not carry over.
- Check the smallest module against the lower limit, and the largest in the tightest field against any upper limit. In Basler's Data Matrix Basic mode, a module larger than 20 px falls outside the documented range.
- The 16 px on character height in our calculator is for text recognition, not modules. Sensor resolution gives no pixels per module until you know the field at the code.
- A successful decode is not a quality grade. Decoding recovers the data from one frame, while verification grades the symbol against a defined method.
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
- MVisionPro engineering calculator and Hikrobot catalog records (datasheet fields); calculations, the tool page and the public API were verified on 2026-09-21
- ISO/IEC 16022:2024 (Data Matrix symbology): https://www.iso.org/standard/80926.html (checked 2026-09-21)
- ISO/IEC 18004:2024 (QR Code symbology): https://www.iso.org/standard/83389.html (checked 2026-09-21)
- ISO/IEC 15417:2007 with Amendment 1:2026 (Code 128): https://www.iso.org/standard/43896.html, https://www.iso.org/standard/87124.html (checked 2026-09-21)
- DENSO WAVE QR Code guidance (symbol version plus module size sets symbol size, worked as 29 modules × 0.254 mm = 7.366 mm; four-module margin on all sides adds eight module widths to the side length): https://www.qrcode.com/en/howto/code.html (checked 2026-09-21)
- GS1 2D in retail implementation guideline, Release 1.1.0 (implementers are directed to the applicable symbol specification tables for conformant X-dimension, size and quality): https://ref.gs1.org/guidelines/2d-in-retail/ (checked 2026-09-21)
- Basler Data Matrix Code Reader vTool (Starter at least 3 px module side; Basic 6–20 px; Pro Enhanced 2–100 px; Pro Maximum 1–100 px): https://docs.baslerweb.com/data-matrix-code-reader-vtool (checked 2026-09-21)
- Basler QR Code Reader vTool (summary table: Starter 2–80 px, Basic 6–20 px, Pro 1–100 px; the Basic detection paragraph on the same page states 2–100 px): https://docs.baslerweb.com/qr-code-reader-vtool (checked 2026-09-21)
- Basler Barcode Reader vTool (minimum line width 2 px for Starter and Basic, 1 px for Pro): https://docs.baslerweb.com/barcode-reader-vtool (checked 2026-09-21)
- Cognex DataMan Fixed-Mount Reference Manual, revision 25.4.1.1 dated 2025-12-17, DataMan 503 Series with 25 mm lens, p. 147 (scan-map minima of 1.2 px per module for 1-D codes and 2.5 px per module for 2-D codes): https://docs.cognex.com/dmst_2541/EN/DataManFixedMountReference.pdf, https://docs.cognex.com/dmst_2541/web/EN/Fixed_Mount_Manual/Content/Topics/FMREF/DataMan503/DataMan503ScanMap25mmLens.htm (checked 2026-09-21)
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.