scale_bar — ANNOTATE furniture op

• Data kinds: image2d → image2d

• Call: import fullseye as fs; fs.ledger.scale_bar(img, length, units_per_pixel, unit='µm', xy=None, anchor='rb', color='neutral', thickness=5, margin=14, font_size=13, label=True, label_fmt='{:g}', font_path=None, scheme='okabe_ito', text_color=None) (to call the implementation directly, import annotate; annotate.scale_bar(img, length, units_per_pixel, unit='µm', xy=None, anchor='rb', color='neutral', thickness=5, margin=14, font_size=13, label=True, label_fmt='{:g}', font_path=None, scheme='okabe_ito', text_color=None); from the registry, opsannotate.get("scale_bar"))

Usage

A scale bar in physical length. The pixel↔physical conversion is taken as an argument (never assumed).

The pixel length of the bar is round(length / units_per_pixel) -- this is the ground truth by construction, and tests.test_annotate checks this agreement with numbers.

Parameters

length : float

Physical length the bar represents (in units of unit).

units_per_pixel : float

How many unit 1 pixel corresponds to. Pass the resolution, not the magnification.

unit : str

Notation of the unit ('µm', 'mm', 'px' etc.).

xy : (x,y) or None

Reference point of the bar. If None, margin inward from the corner on the anchor side.

label : bool

Whether to add the "200 µm" label alongside.

Returns

ndarray

Raises

ValueError

length / units_per_pixel not positive or non-finite, pixel length below 1,

bar (and label) does not fit in the image.

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

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

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

Same category (furniture)

legend_box · color_bar


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