dm_encode — SYMBOL datacode2d op

• Data kinds: none → table (an op determined by its arguments alone — it takes no image or data input)

• Call: import fullseye as fs; fs.ledger.dm_encode(text, size=None, shape: 'str' = 'square', encodation: 'str' = 'auto') -> 'dict' (to call the implementation directly, import dmsym; dmsym.dm_encode(text, size=None, shape: 'str' = 'square', encodation: 'str' = 'auto') -> 'dict'; from the registry, opssymbol.get("dm_encode"))

• GPU: none (CPU reference implementation only)

Usage

Encode a string into a Data Matrix ECC200 module grid and its module-to-codeword map (table).

> The detailed description below is the original text — the summary and the headings are translated.

Encode text (str with code points <= 255, or bytes) as an ECC200 symbol.

Parameters

text : str | bytes

U+0000..U+00FF のみ(Latin-1 の 1 バイト)。ECI は扱わない。

size : None | int | (rows, cols)

None なら shape の中で収まる最小の記号。int は正方形 N×N。

shape : {"square", "rectangle", "any"}

size が None のときの候補。"rect" も "rectangle" と同じ。

encodation : {"auto", "ascii", "c40", "text", "base256"}

"auto" は各記号の大きさで ascii → c40 → text → base256 の順に試し、

最小の記号に収まる最初のもの(文書全体を 1 つの符号化で書く。区間ごとの最適化はしない)。

Returns

dict

modules (R, C) uint8 1 = 暗(L 字・クロック・領域の区切り込み)、rows, cols,

text, encodation, blocks [(n_data, n_ec)], n_data_codewords,

n_ec_codewords, function_mask (R, C) bool, fixed_mask(右下の固定 2x2),

codeword_index (R, C) int16(送出順の符号語番号、機能 module と固定角は -1)、

bit_index(0 = 最上位ビット、-1 = 対象外)、codewords(送出順の全符号語)、

data_codewords(パッド込み)。

Detailed usage guide

• symbol_reading family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_symbol_part_dpm — py -3.11 examples/poc_symbol_part_dpm.py

Ops the type connects to (they accept table as input)

render_symbol · symbol_read_trials · symbol_read_pod · ocr_classify · ocr_read_line · ocr_read_trials

Same category (datacode2d)

qr_encode · qr_decode_modules · qr_locate · qr_sample · qr_read · dm_decode_modules · dm_locate · dm_sample


*Provenance: dmsym.py — SYMBOL operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

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