Benchmarking Barcode SDKs Reproducibly: Dataset, Generator, and Per-Image Results

Need a license key to run the code in this tutorial?

Get a 30-day free trial license

A barcode SDK evaluation often starts with a number someone else measured: an accuracy rate, a scan distance, a “times faster” claim. A number like that is most useful when you can see what produced it: the images, the procedure, and the scoring rule.

This article publishes the whole benchmark rather than a headline figure: 8,000 synthetic images with ground-truth annotations, the generator that produced them, the scoring code, and every per-image result. You can download it, recompute the tables, and add other decoders.

Dynamsoft built and ran this benchmark, so we held it to the standard we’d want applied to any vendor’s: every artifact is public, including the results where Dynamsoft Barcode Reader does not lead. Below, we explain why we generated synthetic images instead of borrowing photographs, how the generator works, and what the data shows for Dynamsoft Barcode Reader, Scandit, and ZXing-C++ in C++ and in the browser.

A benchmark you can re-run

Key Takeaways

  • A benchmark is checkable when four artifacts ship together: the images, the ground truth, the code that scores them, and the per-image records. Missing any one of them turns a measurement back into a claim.
  • A benchmark is easiest to trust when the images, procedure, and per-image records are public. This dataset publishes all of them.
  • Public photographs are either non-commercial or narrow: Muenster BarcodeDB (1,055 images) is CC BY-NC-ND 4.0, BarBeR (8,748 images merged from 12 datasets) is CC BY-NC-SA 4.0, and ArTe-Lab’s 430 images cover EAN-13 only. None of them can carry a commercial product benchmark.
  • The published dataset holds 8,000 JPEGs, 11,372 annotated symbols, 24 symbologies, 36 background scenes, 153 mixed-symbology frames, and 200 background-only controls. The generator, manifest, 24,000 raw decoder records from the native pass, scorer, and HTML report are all in the repository.
  • On this dataset, Dynamsoft Barcode Reader returned 6,714 exact images (83.93%) in C++ and 6,496 (81.20%) in the browser; Scandit returned 6,025 (75.31%) and 6,156 (76.95%); ZXing returned 3,852 (48.15%) in C++ and 3,851 (48.14%) in the browser. Each reader was configured with every symbology its SDK supports. Per format, Scandit leads on Code 128, Codabar, and MSI, while Dynamsoft leads on DotCode, MaxiCode, and the postal formats, so the aggregate is not a uniform win.

Common Developer Questions

How can I tell whether a barcode benchmark is trustworthy?

Check for four artifacts and one rule. The artifacts are the images, the per-symbol ground truth, the scoring code, and the per-image results for every engine — not only the winner. The rule is the definition of a correct read, a wrong read, and a no-read. This dataset publishes all four plus the generator, and the 8,000-image manifest is matched by SHA-256 between runs.

Can I verify a barcode benchmark?

You can — but only when the images, ground truth, scoring code, and per-image results are published. That is the standard this dataset is built to.

Can I use public barcode datasets to evaluate a commercial SDK?

For internal evaluation, often yes. For a published or contractual benchmark, usually no. Muenster BarcodeDB, one of the most cited barcode datasets, is listed as CC BY-NC-ND 4.0: the non-commercial clause excludes use inside a commercial evaluation service, and the no-derivatives clause excludes redistributing cropped frames with your own annotations. The datasets that are permissively licensed have the opposite problem — they are small and narrow. The details are in the license table below.

Why synthetic images instead of photographs?

Because a dataset has to be licensed for publication, wide enough to cover 24 symbologies, annotated with payloads rather than boxes, and reproducible from a seed. Photographs rarely satisfy more than two of those. Synthetic generation also lets you isolate one capture effect at a time — pure perspective, pure motion blur, pure glare — which is how you learn where a decoder fails instead of only how often it fails. The cost is realism: the dataset is a model of a camera, not a camera.

How accurate is Dynamsoft Barcode Reader compared with Scandit on this dataset?

In the C++ / Linux run, Dynamsoft returned 6,714 of 8,000 exact images (83.93%) against Scandit’s 6,025 (75.31%) and ZXing-C++’s 3,852 (48.15%). In the browser, Dynamsoft returned 6,496 (81.20%) against Scandit Web’s 6,156 (76.95%) and zxing-wasm’s 3,851 (48.14%). The gap is not uniform: Scandit decodes more Codabar, Code 128, and MSI symbols, while Dynamsoft decodes more DotCode, MaxiCode, USPS Intelligent Mail, and POSTNET. Every reader was configured with all the symbologies its SDK supports, and every annotation counts in the denominator, so the aggregate reports exactly that configuration.

When This Applies

  • You are shortlisting SDKs and need to compare claims. A published dataset lets you put two vendors on the same images before you spend a trial license on integration work.
  • You need acceptance criteria. “95% of expected payloads on our own sample, with zero false positives on controls” is testable; “industry-leading accuracy” is not.
  • You are upgrading a pinned SDK. A rerun against unchanged images separates a real regression from a new device or a new camera pipeline.
  • You are publishing the comparison. Publish the artifacts, so readers can check your dataset choices.

Why a Benchmark Earns a Place in a Purchase Decision

The average scan is the least interesting number in a barcode deployment. What breaks a workflow is a specific format under a specific condition: a POSTNET envelope that returns nothing, a Codabar wristband read as a different patient, a shelf label read from the wrong package. A benchmark is useful when it reports the distribution — per symbology, per capture effect, per symbol count — and when a wrong read is scored separately from no read at all.

The three questions a benchmark should answer are therefore narrow:

  1. Does the engine decode the formats I actually ship? Not “how many formats does the datasheet list”, but which ones return the exact payload on damaged input.
  2. Where does it lose? Blur, perspective, low contrast, glare, occlusion, small modules, and crowded frames fail for different reasons and have different fixes.
  3. Is it getting better or worse? That requires the same images, the same scoring rule, and the same denominators across releases.

A single vendor-run test usually can’t answer these, because the inputs aren’t visible.

What a Checkable Benchmark Publishes

The fastest way to evaluate a benchmark is to ask what it publishes. This is the checklist we applied to this dataset.

Question Why it matters This dataset
Are the input images published? Without the inputs you cannot re-run the comparison or test another decoder. 8,000 JPEGs, 24 directories, SHA-256 per image
Is the ground truth published? Scoring a decode needs the expected payloads, not just boxes. 11,372 payloads plus quadrilaterals in manifest.jsonl
Is the scoring code published? The matching rules decide the result as much as the decoder does. score.py, validate.py, report.py
Are per-image outcomes published? Aggregate rates hide where a decoder fails; the records show it. 24,000 records, including every no-read filename
Is the counting rule stated? A rate means nothing until wrong reads and no-reads are separated. Explicit exact-match rule, wrong-read and no-read split
Can a third party extend it? A benchmark you cannot add a decoder to stays a one-off study. Add a decoder to the runner; the images and annotations stay fixed, so results remain comparable

Publishing a dataset is expensive and exposes the rows you lose, which is why many benchmarks stop at the headline. The same standard applies to our own C++, Python, and JavaScript articles, which is why their no-read lists are published by filename rather than summarized.

Why Public Barcode Datasets Cannot Carry a Vendor Benchmark

Borrowing a public dataset is the obvious first move. Our earlier benchmark series used BarBeR, a benchmark that merges 12 public datasets into 8,748 real images with polygon annotations. The obstacle is the terms.

The terms block the use case

Dataset Images Symbologies Terms (as listed) What it blocks
Muenster BarcodeDB 1,055 EAN-13, UPC-A CC BY-NC-ND 4.0 Commercial use and redistribution of cropped or annotated frames
ArTe-Lab Medium 1D 430 EAN-13 CC BY 3.0 Nothing, but one symbology and one capture generation
BarBeR 8,748 images, 9,818 barcodes 18 types (14 linear, 4 two-dimensional) CC BY-NC-SA 4.0; account and citation required Commercial use, and share-alike on any derived frames

Terms are as listed on the dataset pages and the community index; check them before you rely on them. Two of the three sets are non-commercial, and the permissive one covers a single symbology. That is the pattern: the sets large enough to matter are not licensed for a commercial benchmark, and the one that is permissive is too narrow to settle the question — a single symbology, annotated for localization rather than decoding.

What the Synthetic Dataset Has to Get Right

Generating barcodes is easy. Generating a dataset that measures decoding rather than rendering is the hard part, and it comes down to five rules:

  1. Encode the symbology, not the pixels. Every payload must be valid for its format and unique within the dataset, with check digits computed by the same rules a printer would use.
  2. Compose at a plausible scale. A 512-pixel QR code pasted at full frame tests nothing; the module pitch has to land in the range a phone camera sees at 20 to 40 cm.
  3. Apply capture effects in physical order. Optics, then geometry, then sensor, then resampling. Blur applied before a downscale is a different measurement than blur applied after it.
  4. Reject frames whose pattern does not survive the render. The gate must measure the final JPEG, not the vector source.
  5. Freeze provenance. Seed, effect parameters, and every symbol quadrilateral go into the manifest, so a reviewer can point at one image and say “this is why”.

The pipeline that implements those rules is in generate_by_format.py, expand_corpus.py, rendering.py, capture_effects.py, and barcode_quality.py.

Synthetic dataset pipeline with sample frames

Step 1: Encode 24 Symbologies with Valid Payloads

Encoding runs through BWIPP via bwip-js, one process-wide pass that turns a JSON plan into base64 PNGs. The Python side decides the payload; Node renders it.

// encode.mjs — one PNG per planned symbol
const image = await bwip.toBuffer({
  bcid: encoder,          // "code128", "gs1-128", "postnet", "microqrcode" ...
  text,                   // payload, already valid for the symbology
  scale: 4,
  backgroundcolor: 'ffffff',
  ...options,             // height, check digit, MaxiCode mode 4
});

Payload construction is where most synthetic datasets go wrong. A Code 128 string of random characters will encode, but an EAN-13 without a valid check digit produces an image no decoder should accept — and if your generator does not know that, your ground truth will disagree with every reader. The dataset computes check digits explicitly:

def with_check_digit(body):
    total = sum(int(d) * (3 if i % 2 == 0 else 1) for i, d in enumerate(reversed(body)))
    return f"{body}{-total % 10}"

Around that core the planner handles the awkward cases: UPC-E expansion, MSI’s appended check digit, GS1-128 application identifiers, postal payload widths for POSTNET and Royal Mail, MaxiCode mode 4, and IATA 2 of 5’s even-length constraint. Payloads are deduplicated per format, so two symbols in one frame never share a value — otherwise a duplicate prediction could be scored as a correct match.

Step 2: Compose a Label on a Plausible Surface

A barcode is not pasted onto a blank canvas. Each frame starts from one of 36 background tiles — corrugated cartons, crumpled receipts, brushed metal, luggage fabric, poly bags, warehouse shelving — cropped, rotated, and scaled to the frame size. The tiles come from three 4x3 atlases produced with an image model from prompts describing packaging, paper, fabric, and work surfaces; the generator varies the crop, orientation, and lighting gradient per frame. A label patch is then composited on top with its own substrate, ink color, shading gradient, and quiet zone.

Dimension Values
Background scenes 36 (12 material swatches, 24 packaging and work-surface scenes)
Label appearances paper label, retail sticker, direct print, hang tag, laminated sticker
Layouts close-up, mid-shot, wide-shot, edge-positioned, stacked, side-by-side, staggered, clustered, scattered, dense grid
Frame sizes 12 sizes from 512x512 to 2048x1365
Symbols per positive frame 1 to 16

The quiet zone is computed from the symbology, not from the label: 44 x 22 modules for linear codes, 20 x 20 for grid codes, with extra margin for hang tags and retail stickers. The label is warped into a convex quadrilateral, and the generator refuses non-convex projections — a barcode bent into a bow tie is not a hard sample, it is an impossible print.

Step 3: Apply Capture Effects in Physical Order

Effects are applied by capture_frame in the order a camera would produce them: illumination and glare first, then frame geometry, then sensor effects, then resampling.

def capture_frame(canvas, truth, settings, rng, seed):
    parameters, geometry = dict(settings), {}
    canvas = apply_optics(canvas, truth, parameters, rng)          # uneven light, glare, contrast
    if "frame_rotation" in parameters or "frame_perspective" in parameters:
        canvas, geometry["homography"] = warp_frame(canvas, truth, parameters, rng)
    if "frame_crop" in parameters:
        canvas, geometry["crop"] = crop_frame(canvas, truth, parameters["frame_crop"], rng)
    pitch = max(.1, min(module_pitch(symbol) for symbol in truth))
    canvas = apply_sensor(canvas, parameters, rng, seed, pitch)    # blur, noise, JPEG
    if "low_resolution" in parameters:
        canvas = cv2.resize(canvas, size, interpolation=cv2.INTER_AREA)

The important line is pitch. Blur and downsampling are clamped to the module pitch measured in the current frame, so a 3-pixel Gaussian blur means one thing on a 4-pixel module and another on a 12-pixel module. Without that clamp, “motion blur” in a synthetic dataset silently becomes “destroy the barcode”, and every reader scores near zero for reasons that have nothing to do with decoding.

The parameter ladder runs from plausible to hostile across three severity tiers:

Effect Range across tiers
Frame rotation 4° to 25°
Frame perspective 0.06 to 0.30 of the frame
Frame crop keeps 40% to 88% of the frame
JPEG quality 84 down to 15
Contrast 0.92 down to 0.30
Uneven lighting 14% to 66% falloff
Glare 12% to 57% additive bloom
Motion blur 3 to 17 px
Blur stack 0.55σ to 2.0σ, plus 3 to 26 px motion
Noise σ 4 to 15
Downscale 0.85 down to 0.50

Four combinations stack effects the way a real capture does: rotation + uneven light + glare + low resolution; perspective + crop + padding + low contrast; JPEG + motion blur + noise + downscale; and a six-effect worst case. Twelve single-effect profiles and four combinations drive the capture stage; the base dataset adds the seven isolated effects — perspective, rotation, blur, low resolution, low contrast, noise, and occlusion — that give the manifest its 22 scenario labels.

Step 4: Reject Frames Where the Pattern Does Not Survive

Every rendered frame is checked again before it is written — not by running a reader, but by measuring the pattern it is supposed to contain. The check re-projects the encoder’s own ink mask through the recorded homography and samples edge transitions in the final JPEG. If the bars no longer separate from the substrate, the frame is re-rendered. A payload that one decoder cannot read is still a valid sample: the gate scores the pattern, not the reader.

if module_pitch(symbol) < 0.75 or (requested is not None and requested < 2 - .015):
    return "subpixel_pattern"
if symbol["occluded_fraction"] > 0.22:
    return "oversized_occlusion"
...
if (np.median(luma) < 12 or
        np.mean(luma >= 6) < 0.58):
    return "weak_pattern"
Gate Threshold Why
Requested module pitch at least 2 px/module Below that, the pattern is resampling noise
Measured horizontal pitch at least 0.75 px/module A linear code needs resolvable bars, not just presence
Occlusion area at most 22% of the symbol Past that, a “hard sample” is a destroyed sample
QR / Micro QR finder patterns never occluded A covered finder tests geometry, not decoding
Median edge luma at least 12 Contrast must survive JPEG, not just the vector stage
Retained edge fraction at least 58% of edges at 6 luma Prevents a mostly-flat image passing on a few strong edges

This is the gate that keeps the dataset from drifting into unreadable noise: a frame that fails it is re-rendered with a weaker effect instead of being published as a hard sample. Because the test is photometric and geometric, it applies identically to every engine.

Step 5: Freeze the Manifest

Each accepted image writes one JSON line. The fields are the audit trail:

{
  "sample_id": "syn3-00103",
  "relative_path": "images/POSTNET/syn3-00103.jpg",
  "image_sha256": "…",
  "scenario": "high_density",
  "severity": 2,
  "effects": ["high_density"],
  "seed": 4771…,
  "composition": "dense-grid",
  "appearance": "paper-label",
  "background": "clear-clamshell",
  "frame_transform": [[…]],
  "ground_truth": [
    {"format": "POSTNET", "text": "…", "polygon": [[x, y], …], "label_polygon": [[x, y], …]}
  ]
}

Two provenance rules make the set reproducible. First, the background atlas is hashed: the three atlas PNGs are recorded by SHA-256 in inventory.json, so a different crop of the same atlas is detectable. Second, near-duplicates are screened with perceptual hashes before acceptance — Hamming distance 8 for pHash, 5 for dHash, and a 24x24 RGB thumbnail mean absolute error of 10 — so the dataset does not contain the same label twelve times with different JPEG noise.

The published inventory is the result:

Dataset stage Count Role
JPEG images 8,000 Denominator for every reader, including controls
Annotated symbols 11,372 Ground-truth formats and payloads
Symbologies 24 13 linear, 4 postal, 7 two-dimensional
Background scenes 36 Reusable surfaces, packaging, and work areas
Background-only controls 200 An empty response is the correct answer
Mixed-symbology frames 153 Several formats in one frame
Raw decoder records (native) 24,000 8,000 images x 3 readers x 1 pass

Results on the 8,000-Image Dataset

Every reader received the same RGB frame for each image and was configured with every symbology its SDK supports. Dynamsoft used ReadBarcodes_Default with BF_ALL; ZXing-C++ 3.1.1 used its full native format list with tryHarder; Scandit Linux 8.7.1 ran its high-effort multi-scan mode. Timing covers the decode call only — image loading is recorded separately. One measured pass per reader.

C++ / Linux, Ubuntu 24.04 under WSL2

Decoder Exact images Image accuracy Wrong-read images No read Incomplete Mean Median P95
Dynamsoft Barcode Reader 11.6.50.29329 6,714 / 8,000 83.93% 107 820 359 39.11 ms 22.99 ms 114.04 ms
Scandit Linux SDK 8.7.1 6,025 / 8,000 75.31% 459 1,305 211 57.28 ms 57.95 ms 94.47 ms
ZXing-C++ 3.1.1 3,852 / 8,000 48.15% 56 3,829 263 8.60 ms 6.11 ms 27.19 ms

JavaScript / WebAssembly, headless Chrome 156

Decoder Exact images Image accuracy Wrong-read images No read Incomplete Mean Median P95
Dynamsoft Barcode Reader for Web 11.6.5000 6,496 / 8,000 81.20% 67 1,050 387 118.28 ms 43.95 ms 330.70 ms
Scandit Data Capture SDK for Web 8.7.1 6,156 / 8,000 76.95% 5 1,480 359 64.91 ms 57.70 ms 124.90 ms
zxing-wasm 3.1.2 3,851 / 8,000 48.14% 54 3,832 263 25.63 ms 19.90 ms 72.20 ms

Benchmark results: exact images and symbol recall

All three SDKs are integrated in the published runner, so you can re-run this comparison and check every number, including ours. An exact image is one where every expected payload matched, with no extra predictions.

Video Walkthrough

The recording runs through the dataset counts, the five pipeline stages, the measured results, and the artifacts that ship with them.

Key Trade-offs

Approach Best for Blind spots
Synthetic still images (this dataset) Wide symbology coverage, payload-level ground truth, regression testing, licensed redistribution, per-effect isolation No real optics, demosaicing, rolling shutter, or hand tremor; composition and effect parameters encode the author’s idea of “hard”; absolute scores describe this dataset, not the population of real labels
Public photograph datasets Real sensor noise and real label damage; sanity checks against published research small individual sets or account-gated aggregates, polygon-level ground truth, several under NC-ND licenses, some label errors
Vendor workflow tests Live camera behavior, ergonomics, scan distance, human task time Inputs and records usually unpublished; small samples; one device and one lighting setup

The practical combination is all three: synthetic dataset for coverage and regression, a public set for a realism check, and your own captured images for the decision. The synthetic dataset is the only one of the three you can publish without clearing rights on every frame, which is exactly why it carries the reproducible results.

Run the Benchmark on Your Own Images

The dataset is only half the artifact; the runner is the other half. Clone the benchmark repository, install the Python and Node dependencies, and regenerate the dataset from its seed:

python -m pip install -r requirements.txt
npm ci
python generate_by_format.py --output .runs/grouped-base
python expand_corpus.py --base .runs/grouped-base --output .runs/generated-8000
python validate.py --dataset .runs/generated-8000 --expected-images 8000

validate.py checks the manifest hash, the image count, the annotation count, and the effect coverage before any reader runs. Then score a pass and build the HTML report — the Python runner is the shortest path because it needs no container:

python -m pip install -r python/requirements.txt
python python/run_benchmark.py --dataset dataset-by-format --output results/python
python python/score.py --run results/python --output review/python/summary.json
python report.py --python-run results/python

The C++ and browser runners are documented in the repository README, including the Docker build for the Linux SDKs. To test your own images instead, point the Python runner at a directory and supply a manifest with relative_path and ground_truth; the scorer treats it like any other dataset. A 30-day trial license is enough for a full pass — the 8,000-image run takes about nine minutes in a single Python process.

Generated HTML report for the C++ run

The report lists every no-read and incomplete filename by reader, links to the original JPEG, and shows the annotations next to the returned values. That is the artifact that makes a disagreement productive: if you think a score is wrong, you can open the image and see which of you is right.

Common Issues & Edge Cases

  • The JPEG quality changes the result. Frames are written at quality 94 because the dataset measures decoding, not compression artifacts; a lower global quality shifts every reader’s numbers and makes the dataset incomparable with the published one.
  • OpenCV and NumPy versions move pixels. The inventory pins OpenCV 5.0.0, NumPy 2.5.4, Python 3.14.4, and bwip-js 4.11.4. Regenerating under a different OpenCV build can change interpolation and resampling enough to change a borderline frame.
  • Duplicate predictions are not wrong payloads. Scandit’s Linux multi-scan returns the same symbol more than once when its temporal duplicate filter is disabled. The scorer counts each unmatched prediction against the image, which is the strict rule; read the precision column with that in mind.
  • A blank control is a real test. 200 frames contain no barcode. Any prediction on them is a false positive; Dynamsoft produced one in the native run, Scandit and ZXing produced none.

Conclusion

A benchmark earns trust from what a reader can check. This dataset publishes the images, annotations, generator, scorer, and every per-image result, including the rows where Dynamsoft Barcode Reader does not lead. Use it as a baseline for regression testing and shortlisting, then confirm the decision on your own labels and devices.

Reproducibility

  • Dataset and code. Dynamsoft synthetic barcode benchmark — generator, manifest, runners, scorer, and all three HTML reports.
  • Manifest. dataset-by-format/manifest.jsonl, SHA-256 588e834e2343ce69eb8ceaba0995898d2b51d0f42f66eac8868652c30040e077, 8,000 images and 11,372 annotations.
  • Raw records. results/ for native, browser, and Python passes; each run.json carries the manifest hash, decoder versions, warm-up count, and shuffle seed.
  • Environment. C++ run on Ubuntu 24.04 under WSL2; browser run in headless Chrome 156 on Windows 11 (Intel Core i5-13400F); Python run on Windows 11 with Python 3.14.4.
  • Benchmark date. 2026-11-19. Dynamsoft Barcode Reader 11.6.50.29329 (C++), 11.6.5000 (Web), 3.6.5000 (Python); Scandit Linux and Web 8.7.1; ZXing-C++ 3.1.1; zxing-wasm 3.1.2.

Want to run this code in your own project?

Get a 30-day free trial license