text op• Data kinds: image2d × text → image2d
• Call: import annotate; annotate.text_box(img, text, xy, color='neutral', text_color=None, box_color=None, box_alpha=0.72, anchor='lt', pad=5, font_size=14, min_font_size=9, max_width=None, font_path=None, line_spacing=1.15, scheme='okabe_ito', min_contrast=2.0, border=0, border_color=None, style=None, wrap=True) (or opsannotate.get("text_box"))
Text on a backing plate (a translucent panel). Overflow raises instead of being silently clipped.
> The detailed description below is the original text — the summary and the headings are translated.
Parameters
----------
img : ndarray
`(H,W) か (H,W,C)`、float [0,1]。
text : str
描く文字列。
xy : (x, y)
アンカーの位置(x=col, y=row、row は下向き)。
color : str or sequence
役割名または RGB。`text_color` 未指定ならこれが枠の色として
使われ、文字は読みやすい既定色になる。
text_color, box_color : str/sequence or None
文字色・板の色。None なら既定(明るい文字 × 暗い板)。文字色が None の
ときは、実際に下に出る色に対して明るい既定色が `min_contrast` を
割る場合に限り、暗い文字(板の色)へ自動で切り替える ―― 板なし
(`box_alpha=0`)で白地に置く目盛り・カラーバー・凡例のラベルが
白に溶けないため。`text_color` を明示したときは切り替えない
(色は図の意味なので勝手に変えず、読めなければ例外にする)。
box_alpha : float
板の不透明度 [0,1]。`0` なら板を描かない(目盛りラベル向け)。
anchor : str
`'lt','ct','rt','lm','cm','rm','lb','cb','rb'` の 9 通り。
pad : int
板の内側余白[px]。
max_width : int or None
文字の折り返し幅。None なら 1 行のまま。
wrap : bool
False なら折り返さず 1 行のまま縮めて `max_width` に収める。
min_contrast : float
文字と「実際にその下に出る色」のコントラスト比の下限。下回れば
ValueError(背景と同化した文字は誰も気づけないので通さない)。
限界(正直に): 比べる相手は板の下の平均色なので、
白と黒が半々に混じった写真の上に `box_alpha=0` で置くと、平均は
中間灰になり検査を通ってしまう(白い部分の上の文字は読めない)。
地が荒れている場所では `box_alpha` を上げて板を効かせること ――
この検査は「板を忘れた」を捕まえるためのもので、
「板があっても読めない」まで保証はしない。
border : int
板の枠線の太さ(0 で枠なし)。色は `border_color か color`。
style : dict or None
枠線を引く :func:imagedraw.draw_polyline へ素通しする引数。
Returns
-------
ndarray
同じ shape の新しい配列。
Raises
------
ValueError
板が画像からはみ出す / 文字が収まらない / コントラスト不足 /
未知の役割名・アンカー / 負の余白。
• figure_annotation family guide
• dataset_conventions — 学習データセット規約の知識 — COCO / YOLO / VOC と外観検査での落とし穴
• 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.
• annotate_gallery — py -3.11 examples/annotate_gallery.py
• drawlist_deferred — py -3.11 examples/drawlist_deferred.py
image2d as input)arrow · leader_line · label_points · crosshair · legend_box · color_bar · scale_bar · axes_frame
text)*Provenance: annotate.py — ANNOTATE 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.