Class OcrUnderline
- Namespace
- LMKit.Extraction.Ocr
- Assembly
- LM-Kit.NET.dll
One underline the OCR engine found under a text line and lifted from the page before recognizing it: the words above read clean, and the mark is kept as a detection.
public sealed class OcrUnderline
- Inheritance
-
OcrUnderline
- Inherited Members
Examples
OcrResult result = await ocr.RunAsync(parameters);
foreach (OcrUnderline underline in result.Underlines)
{
if (underline.FirstWordIndex >= 0)
{
var words = result.TextElements
.Skip(underline.FirstWordIndex)
.Take(underline.LastWordIndex - underline.FirstWordIndex + 1);
Console.WriteLine($"Underlined: {string.Join(" ", words.Select(w => w.Text))}");
}
}
Constructors
- OcrUnderline(Quadrilateral, double, int, int, int, Trait, double?, double?)
Initializes a new instance of the OcrUnderline class.
- OcrUnderline(double, double, double, double, double, int, int, int, Trait, double?, double?)
Initializes a new instance of the OcrUnderline class from the edges of its box, the form the JSON carries; a deskewed box is restored axis-aligned, as the text elements' boxes are.
Properties
- Bounds
The box of the stroke, in the frame of TextElements: the same units, page rotation and deskew as the words.
- FirstWordIndex
Index in TextElements of the first word of that line the underline runs under, or -1 when it runs under none.
- GapAbove
The blank space between the stroke and the nearest ink above it over its columns, in the units of Bounds, or null when none lies within two text heights.
- GapBelow
The blank space between the stroke and the nearest ink below it over its columns, in the units of Bounds, or null when none lies within two text heights.
- HasWords
Whether the underline runs under at least one recognized word.
- LastWordIndex
Index in TextElements of the last word of that line the underline runs under (inclusive), or -1 when it runs under none.
- LineIndex
Zero-based index, in reading order, of the text line the engine read above the underline, or -1 when no recognized line sits on it.
- Traits
What the page around the stroke says about it.