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 用の画像を準備するという一般的な方法が無効になります。

以下に、IronOCR と C# で OcrInput クラスを使用する方法を示す例を示します。

ガイドを使ってOCRの画像品質を向上させる
GitHubで見る

準備はできましたか?

Nuget Downloads 6,357,159バージョン:2026.11リリースされたばかり