Class OcrWord
One recognized word.
public sealed record OcrWord : IEquatable<OcrWord>
- Inheritance
-
OcrWord
- Implements
- Inherited Members
Examples
// Any IOcrEngine reads a Raster<Rgba8>; say the resolution and languages when you know them.
OneWordEngine engine = new();
using Raster<Rgba8> page = Raster.Load<Rgba8>("duck.png");
OcrResult result = await engine.RecognizeAsync(new OcrRequest(page) { Dpi = 300, Languages = ["eng"] }, Ct);
Console.WriteLine(result.Text);
foreach (OcrWord word in result.Words)
{
Console.WriteLine($"{word.Text} at {word.Box.Bounds}, {word.Confidence:P0} sure");
}
Constructors
OcrWord(string, OcrQuad, double?, string?)
One recognized word.
public OcrWord(string Text, OcrQuad Box, double? Confidence = null, string? Language = null)
Parameters
TextstringThe word's text.
BoxOcrQuadWhere the word is, in pixels of the image, its corners in the word's own reading order.
Confidencedouble?How sure the engine is, from 0 to 1, or null if it does not say.
LanguagestringThe word's language as the engine names it, or null if not known.
Examples
// Any IOcrEngine reads a Raster<Rgba8>; say the resolution and languages when you know them.
OneWordEngine engine = new();
using Raster<Rgba8> page = Raster.Load<Rgba8>("duck.png");
OcrResult result = await engine.RecognizeAsync(new OcrRequest(page) { Dpi = 300, Languages = ["eng"] }, Ct);
Console.WriteLine(result.Text);
foreach (OcrWord word in result.Words)
{
Console.WriteLine($"{word.Text} at {word.Box.Bounds}, {word.Confidence:P0} sure");
}
Properties
Box
Where the word is, in pixels of the image, its corners in the word's own reading order.
public OcrQuad Box { get; init; }
Property Value
Confidence
How sure the engine is, from 0 to 1, or null if it does not say.
public double? Confidence { get; init; }
Property Value
Language
The word's language as the engine names it, or null if not known.
public string? Language { get; init; }
Property Value
Text
The word's text.
public string Text { get; init; }