Enum OcrUnderlineOptions
- Namespace
- LMKit.Extraction.Ocr
- Assembly
- LM-Kit.NET.dll
The optional behaviours of the engine's underline pass, the one that lifts underlines off a page before recognizing it and reports them as OcrUnderline detections. Nothing here changes which strokes are erased from the image the recognizer reads, except ErasePieces.
[Flags]
public enum OcrUnderlineOptions
Fields
None = 0The report as the pass finds it, nothing added, nothing dropped.
SuppressTextBelow = 1Drop from the report a mark with text as close below it as above it: a row separator rather than an underline.
ReportPieces = 2Report rows of short pieces that read as one underline: dashed and dotted underlines, the rules of single words, rows of underscore or hyphen glyphs.
ErasePieces = 4Also erase the piece rows the pass itself finds from the image the recognizer reads; rows erased as leaders are gone already.
LocalThickness = 8Let the text above a stroke, rather than the page's tallest components, set the thickness a stroke may have: a stroke over the page's cap but within half the height of its text is reported (never erased).
SuppressBoxEdge = 16Drop from the report a mark a vertical run meets at one end: a box or a cell.
SuppressThick = 32Drop from the report a mark thicker than half the text above it: a bar.
SuppressDebris = 64Drop from the report the debris of an erased stroke: the specks of the letters above it that its gap filling swept into the erasure, off the stroke's rows and without a run of their own, and the slices of its ragged edge left beside a wider mark on the same rows. A short piece the gap filling swept in whole on the stroke's own rows is a fragment of it and stays.
LineRelativeHug = 128Let a thin row of pieces (a stroke no thicker than a quarter of its text's height) sit as far under its text as a solid rule may, one text height instead of half of one, when it stands nearer to that text than to the ink below it (the next line's tops, a rule): a dashed or dotted underline set deep under its words is reported, a deep row between two lines is not. A row within half a text height is judged as before; a taller row keeps the half-height bar.
ReportFusedStrokes = 256Report a stroke fused with the word it underlines (letter bottoms, descenders or the feet of ideographs touching the rule make letters and rule one shape, which the pass otherwise reads as the baseline of a bold glyph run): the stroke lies at that shape's bottom, spans it, nothing continues through it and letters rather than a block stand on it. Reported, never erased.
RunSeededPieces = 512Seed the rows of pieces from the runs of ink a half-height opening of the page keeps, whatever glyph stands on them, beside the whole flat components: a dashed, dotted, per-glyph or per-word underline whose pieces fuse with descender glyphs reads as one row, where the fused glyph is too tall for a piece and the row would break at it.
NearestRowText = 1024Judge a stroke against the nearest row of glyphs above it rather than against every component within one reference height: the text height and text top a bigger line above would otherwise set come from the stroke's own row, and a frame or a rule with stubs is never that text. With it, a stroke whose two ends descend into a closed corner is a frame's top edge (BoxEdge) and a stroke whose same-extent neighbour, with a text row between them, is crossed by a vertical carries GridTwin; SuppressBoxEdge drops both. The image the recognizer reads is untouched, except under ErasePieces, where the piece rows this reading admits are the ones erased.
PerStrokeRuleMarks = 2048Describe the rules the line finder erased one stroke at a time: the erased ink in a rule's band is read as connected shapes, each shape as the runs of rows carrying ink over more columns than a vertical line is wide (a wall's rows are its own), and each run of rows is a stroke of its own (its own rows, thickness and ends), so a second stroke in the band (a cell rule under an underline, the next line's rule under a separator) neither widens the rule's mark nor lends it its refusal; a run no vector of its own names is judged as a rule all the same. With it, the join merges two marks only as one stroke (thicknesses within half the thicker, centres within the thinner height), and a row of pieces counts the ink touching it from below only where that ink also continues above the row (a glyph body through it), not for a rule standing under it. Reported geometry only; the image the recognizer reads is untouched, except under ErasePieces, where the piece rows this reading admits are the ones erased.
ReportFaint = 4096Read the grey page for the faint strokes the binarizer dropped: a hairline or a row of dots whose anti-aliased grey stays lighter than the page's threshold leaves nothing on the binary page the pass otherwise reads. Under each line of text, from the row below its glyphs' bottoms down one text height, a run of columns darker than the band's own paper level less a third of its distance to the page's threshold, as long as a stroke the pass keeps and dark over three tenths of it, at most two rows thick, with paper above and below it, clear of every stroke the binary page judged and of the fringe of its ink, and passing the binary page's guards, is reported with Faint, never erased. Asked for by name: Default does not carry it.
StemsAreGlyphs = 8192Read a glyph standing on a stroke as a glyph, not as the wall of a grid: a vertical shape meeting the stroke's rows refuses the stroke as a border unless its bottom lies within the stroke's rows or a pixel of them, it is under one and a half times the line's span (its text top to the stroke) tall and its top aligns with the top of the line's text within an eighth of the text height (two pixels at least), the shape of a letter (an l, a d, a 1, a parenthesis) whose foot touches its underline. A cell wall crosses the stroke or rises above the text, and the wall of a one-row box stands above the text top by the box's padding; both keep refusing. A stroke the pass refused for such a letter is re-judged and reported, never erased. The image the recognizer reads is untouched, except under ErasePieces, where the piece rows this reading admits are the ones erased.
InvertedReport = 16384Read the light strokes of the page's dark regions: light type on a dark ground (a filled header cell, a slide's ground) is the holes of one dark shape, and its underline, light as well, is a hole the pass never sees in the polarity it reads. Every shape whose box holds more ink than paper and could hold a line of text has its enclosed light content judged as a page of its own, against that content's text; the marks are merged into the report, NotErased, and the image the recognizer reads is untouched. Asked for by name: Default does not carry it.
ReportTextList = 32768Judge the strokes of the report (rows of pieces, strokes reported without erasure) against the report's own text list where it sees text the page's list does not: every component at least five rows tall and at least twice the stroke's height, so small type on a page whose reference height a larger face sets is text for the strokes under it, and their span floor, text-beside test, hug and thickness ceiling are measured in its units. A row of that list is at least two components, so a lone period, comma or fragment under a line never stands for the line. Where the two lists agree nothing moves; the image the recognizer reads is untouched, except under ErasePieces, where the piece rows this reading admits are the ones erased.
SuppressTextBandRows = 65536Drop from the report a row of pieces lying in the band of the glyphs of its own line: a row on the line's baseline made of the glyphs' bottoms and of the glyphs set on the baseline between them (the underscores of an identifier, the dots of a leader), with nothing running under a glyph, or a row through the middle of the glyphs' height (a strike). An underline lies under its letters, however close it stands.
Default = ReportPieces | LocalThickness | SuppressBoxEdge | SuppressThick | SuppressDebris | LineRelativeHug | ReportFusedStrokes | RunSeededPieces | NearestRowText | PerStrokeRuleMarks | StemsAreGlyphs | ReportTextList | SuppressTextBandRowsThe options the engine applies unless told otherwise.