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.

Parameters

img : ndarray

(H,W) or (H,W,C), float [0,1].

text : str

String to draw.

xy : (x, y)

Anchor position (x=col, y=row, row points down).

color : str or sequence

Role name or RGB. If text_color is not given, this is used as the frame colour

and the text gets a readable default colour.

text_color, box_color : str/sequence or None

Text colour and plate colour. None means default (light text × dark plate). When the text colour is None,

it switches automatically to dark text (the plate colour) only if the light default colour falls below min_contrast

against the colour that actually appears underneath -- so that labels of ticks, colour bars and legends placed

without a plate (box_alpha=0) on a white background do not

dissolve into the white. When text_color is given explicitly, it does not switch

(colour carries meaning in the figure, so it is not changed arbitrarily; if unreadable, an exception is raised).

box_alpha : float

Plate opacity [0,1]. 0 draws no plate (for tick labels).

anchor : str

9 options 'lt','ct','rt','lm','cm','rm','lb','cb','rb'.

pad : int

Inner padding of the plate [px].

max_width : int or None

Wrap width of the text. If None, it stays on 1 line.

wrap : bool

If False, it does not wrap but stays on 1 line and shrinks to fit max_width.

min_contrast : float

Lower bound on the contrast ratio between the text and "the colour that actually appears beneath it". Below it,

ValueError (text that blends into the background is noticed by nobody, so it is not let through).

Limit (honestly): what it compares against is the mean colour under the plate, so

placed with box_alpha=0 on a photo that is half white and half black, the mean

becomes mid grey and passes the check (the text over the white part is unreadable).

Where the ground is busy, raise box_alpha to let the plate work --

this check is meant to catch "forgot the plate", and

does not guarantee against "unreadable even with a plate".

border : int

Thickness of the plate's frame line (0 for no frame). Colour is border_color or color.

style : dict or None

Arguments passed through to imagedraw.draw_polyline, which draws the frame line.

Returns

ndarray

New array of the same shape.

Raises

ValueError

plate sticks out of the image / text does not fit / insufficient contrast /

unknown role name or anchor / negative padding.

Detailed usage guide

• figure_annotation family guide

Background guides (the physics and conventions behind this op)

• dataset_conventions — Training-dataset conventions — COCO / YOLO / VOC and pitfalls in visual inspection

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_agv_fleet — py -3.11 examples/poc_agv_fleet.py

• poc_air_hockey_intercept — py -3.11 examples/poc_air_hockey_intercept.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_diabolo_model_and_vision — py -3.11 examples/poc_diabolo_model_and_vision.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_food_cutting_measure — py -3.11 examples/poc_food_cutting_measure.py

• poc_granular_heap_repose — py -3.11 examples/poc_granular_heap_repose.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_peg_failure_recovery — py -3.11 examples/poc_peg_failure_recovery.py

• poc_peg_insertion_tactile — py -3.11 examples/poc_peg_insertion_tactile.py

• poc_photoelasticity — py -3.11 examples/poc_photoelasticity.py

• poc_powder_scoop_pour — py -3.11 examples/poc_powder_scoop_pour.py

• poc_print_warpage_risk — py -3.11 examples/poc_print_warpage_risk.py

• poc_pxrd_phase_peel — py -3.11 examples/poc_pxrd_phase_peel.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_rover_slip_risk_path — py -3.11 examples/poc_rover_slip_risk_path.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_swarm_obstacle_from_flow — py -3.11 examples/poc_swarm_obstacle_from_flow.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_tacscalib_sphere_lut — py -3.11 examples/poc_tacscalib_sphere_lut.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.