Lyo.Images.Ocr
2.0.0
dotnet add package Lyo.Images.Ocr --version 2.0.0
NuGet\Install-Package Lyo.Images.Ocr -Version 2.0.0
<PackageReference Include="Lyo.Images.Ocr" Version="2.0.0" />
<PackageVersion Include="Lyo.Images.Ocr" Version="2.0.0" />
<PackageReference Include="Lyo.Images.Ocr" />
paket add Lyo.Images.Ocr --version 2.0.0
#r "nuget: Lyo.Images.Ocr, 2.0.0"
#:package Lyo.Images.Ocr@2.0.0
#addin nuget:?package=Lyo.Images.Ocr&version=2.0.0
#tool nuget:?package=Lyo.Images.Ocr&version=2.0.0
Lyo.Images.Ocr
Lyo OCR contracts: IOcrEngine, request/response models, Y-up pixel boxes (same as BoundingBox2D), coordinate helpers, and shared OcrEngineOptions.
Concrete engines (e.g. Lyo.Images.Ocr.Tesseract) register IOcrEngine. This package only registers cross-provider options through AddOcrEngineOptions / AddOcrEngineOptionsFromConfiguration.
Examples
appsettings sample
{
"OcrEngine": {
"EnableMetrics": false,
"DefaultLanguages": "eng",
"DefaultPageSegmentationMode": "SparseTextOsd"
}
}
Bind options from configuration
using Lyo.Images.Ocr;
services.AddOcrEngineOptionsFromConfiguration(builder.Configuration);
// then register a concrete IOcrEngine (e.g. AddTesseractOcrEngine).
Types
| Type | Description |
|---|---|
IOcrEngine |
ReadAsync(Stream imageStream, OcrReadRequest?, CancellationToken) → Task<Result<OcrPageResult>>. OCR on an encoded raster stream (PNG/JPEG/etc.). |
OcrReadRequest |
Optional overrides for one call: Languages, PageSegmentationMode, MinimumConfidencePercent. |
OcrPageResult |
FullText, Words (pixel Y-up bounding boxes), Lines (grouped), ImageWidth, ImageHeight. |
OcrWord / OcrLine |
Word and line records in OcrPageResult. OcrWord.BoundingBoxPixels is a BoundingBox2D (Y-up). |
OcrEngineOptions |
EnableMetrics, DefaultLanguages (default "eng"), DefaultPageSegmentationMode (default SparseTextOsd); SectionName = "OcrEngine". |
OcrPageSegmentationMode |
Layout modes that do not depend on a provider (AutoOsd, Auto, SingleColumn, SingleBlock, SingleLine, SingleWord, CircleWord, SingleChar, SparseTextOsd, …). |
OcrCoordinateTransforms |
FromTopLeftDownwardRect, MapPixelBoxToPdfPoints, and other helpers that convert among raster, Y-up pixel, and PDF point coordinates. |
OcrLineGrouper |
Turns OcrWord results into OcrLine rows. |
OcrMetrics / OcrErrorCodes |
Shared metric names and error codes for engines. |
OcrServiceCollectionExtensions |
Container helpers: AddOcrEngineOptions(Action<OcrEngineOptions>?), AddOcrEngineOptionsFromConfiguration(IConfiguration, sectionName?). |
How boxes are oriented
OcrWord.BoundingBoxPixelsis Y-up: origin at the image bottom-left, soTop>BottomandHeight = Top - BottommatchesBoundingBox2D.OcrCoordinateTransforms.FromTopLeftDownwardRectconverts typical top-left raster rects (e.g. Tesseract) into this form.- For a PDF overlay on a rendered page, call
OcrCoordinateTransforms.MapPixelBoxToPdfPoints(seeLyo.Pdf.Ocr).
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Common.Metadata(direct, lyo)Lyo.Configuration(direct, lyo)Lyo.Exceptions(direct, lyo)Lyo.Metrics(direct, lyo)Lyo.Result(direct, lyo)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5(direct, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5(direct, microsoft)Lyo.Common.Core(transitive, lyo)Microsoft.Bcl.AsyncInterfaces10.0.5(transitive, microsoft, netstandard2.0)Microsoft.Extensions.Configuration.Binder10.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.Metadata (>= 2.0.0)
- Lyo.Configuration (>= 2.0.0)
- Lyo.Exceptions (>= 2.0.0)
- Lyo.Metrics (>= 2.0.0)
- Lyo.Result (>= 2.0.0)
- 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.Images.Ocr.Tesseract
Tesseract-backed implementation of Lyo.Images.Ocr (local OCR). |
|
|
Lyo.Pdf.Ocr
OCR pipeline for PDF pages: rasterize (PDFium), run IOcrEngine, map pixel boxes to PDF points. |
GitHub repositories
This package is not used by any popular GitHub repositories.