改善不理想OCR結果
OCR品質很大程度上取決於輸入。 一個配置、濾鏡或設置能夠清晰讀取一個文件,在另一個文件上可能表現平平,留下混亂或不完整的文字。 當標準讀取令人失望時,IronOcr.Extensions.AdvancedScan 套件通常可以填補準確性差距。
差異在於引擎。標準 IronOCR 在 Tesseract 引擎上運行,而 IronOcr.Extensions.AdvancedScan 則由 PaddleOCR 提供支持,增加了機器學習功能。 這使得它非常適合嘈雜的輸入,如截圖,以及結構化的來源,如護照和車牌。
該軟體包針對這些情況提供了專門設計的讀取方法:
解決方案
1. 從 ReadDocumentAdvanced() 和 EnhanceResolution() 開始
在使用其他配置之前,將 ReadDocumentAdvanced() 方法與 EnhanceResolution() 預處理過濾器配對。 這種組合解決了使用者在標準讀取中遇到的多數準確性問題。
將過濾器應用於 OcrInput,然後將相同的輸入傳遞給 ReadDocumentAdvanced():
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadPdf("document.pdf");
// Upscale and sharpen low-resolution input before reading
input.EnhanceResolution();
var result = ocr.ReadDocumentAdvanced(input);
Console.WriteLine(result.Text);
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadPdf("document.pdf");
// Upscale and sharpen low-resolution input before reading
input.EnhanceResolution();
var result = ocr.ReadDocumentAdvanced(input);
Console.WriteLine(result.Text);
Imports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
input.LoadPdf("document.pdf")
' Upscale and sharpen low-resolution input before reading
input.EnhanceResolution()
Dim result = ocr.ReadDocumentAdvanced(input)
Console.WriteLine(result.Text)
End Using
ReadDocumentAdvanced() 運行 PaddleOCR 機器學習引擎以解析具有布局感知的文字密集型文件,而 EnhanceResolution() 在讀取前放大和銳化低解析度輸入。 低解析度是差結果的常見根源,因此這個預處理步驟往往與引擎交換一樣重要。
2. 在.NET Framework上針對x64
配置.NET Framework項目構建為x64。 AdvancedScan需要大量記憶體,在不同架構下運行可能會觸發運行時錯誤。 完整設置參見在.NET Framework上進行高級掃描指南。
限制條件
AdvancedScan提供強大的精確性,但如今有一些限制適用:
- 較少的結果特徵: AdvancedScan 結果物件暴露的屬性比標準
OcrResult物件少。 - 不同的返回型別:每一個讀取方法返回不同的結果物件型別,因此查看API參考以了解您調用的具體資訊。
- 不可檢索的PDF:將AdvancedScan的輸出構建成可搜索的PDF尚不支持,雖然該功能正在開發中。
- 有限的支援語言:目前該軟體包支持英語、中文、日語、韓語和拉丁字母。

