dm_encode — SYMBOL datacode2d op

• 資料種類:無 → table(僅由參數決定的運算子 —— 不接受影像或資料輸入)

• 呼叫: import fullseye as fs; fs.ledger.dm_encode(text, size=None, shape: 'str' = 'square', encodation: 'str' = 'auto') -> 'dict'(要直接呼叫實作,import dmsym; dmsym.dm_encode(text, size=None, shape: 'str' = 'square', encodation: 'str' = 'auto') -> 'dict';從台帳取用則 opssymbol.get("dm_encode"))

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

用法

將字串編碼為 Data Matrix ECC200 的模組格線及模組到碼字的對應(table)。

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

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(パッド込み)。

詳細使用指南

• 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

同類別(datacode2d)

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


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

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