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 下載
PM > Install-Package IronOcr
OCR 影像優化濾鏡

OCR 影像優化濾鏡

OcrInput 類別提供C#和.NET開發者在進行OCR處理前,對影像輸入進行預處理的細緻控制,以提高手速和準確性。 這否定了使用 Photoshop 批次腳本或 ImageMagick 來準備 OCR 的影像的常見做法。

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

使用我們的指南提升 OCR 影像質量
在 GitHub 查看

準備好開始了嗎?

NuGet 下載次數 6,411,693版本:2026.11剛剛發布