OCR 影像優化濾鏡
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();
using var ocrInput = new OcrInput();
// First load all image(s)
ocrInput.LoadImage(@"images\image.png");

// Note: You don't need all of them; most users only need Deskew() and occasionally DeNoise()
ocrInput.WithTitle("My Document");
ocrInput.Binarize();
ocrInput.Contrast();
ocrInput.Deskew();
ocrInput.DeNoise();
ocrInput.Despeckle();
ocrInput.Dilate();
ocrInput.EnhanceResolution(300);
ocrInput.Invert();
ocrInput.Rotate(90);
ocrInput.Scale(150);
ocrInput.Sharpen();
ocrInput.ToGrayScale();
ocrInput.Erode();

// WIZARD - If you are unsure use the debug-wizard to test all combinations:
string codeToRun = OcrInputFilterWizard.Run(@"images\image.png", out double confidence, ocrTesseract);
Console.WriteLine(codeToRun);

// Optional: Export modified images so you can view them.
foreach (var page in ocrInput.GetPages())
{
    page.SaveAsImage($"filtered_{page.Index}.bmp");
}

var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
NuGet Download
PM > Install-Package IronOcr
OCR 影像優化濾鏡

OCR 影像優化濾鏡

OcrInput 類別為 C# 和 .NET 開發者提供了細緻的控制,可以在 OCR 處理之前,預處理影像輸入以提高速度和準確性。 這消除了使用 Photoshop 批次腳本或 ImageMagick 準備 OCR 圖像的常見做法。

以下是一個範例,演示如何在 C# 中使用 IronOCR 使用 OcrInput 類別:

使用我們的指南提升圖像品質以進行 OCR
在GitHub上查看

準備開始了嗎?

Nuget Downloads 6,357,159版本:2026.11剛剛發布