ZeroOcr.Core
1.0.0
dotnet add package ZeroOcr.Core --version 1.0.0
NuGet\Install-Package ZeroOcr.Core -Version 1.0.0
<PackageReference Include="ZeroOcr.Core" Version="1.0.0" />
<PackageVersion Include="ZeroOcr.Core" Version="1.0.0" />
<PackageReference Include="ZeroOcr.Core" />
paket add ZeroOcr.Core --version 1.0.0
#r "nuget: ZeroOcr.Core, 1.0.0"
#:package ZeroOcr.Core@1.0.0
#addin nuget:?package=ZeroOcr.Core&version=1.0.0
#tool nuget:?package=ZeroOcr.Core&version=1.0.0
ZeroOcr
High-performance, zero-allocation sovereign Optical Character Recognition (OCR) abstractions, spatial geometry models, memory-safe image pre-processing, and multi-engine providers (Native Windows WinRT & Edge AI) for .NET.
Part of the ZeroPlatform industrial ecosystem (Tier 3: Perception & Intelligence).
Architecture
ZeroOcr is architected with a strict separation between core domain contracts and runtime engine providers:
graph TD
classDef t5 fill:#831843,stroke:#f43f5e,stroke-width:2px,color:#fff;
classDef t3 fill:#701a75,stroke:#f472b6,stroke-width:2px,color:#fff;
classDef t1 fill:#1e293b,stroke:#818cf8,stroke-width:2px,color:#fff;
subgraph Consumers ["Consumers (Tier 5)"]
Pipe["ZeroPipeline (OcrInspectionNode)"]:::t5
Docs["ZeroDocuments (ScannedDocReader)"]:::t5
UI["ZeroUI (OcrRoiBoxControl)"]:::t5
end
subgraph ZeroOcr ["ZeroOcr (Tier 3 Perception)"]
Core["ZeroOcr.Core\n(IOcrEngine, OcrResult, OcrBlock, OcrImageBuffer)"]:::t3
Win["ZeroOcr.Windows\n(Windows.Media.Ocr / WinRT)"]:::t3
Onnx["ZeroOcr.Inference\n(Future: PaddleOCR/DBNet ONNX)"]:::t3
end
subgraph Foundations ["Foundations (Tier 1 & 0)"]
Gfx["ZeroGraphics / ZeroTensor"]:::t1
end
Consumers --> Core
Win --> Core
Onnx --> Core
Core --> Gfx
Sub-projects
| Project | Target Frameworks | Responsibilities |
|---|---|---|
ZeroOcr.Core |
netstandard2.0, net462, net8.0 |
Pure C# zero-dependency OCR domain models (OcrResult, OcrBlock, OcrLine, OcrWord, OcrRect, OcrQuad), IOcrEngine contract, OcrImageBuffer, memory-safe image pre-processors (Otsu thresholding, grayscale conversion, inversion, ROI cropping), and MockOcrEngine. |
ZeroOcr.Windows |
net8.0-windows10.0.19041.0 |
High-speed native Windows 10/11 WinRT OCR implementation via Windows.Media.Ocr. Features engine caching per BCP-47 language tag, zero-copy buffer transfer via SoftwareBitmap, skew angle detection, and structured token bounding box mapping. |
ZeroOcr.Tests |
net8.0-windows10.0.19041.0 |
Full unit and integration test suite with synthetic images, spatial geometry validations, and engine lifecycles. |
Key Features
Hierarchical Document Graph:
OcrResult→OcrBlock→OcrLine→OcrWord.- Exact bounding boxes (
OcrRect) and rotated 4-vertex bounding polygons (OcrQuad). - Word-level and line-level confidence scoring with mean confidence aggregation.
- Skew/orientation angle detection in degrees.
Zero-Allocation Image Buffering & Pooling:
OcrImageBufferwraps contiguous managed/unmanaged byte buffers without LOH heap fragmentation.- Native
OcrImageBuffer.Rent(width, height, format)backed byArrayPool<byte>.Sharedfor zero GC pressure during 4K/high-res scanning. - Supported pixel formats:
Bgra32,Rgba32,Rgb24,Bgr24,Gray8. - Zero-copy cropping for Region Of Interest (ROI) scanning.
SIMD AVX2 Acceleration & Pre-processing:
- Hardware-accelerated vectorized pre-processing kernels (
Vector256<byte>/ AVX2):OcrPreprocessor.ToGrayscale: ITU-R BT.601 fixed-point SIMD conversion (>> 8).OcrPreprocessor.Binarize: Branchless AVX2 SIMD thresholding.OcrPreprocessor.BinarizeOtsu: Dynamic bimodal histogram thresholding.OcrPreprocessor.Invert: Vectorized negative polarity conversion for inverted text.
- Hardware-accelerated vectorized pre-processing kernels (
Packaging & Manufacturing Vision Extensions:
OcrMorphology: 3x3 structuring element morphological operations (Dilation, Erosion, Closing) designed to fuse dot-matrix inkjet dots into solid characters for high-accuracy OCR.ProjectionProfileDeskewer: Horizontal Projection Profile (HPP) variance maximization algorithm with bilinear deskewing ($\pm 15^\circ$) for angled packaging.MultiRoiOcrInspectionPipeline: Concurrent multi-zone inspection with engine pooling and master coordinate remapping.
Spatial Analysis & Inspection Judgement:
OcrKeyValueExtractor: 2D spatial key-value pair discovery (Right/Below alignment).OcrPatternMatcher: Regex extraction for Dates, Tax IDs, LOT/Batch codes, and Amounts.OcrInspectionJudge: Industrial Pass/Fail verdict evaluator (Substring, Regex, Expiry Date).
Native Windows Engine (
WindowsOcrEngine):- Built-in Windows 10/11 WinRT OCR (
Windows.Media.Ocr) without external model weights or C++ dependencies. - Reusable concurrent engine cache (
ConcurrentDictionary<string, OcrEngine>) to eliminate runtime engine creation overhead. OcrVisualOverlay: High-performance GDI+ overlay renderer for bounding boxes, confidence tags, and PASS/FAIL badges.
- Built-in Windows 10/11 WinRT OCR (
Quick Example
1. Recognizing Text from Image Buffer
using ZeroOcr.Core.Imaging;
using ZeroOcr.Core.Interfaces;
using ZeroOcr.Windows;
IOcrEngine ocr = new WindowsOcrEngine();
if (ocr.IsAvailable)
{
// Raw BGRA32 pixel buffer (e.g. from camera frame or screen capture)
var imageBuffer = OcrImageBuffer.FromBgra32(width, height, rawPixelBytes);
var options = new OcrOptions
{
LanguageTag = "en-US",
MinConfidence = 0.8f
};
var result = await ocr.RecognizeAsync(imageBuffer, options);
if (result.Success)
{
Console.WriteLine($"Recognized {result.Lines.Count} lines in {result.Elapsed.TotalMilliseconds:F1}ms:");
foreach (var line in result.Lines)
{
Console.WriteLine($"[{line.BoundingBox}] {line.Text} (Conf: {line.Confidence:P0})");
}
}
}
2. Cropping Region of Interest (ROI)
// Inspect only a specific sub-region (e.g., product barcode / date code zone)
var roi = new OcrRect(x: 100, y: 50, width: 300, height: 80);
var options = new OcrOptions { RegionOfInterest = roi };
var result = await ocr.RecognizeAsync(imageBuffer, options);
Target Frameworks
.NET Standard 2.0(Core Abstractions).NET Framework 4.6.2(Core Abstractions).NET 8.0(Core Abstractions).NET 8.0-windows10.0.19041.0(Native Windows Engine & Tests)
License
MIT License. Copyright © 2026 Phong Võ. Part of the ZeroPlatform Industrial Ecosystem.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
-
net8.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on ZeroOcr.Core:
| Package | Downloads |
|---|---|
|
ZeroPipeline.Nodes
Industrial Concrete Pipeline Nodes: Machine Vision, Metrology, Barcode/QR Decoders, AI Inference, Modbus PLC, and Gorilla TimeSeries Logging for ZeroPlatform. |
|
|
ZeroUI.WinForms.Media
ZeroUI WinForms Media - High-performance GPU accelerated image viewer, photo studio canvas, and media inspection controls. |
|
|
ZeroUI.Wpf.Media
ZeroUI WPF Media - High-performance GPU accelerated image viewer, photo studio controls, comparators, and media primitives. |
|
|
ZeroOcr.Windows
Windows 10/11 native OCR engine implementation using Windows.Media.Ocr for ZeroPlatform. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 29 | 9/30/2026 |