IRONSOFTWAREHOME
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);
Imports IronOcr
Imports System

Dim ocrTesseract = New IronTesseract()
Using 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:
    Dim codeToRun As String = OcrInputFilterWizard.Run("images\image.png", confidence:=Nothing, ocrTesseract)
    Console.WriteLine(codeToRun)

    ' Optional: Export modified images so you can view them.
    For Each page In ocrInput.GetPages()
        page.SaveAsImage($"filtered_{page.Index}.bmp")
    Next

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

OCR 影像優化濾鏡

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

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

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

準備開始了嗎?

Nuget Downloads 6,236,385版本:2026.9剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
獲取您的無義務諮詢
填寫以下表格或發送電子郵件至sales@ironsoftware.com
您的詳細資訊將始終保密。
被全球數百萬工程師信任
Iron Software的客戶標誌
立即獲取您的30天試用金鑰
無需信用卡或帳戶建立