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):将制表符分隔的字符串作为表格放置时的列与行位置。

行按 \n、列按 \t 切分。列宽由用指定大小的实际字体逐 1 个单元格测得的宽度的最大值决定 —— 按字符数计算的话,日文与英文数字之间必然出现偏差,所以除了实测没有其他正确做法。

Parameters

text : str

制表符分隔。所有行的列数必须相同(不同则 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.