text_box — ANNOTATE text op

• Data kinds: image2d × text → image2d

• Call: import fullseye as fs; fs.ledger.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, bold=False, italic=False) (to call the implementation directly, 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, bold=False, italic=False); from the registry, opsannotate.get("text_box"))

Usage

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

板が画像からはみ出す / 文字が収まらない / コントラスト不足 /

未知の役割名・アンカー / 負の余白。

Detailed usage guide

• figure_annotation family guide

Background guides (the physics and conventions behind this op)

• dataset_conventions — 学習データセット規約の知識 — COCO / YOLO / VOC と外観検査での落とし穴

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)

• annotate_gallery — py -3.11 examples/annotate_gallery.py

• annotate_paper_tour — py -3.11 examples/annotate_paper_tour.py

• drawlist_deferred — py -3.11 examples/drawlist_deferred.py

• poc_active_contours — py -3.11 examples/poc_active_contours.py

• poc_ball_bounce — py -3.11 examples/poc_ball_bounce.py

• poc_beam_modal_video — py -3.11 examples/poc_beam_modal_video.py

• poc_cad_scan_deviation — py -3.11 examples/poc_cad_scan_deviation.py

• poc_camera_calibration — py -3.11 examples/poc_camera_calibration.py

• poc_camera_shake_deblur — py -3.11 examples/poc_camera_shake_deblur.py

• poc_connectome_across_worms — py -3.11 examples/poc_connectome_across_worms.py

• poc_crack_width_timeseries — py -3.11 examples/poc_crack_width_timeseries.py

• poc_ct_void_morphology — py -3.11 examples/poc_ct_void_morphology.py

• poc_dehazing — py -3.11 examples/poc_dehazing.py

• poc_dem_terrain — py -3.11 examples/poc_dem_terrain.py

• poc_dic_strain — py -3.11 examples/poc_dic_strain.py

• poc_driving_crossing — py -3.11 examples/poc_driving_crossing.py

• poc_driving_decisions — py -3.11 examples/poc_driving_decisions.py

• poc_driving_endless_map — py -3.11 examples/poc_driving_endless_map.py

• poc_driving_lateral — py -3.11 examples/poc_driving_lateral.py

• poc_driving_longitudinal — py -3.11 examples/poc_driving_longitudinal.py

• poc_driving_pass — py -3.11 examples/poc_driving_pass.py

• poc_driving_school — py -3.11 examples/poc_driving_school.py

• poc_driving_traffic — py -3.11 examples/poc_driving_traffic.py

• poc_driving_weather — py -3.11 examples/poc_driving_weather.py

• poc_emva1288_sensor — py -3.11 examples/poc_emva1288_sensor.py

• poc_eye_to_brain — py -3.11 examples/poc_eye_to_brain.py

• poc_focus_stacking — py -3.11 examples/poc_focus_stacking.py

• poc_graph_hierarchy_segmentation — py -3.11 examples/poc_graph_hierarchy_segmentation.py

• poc_interferometry_step — py -3.11 examples/poc_interferometry_step.py

• poc_kendama — py -3.11 examples/poc_kendama.py

• poc_leak_localization — py -3.11 examples/poc_leak_localization.py

• poc_lidar_terrain_change — py -3.11 examples/poc_lidar_terrain_change.py

• poc_livestock_body_volume — py -3.11 examples/poc_livestock_body_volume.py

• poc_machine_condition_fusion — py -3.11 examples/poc_machine_condition_fusion.py

• poc_malecns_activity_wave — py -3.11 examples/poc_malecns_activity_wave.py

• poc_measurement_system_analysis — py -3.11 examples/poc_measurement_system_analysis.py

• poc_mesh_quality_repair — py -3.11 examples/poc_mesh_quality_repair.py

• poc_motion_magnification — py -3.11 examples/poc_motion_magnification.py

• poc_multibeam_bathymetry — py -3.11 examples/poc_multibeam_bathymetry.py

• poc_panorama_drift — py -3.11 examples/poc_panorama_drift.py

• poc_particle_tracking — py -3.11 examples/poc_particle_tracking.py

• poc_photoelasticity — py -3.11 examples/poc_photoelasticity.py

• poc_print_warpage_risk — py -3.11 examples/poc_print_warpage_risk.py

• poc_registration_basin — py -3.11 examples/poc_registration_basin.py

• poc_river_surface_velocity — py -3.11 examples/poc_river_surface_velocity.py

• poc_rotation_invariance_audit — py -3.11 examples/poc_rotation_invariance_audit.py

• poc_segmentation_gauntlet — py -3.11 examples/poc_segmentation_gauntlet.py

• poc_stockpile_volume — py -3.11 examples/poc_stockpile_volume.py

• poc_strain_history — py -3.11 examples/poc_strain_history.py

• poc_structure_4d_deterioration — py -3.11 examples/poc_structure_4d_deterioration.py

• poc_superresolution_limits — py -3.11 examples/poc_superresolution_limits.py

• poc_table_tennis_bounce — py -3.11 examples/poc_table_tennis_bounce.py

• poc_table_tennis_rally_loop — py -3.11 examples/poc_table_tennis_rally_loop.py

• poc_table_tennis_spin — py -3.11 examples/poc_table_tennis_spin.py

• poc_template_tracking — py -3.11 examples/poc_template_tracking.py

• poc_timelapse_growth — py -3.11 examples/poc_timelapse_growth.py

• poc_traffic_counting — py -3.11 examples/poc_traffic_counting.py

• poc_ttc_rss — py -3.11 examples/poc_ttc_rss.py

• poc_world_terrain — py -3.11 examples/poc_world_terrain.py

• poc_wound_area_tracking — py -3.11 examples/poc_wound_area_tracking.py

• poc_xyt_event_surface — py -3.11 examples/poc_xyt_event_surface.py

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

arrow · leader_line · label_points · crosshair · legend_box · color_bar · scale_bar · axes_frame

Same category (text)

measure_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.