text_lines — TEXT layout op

• Data kinds: table → table

• Call: import fullseye as fs; fs.ledger.text_lines(boxes, stroke_width=None, overlap_ratio: 'float' = 0.5, gap_ratio: 'float' = 3.0, width_ratio: 'float' = 3.0) (to call the implementation directly, import textregion; textregion.text_lines(boxes, stroke_width=None, overlap_ratio: 'float' = 0.5, gap_ratio: 'float' = 3.0, width_ratio: 'float' = 3.0); from the registry, opstext.get("text_lines"))

• GPU: none (CPU reference implementation only)

Usage

Groups character-candidate boxes into lines (vertically overlapping, horizontally close, similar stroke width).

★Basis of the rule (measured 2026-09-27): candidates come out as per-stroke fragments (a horizontal bar and an 'l' differ 5x in height), so requiring "similar height" split 3 lines into 30–60. Line membership is decided by vertical overlap (at least overlap_ratio of the smaller height), the horizontal gap must be within gap_ratio times the larger height, and the stroke width within width_ratio times.

boxes accepts two forms: (1) an N×4 array of rectangles [y0, x0, y1, x1] (the original form), (2) the table returned by text_candidates (a dict; it must have boxes, and its stroke_width is used if present). The ledger declares this op's input as table, so passing the candidates' table as is connects the chain text_candidates -> text_lines (★2026-11-03: passing a table used to fail with a TypeError from int() — found by the recipe e2e). Passing a table and a separate stroke_width raises ValueError because it is undecided which to use (fail-closed). A dict without a boxes key also raises ValueError.

Returns dict: lines (M×4 rectangles) / members (the list of candidate indices of each line).

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)

• poc_text_region_truth — py -3.11 examples/poc_text_region_truth.py

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

—

Same category (layout)

—


*Provenance: textregion.py — TEXT 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.