grade_datacode2d — SYMBOL print_quality op

• 資料種類:image2d → table

• 呼叫: import fullseye as fs; fs.ledger.grade_datacode2d(image, symbology='auto', *, aperture_x=0.8, expected_text=None)(要直接呼叫實作,import symgrade; symgrade.grade_datacode2d(image, symbology='auto', *, aperture_x=0.8, expected_text=None);從台帳取用則 opssymbol.get("grade_datacode2d"))

• GPU:無(僅 CPU 參考實作)

用法

回傳影像中二維符號(QR / Data Matrix)的印刷品質等級(table)。

> 以下的詳細說明為原文 —— 摘要與標題已翻譯。

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)。

詳細使用指南

• symbol_reading 族使用指南

參考(範例資料、文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

• 演算法的正典(作者、年份)與用途見上面的族使用指南。

可執行的範例(實際呼叫該運算子並已驗證的樣例)

• poc_symbol_part_dpm — py -3.11 examples/poc_symbol_part_dpm.py

型別可銜接的下一個運算子(可接受 table 作為輸入)

render_symbol · symbol_read_trials · symbol_read_pod · ocr_classify · ocr_read_line · ocr_read_trials

同類別(print_quality)

grade_barcode_profile · grade_barcode1d


*Provenance: symgrade.py — SYMBOL 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

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