Lyo.Images.Ocr
1.0.2
dotnet add package Lyo.Images.Ocr --version 1.0.2
NuGet\Install-Package Lyo.Images.Ocr -Version 1.0.2
<PackageReference Include="Lyo.Images.Ocr" Version="1.0.2" />
<PackageVersion Include="Lyo.Images.Ocr" Version="1.0.2" />
<PackageReference Include="Lyo.Images.Ocr" />
paket add Lyo.Images.Ocr --version 1.0.2
#r "nuget: Lyo.Images.Ocr, 1.0.2"
#:package Lyo.Images.Ocr@1.0.2
#addin nuget:?package=Lyo.Images.Ocr&version=1.0.2
#tool nuget:?package=Lyo.Images.Ocr&version=1.0.2
Lyo.Images.Ocr
Engine-agnostic OCR contracts for Lyo: IOcrEngine, request/response models, Y-up pixel bounding boxes (aligned with BoundingBox2D), coordinate helpers, and shared OcrEngineOptions.
Implementations (e.g. Lyo.Images.Ocr.Tesseract) register IOcrEngine. This package only registers cross-provider options via AddOcrEngineOptions / AddOcrEngineOptionsFromConfiguration.
Examples
Configuration
{
"OcrEngine": {
"EnableMetrics": false,
"DefaultLanguages": "eng",
"DefaultPageSegmentationMode": "SparseTextOsd"
}
}
Configuration (2)
using Lyo.Images.Ocr;
services.AddOcrEngineOptionsFromConfiguration(builder.Configuration);
// then register a concrete IOcrEngine (e.g. AddTesseractOcrEngine).
Public API
| Type | Description |
|---|---|
IOcrEngine |
ReadAsync(Stream imageStream, OcrReadRequest?, CancellationToken) → Task<Result<OcrPageResult>> — runs OCR on an encoded raster stream (PNG/JPEG/etc.). |
OcrReadRequest |
Optional per-call overrides: Languages, PageSegmentationMode, MinimumConfidencePercent. |
OcrPageResult |
FullText, Words (with pixel Y-up bounding boxes), Lines (grouped), ImageWidth, ImageHeight. |
OcrWord / OcrLine |
Word + line records used in OcrPageResult. OcrWord.BoundingBoxPixels is a BoundingBox2D (Y-up). |
OcrEngineOptions |
EnableMetrics, DefaultLanguages (default "eng"), DefaultPageSegmentationMode (default SparseTextOsd); SectionName = "OcrEngine". |
OcrPageSegmentationMode |
Provider-neutral layout modes (AutoOsd, Auto, SingleColumn, SingleBlock, SingleLine, SingleWord, CircleWord, SingleChar, SparseTextOsd, …). |
OcrCoordinateTransforms |
FromTopLeftDownwardRect, MapPixelBoxToPdfPoints, and other helpers to convert between raster, Y-up pixel, and PDF point coordinates. |
OcrLineGrouper |
Groups OcrWord results into OcrLine rows. |
OcrMetrics / OcrErrorCodes |
Metric name and error code constants for engines to use consistently. |
OcrServiceCollectionExtensions |
DI: AddOcrEngineOptions(Action<OcrEngineOptions>?), AddOcrEngineOptionsFromConfiguration(IConfiguration, sectionName?). |
Bounding boxes
OcrWord.BoundingBoxPixelsuses Y-up coordinates: origin at the bottom-left of the image, soTop>BottomandHeight = Top - BottommatchesBoundingBox2D.- Use
OcrCoordinateTransforms.FromTopLeftDownwardRectto convert typical top-left raster rects (e.g. Tesseract) into this form. - For PDF overlay with a rendered page, use
OcrCoordinateTransforms.MapPixelBoxToPdfPoints(seeLyo.Pdf.Ocr).
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Common— (direct, lyo)Lyo.Exceptions— (direct, lyo)Lyo.Metrics— (direct, lyo)Lyo.Result— (direct, lyo)Microsoft.Extensions.Configuration.Binder10.0.5— (direct, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5— (direct, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5— (direct, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5— (transitive, microsoft)System.Memory4.6.3— (transitive, microsoft, netstandard2.0)System.Text.Json10.0.5— (transitive, microsoft, netstandard2.0)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Lyo.Common (>= 1.0.2)
- Lyo.Exceptions (>= 1.0.2)
- Lyo.Metrics (>= 1.0.2)
- Lyo.Result (>= 1.0.2)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Lyo.Images.Ocr:
| Package | Downloads |
|---|---|
|
Lyo.Pdf.Ocr
OCR pipeline for PDF pages: rasterize (PDFium), run IOcrEngine, map pixel boxes to PDF points. |
|
|
Lyo.Images.Ocr.Tesseract
Tesseract-backed implementation of Lyo.Images.Ocr (local OCR). |
GitHub repositories
This package is not used by any popular GitHub repositories.