grade_datacode2d — SYMBOL print_quality op

• Data kinds: image2d → table

• Call: import fullseye as fs; fs.ledger.grade_datacode2d(image, symbology='auto', *, aperture_x=0.8, expected_text=None) (implementation को सीधे call करना हो तो import symgrade; symgrade.grade_datacode2d(image, symbology='auto', *, aperture_x=0.8, expected_text=None), registry से लेना हो तो opssymbol.get("grade_datacode2d"))

• GPU: नहीं (केवल CPU reference implementation)

उपयोग

image में 2-D symbol (QR / Data Matrix) का print-quality grade लौटाता है (table)।

> नीचे का विस्तृत विवरण मूल text में है — सारांश और headings का अनुवाद हो चुका है।

Grade a QR Code or Data Matrix in a reflectance image. The symbol is read (qrsym.qr_read / dmsym.dm_read), the image is filtered with a circular measuring aperture of aperture_x · X (default 0.8 X) and sampled at every module centre through the reader's homography, plus a one-module ring of quiet zone.

• symbol_contrast SC = Rmax − Rmin over those samples; GT = Rmin + SC / 2.

• module modulation 2·|R − GT| / SC; a module on the wrong side of GT (compared with the *ideal* module rebuilt from the decoded data) is graded 0. A codeword's grade is its worst module; the modulation grade is the highest level L such that the codewords graded below L, counted as errors, still leave unused error correction of grade ≥ L in every block (the error-correction rule of the 2-D method, as publicly described).

• fixed_pattern_damage: the worst module grade over the fixed patterns (QR: finders, separators, timing, alignment; Data Matrix: the L finder, the clock track and alignment patterns) and the quiet-zone ring. ★Simplified: one dull module of a finder limits it (the published method grades finder segments separately).

• the grid: the reader's homography is re-fitted (normalised DLT, twice) to every module edge measured along all rows and columns (sub-sample GT crossings within 0.45 module of an ideal dark/light boundary), so that the reader's own fit error is not graded as print non-uniformity (grid_refined).

• axial_nonuniformity = |X̄ − Ȳ| / ((X̄ + Ȳ)/2) of the mean module pitch along the two grid axes in pixels (the fitted grid: a tilt about one axis shows up here).

• grid_nonuniformity = the largest distance (modules) between a timing-pattern module centre located from its own edges and the fitted projective grid.

• unused_error_correction = min over blocks of 1 − 2·e / (n_ec − p) with the decoder's corrected-codeword count e and the misdecode-protection codewords p (QR 1-L/M/Q, 2-L, 3-L; 0 for Data Matrix).

• decode: 4 if read (and equal to expected_text when given), else 0.

overall_grade = the minimum parameter grade (0..4), letter, limiting. ideal_source says how the ideal modules were obtained ("reencode": the decoded text re-encoded with the same version / level / mask / mode reproduced the read; "codewords" (Data Matrix): rebuilt from the corrected codewords; "sampled": neither was possible, the thresholded samples stand in and wrong-side modules cannot be seen — modulation is then optimistic, flagged).

限界 / limits: 反射率は画像の値のまま、開口は円。Data Matrix 144x144 の不揃いなブロックのブロック割り当ては近似。鏡像の QR は読み取り器の格子(転置)で採点する。

空の入力は ValueError。拒否(ValueError): 2-D でない、非有限、未知の symbology、aperture_x が [0, 2] の外。読めないシンボルは例外にせず overall_grade = 0、decode = False (検証器が F を付けるのと同じ。読めない理由は error)。

उपयोग की विस्तृत guide

• symbol_reading family guide

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• poc_symbol_part_dpm — py -3.11 examples/poc_symbol_part_dpm.py

वे अगले ops जिनसे type जुड़ता है (table को input के रूप में लेते हैं)

render_symbol · symbol_read_trials · symbol_read_pod · ocr_classify · ocr_read_line · ocr_read_trials

इसी category के (print_quality)

grade_barcode_profile · grade_barcode1d


*Provenance: symgrade.py — SYMBOL operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.