annotate_table_layout — ANNOTATE paper op

• 資料種類:text → table

• 呼叫: import fullseye as fs; fs.ledger.annotate_table_layout(text, xy, anchor='lt', font_size=13, font_path=None, pad=6, col_gap=None, row_gap=0, align='auto', header=False, bold=False, italic=False, line_spacing=1.15)(要直接呼叫實作,import annotate; annotate.annotate_table_layout(text, xy, anchor='lt', font_size=13, font_path=None, pad=6, col_gap=None, row_gap=0, align='auto', header=False, bold=False, italic=False, line_spacing=1.15);從台帳取用則 opsannotate.get("annotate_table_layout"))

用法

回傳 table(dict):將以 Tab 分隔的字串作為表格放置時的欄與列位置。

列按 \n、欄按 \t 切分。欄寬由用指定大小的實際字型逐 1 個儲存格量得的寬度的最大值決定 —— 按字元數計算的話,日文與英數字之間必然出現偏差,所以除了實測沒有其他正確做法。

Parameters

text : str

Tab 分隔。所有列的欄數必須相同(不同則 ValueError)。

xy : (x, y)

anchor 所指的位置(x=col, y=row)。

anchor : str

'lt','ct','rt','lm','cm','rm','lb','cb','rb' 共 9 種。

pad : int

表格內側邊距 [px]。

col_gap : int or None

欄間距 [px]。None(預設)時取列高 ×0.6 四捨五入,所以

改變字型大小時間距也隨之變化。

row_gap : int

列之間追加的量 [px] (0 則保持原列距)。

align : str or sequence

TABLE_ALIGNS 之一,或逐欄的序列。"auto"

(預設)僅當該欄的值全部看起來是數字時才靠右對齊。

header=True 時標題列不參與判定。

header : bool

為真時把第 1 列作為標題設為粗體,並在其下畫 1 條線。

bold, italic : bool or int

合成字體(_bold_px / _italic_tile)。header 的

粗體與此無關,只作用於標題列。

Returns

dict

{"rect": (x,y,w,h), "ncols", "nrows", "col_w": [...], "col_x": [...], "row_y": [...], "row_h", "col_gap", "align": [...], "header", "rule_y": 標題線的 y(header 為假時為 None), "cells": [{"text","row","col","xy","width","bold"}]}。

col_x / row_y / cells[i]["xy"] 全部是影像座標。

Raises

ValueError

各列欄數不一致 / 為空 / 未知的 align anchor /

align 的長度與欄數不同。

Examples

>>> import annotate

>>> lay = annotate.annotate_table_layout("名稱\t值\nA\t1.5\nB\t22.25", (10, 10))

>>> lay["ncols"], lay["nrows"], lay["align"]

(2, 3, ['left', 'left'])

>>> lay2 = annotate.annotate_table_layout("名稱\t值\nA\t1.5\nB\t22.25", (10, 10),

... header=True)

>>> lay2["align"] # 去掉標題後第 2 欄只有數字

['left', 'right']

詳細使用指南

• figure_annotation 族使用指南

背景知識指南(該運算子背後的物理與規範)

• dataset_conventions — 訓練資料集規範知識 —— COCO / YOLO / VOC 及外觀檢測中的陷阱

參考(範例資料、文獻)

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

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

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

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

• annotate_paper_tour — py -3.11 examples/annotate_paper_tour.py

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

—

同類別(paper)

annotate_leader_layout · annotate_leader · annotate_markers · annotate_legend · annotate_dimension_layout · annotate_dimension · annotate_angle_layout · annotate_angle


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

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