IronOCR 和 Syncfusion OCR 之間的比較
本文將比較兩個使用光學字元辨識 (OCR) 來自動偵測和擷取影像和掃描文件中印刷文字的軟體庫。 首先,我們將討論這兩個函式庫的特點。 接下來,我們將使用這兩個庫產生的範例原始程式碼來檢驗和比較它們的文字識別和提取能力。 最後,我們將比較各圖書館的許可和定價。
本文將比較的函式庫有:
- IronOCR
- Syncfusion Essential PDF
1. Syncfusion OCR
Syncfusion 的 Essential PDF 庫整合了 OCR 功能,可對 PDF 文件中的掃描影像進行影像文字處理。
Syncfusion 的 OCR 處理器可與 Tesseract 版本 3(3.02 和 3.05)和 4 搭配使用。該程式庫可以包含在 .NET Core 和 ASP.NET 應用程式中。
SyncFusion Essential PDF 的 OCR 功能包括以下特點:
-對 PDF 文件執行 OCR 任務。該庫的 OCRProcessor 類別可用於對 PDF 檔案執行 OCR 操作。 它基於 Tesseract 資料處理器,Tesseract 資料處理器被公認為世界上最好的 OCR 處理器之一。
-對PDF文件的特定部分執行OCR識別任務。使用者可以對PDF文件中的特定頁面或區域進行OCR識別。
-對影像執行OCR辨識任務。用戶可以從圖像中提取文字資料,並導入到其他應用程式中。
-多語言支援。 Google Tesseract 引擎(透過 Syncfusion 擴充)目前支援 60 多種語言,並且正在試驗支援更多語言。
-準確率高。 Syncfusion Essential PDF 利用Google的 Tesseract 開源引擎,實現了非常高的文字準確率,並且在合理的時間內完成了 OCR 識別。
2. IronOCR
IronOCR 是一個 C# 軟體庫,它允許 .NET 平台開發人員識別和讀取圖片和 PDF 文件中的文字。 這是一個僅支援 .NET 的 OCR 函式庫,它使用功能強大的 Tesseract 引擎。 Tesseract 3 到 5 版本可在 Windows、macOS、Linux、Azure、AWS、Lambda、Mono 和 Xamarin Mac 上即插即用。
IronOCR 支援比其他 OCR 引擎更多的語言,支援 125 種語言(預設只安裝英文)。
.NET 開發人員對其文件擁有完全控制權,可以根據需要進行修改。
2.1. IronOCR 功能
IronOCR 提供獨特的功能組合,可用於整合、簽名、匯出、讀取影像以及從照片中提取細節,而無需考慮使用者的技術背景或硬體的複雜程度。
2.1.1. 準確性
IronOCR SDK 的準確率高達 99.8%,優於其他 OCR 庫。
2.1.2. 修復低品質掃描件和影像
IronOCR 類別為 C# 開發人員提供了廣泛的控制功能。 它為開發者提供 OCR(圖像和 PDF 轉文字)功能,並針對每個特定實例進行精細化的效能調整。
IronOCR 包含配置選項,使庫能夠處理品質不理想的影像。 這些配置包括:清除背景雜訊、增強對比度、增強解析度、語言、策略、旋轉和矯正、色彩空間、偵測深色背景上的白色文字以及輸入影像類型。
2.1.3. 語言
IronOCR 支援 125 多種國際語言。
2.1.4. OCR文字提取
Iron Tesseract 可以讀取多種影像格式以及 PDF 檔案。 此功能在標準的免費 Tesseract 引擎中不可用。 如果您的掃描件品質較差,OCR 輸入功能可讓您自動修復所需的屬性。
2.1.5. 影像優化濾波器
OCRInput 類別為 C# 程式設計師提供了對輸入的精細控制。 開發人員隨後對輸入的圖片進行預處理,以提高速度和準確性。 這樣就無需使用 Photoshop 批次腳本或 ImageMagick 在進行 OCR 處理之前準備照片。
2.1.6. 影像的OCR區域
IronOCR 允許其最終使用者對影像的特定區域執行 OCR 操作。
2.1.7. OCRResult 類
IronOCR 使用 Tesseract 3、4 或 5 掃描每一頁後,都會傳回一個進階結果物件。此物件包含位置資料、圖像、文字、統計置信度、替代符號選擇、字體名稱、字體大小、裝飾、字體粗細以及以下各項的位置資訊:
- 頁 段落
- 文字行
- 字
- 個別角色 條碼
2.1.8. 一份文件包含多種語言
IronOCR 允許開發人員在單一文件中使用多種語言。 這項功能對 .NET 服務提供者極為有利。
3. 在 Visual Studio 中建立新項目
在本文中,我們將使用一個新的 Visual Studio 控制台應用程式來示範 IronOCR 和 Syncfusion Essential PDF 的 OCR 處理功能。
開啟 Visual Studio 軟體,前往檔案選單,然後選擇"新專案" 。 然後,選擇控制台應用程式。
在適當的文字方塊中輸入專案名稱並選擇路徑。 接下來,按一下"建立"按鈕,然後選擇所需的 .NET 框架,如下圖所示:
Visual Studio 專案現在將產生新控制台應用程式的結構。 完成後將開啟 program.cs 檔案。
現在我們將把這兩個庫加入到專案中。
4. 安裝 IronOCR 庫
IronOCR庫可以透過四種方式下載和安裝。 這些工具包括
- 使用 Visual Studio NuGet 套件管理器
- 直接從 NuGet 網頁下載。
- 直接從 IronOCR 網頁下載。
- 使用 Visual Studio 命令列。
4.1. 使用 Visual Studio NuGet 管理器
您可以使用 Visual Studio NuGet 套件管理器將 IronOCR 整合到 C# 專案中。
按一下"工具">"NuGet 套件管理員">"管理解決方案的 NuGet 套件..."即可存取 NuGet 套件管理器 GUI。
之後,將出現一個新視窗。 搜尋 IronOCR 並將其安裝到專案中。
也可以使用上述相同的方法安裝 IronOCR 的其他語言套件。
4.2. 從 NuGet 網頁直接下載
您可以按照以下說明直接從 NuGet 網站下載 IronOCR:
- Navigate to the IronPDF NuGet Gallery Page.
- 從右側選單中選擇下載軟體包選項。
- 雙擊下載的軟體包。 它會自動安裝。
4.3. 從 IronOCR 網頁直接下載
開發者可以從 IronOCR 網站下載該庫,並將其新增為專案引用。
請依照以下說明將庫新增為 Visual Studio 中的參考。
- 在解決方案視窗中右鍵點選項目。
- 然後,選擇"新增項目參考",瀏覽下載的參考檔案的位置。
- 接下來,按一下"確定"以新增引用。
4.4. 使用 Visual Studio 命令列
- 在 Visual Studio 中,前往"工具">"NuGet 套件管理器">"套件管理器控制台" 。
- 在軟體包管理器控制台標籤中輸入以下命令:
Install-Package IronOcr
該套件現在會下載/安裝到目前的專案中,並可立即使用。
5. 安裝 Syncfusion Essential PDF OCR 庫
Syncfusion Essential PDF 可以透過三種不同的方式安裝。
- 使用 Visual Studio NuGet 套件管理器
- 直接從 NuGet 網頁下載。
- 使用 Visual Studio 命令列。
5.1. 使用 Visual Studio NuGet 管理器
與 IronOCR 一樣,開發人員也可以使用 Visual Studio 的 NuGet 套件管理器安裝 SyncFusion 的 OCR 程式庫。
像以前一樣存取套件管理器,方法是點擊"工具">"NuGet 套件管理員">"管理解決方案的 NuGet 套件..."
搜尋SyncFusion OCR並安裝對應的軟體包(應該是 Syncfusion.PDF.OCR.Net.Core)。
Additional language packs for SyncFusion Essential PDF OCR can be downloaded from GitHub.
5.2. 從 NuGet 網頁直接下載
您可以依照以下說明直接從 NuGet 網站下載 Syncfusion Essential PDF OCR:
- Navigate to the package's NuGet Gallery page.
- 從右側選單中選擇下載軟體包選項。
- 雙擊下載的軟體包。 它會自動安裝。
- 接下來,重新載入解決方案,並在專案中開始使用它。
5.3. 使用 Visual Studio 命令列
- 在 Visual Studio 中,前往"工具">"NuGet 套件管理器">"套件管理器控制台" 。
- 在軟體包管理器控制台標籤中輸入以下命令:
Install-Package Syncfusion.PDF.OCR.Net.Core -Version 20.2.0.38
該套件現在會下載/安裝到目前的專案中,並可立即使用。
6. 對PDF文件執行OCR識別
IronOCR 和 Syncfusion OCR 都能夠對 PDF 文件進行 OCR 識別。 在這裡,我們將討論如何在 Visual Studio 中使用它們。
6.1. 使用 IronOCR 進行 PDF OCR 文字擷取
只需幾行程式碼,開發人員就可以對整個 PDF 檔案或 PDF 檔案的特定頁面/部分執行 OCR 操作。 請看下面的程式碼片段。
using IronOcr;
var Ocr = new IronTesseract();
using (var Input = new OcrInput())
{
// Add a PDF document and specify a password if needed
Input.AddPdf("example.pdf", "password");
// Read the textual content from the PDF
var Result = Ocr.Read(Input);
// Display the text in the console
Console.WriteLine(Result.Text);
}
using IronOcr;
var Ocr = new IronTesseract();
using (var Input = new OcrInput())
{
// Add a PDF document and specify a password if needed
Input.AddPdf("example.pdf", "password");
// Read the textual content from the PDF
var Result = Ocr.Read(Input);
// Display the text in the console
Console.WriteLine(Result.Text);
}
Imports IronOcr
Private Ocr = New IronTesseract()
Using Input = New OcrInput()
' Add a PDF document and specify a password if needed
Input.AddPdf("example.pdf", "password")
' Read the textual content from the PDF
Dim Result = Ocr.Read(Input)
' Display the text in the console
Console.WriteLine(Result.Text)
End Using
6.2. 使用 Syncfusion Essential PDF OCR 進行 PDF OCR 文字擷取
您可以使用 OCRProcessor 類別對 PDF 文件以及文件區域執行 OCR。 請查看以下程式碼範例以了解上下文。
using Syncfusion.OCRProcessor;
using Syncfusion.Pdf.Parsing;
// Initialize the OCR processor
using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{
// Load the input PDF document
PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
// Set the OCR language
processor.Settings.Language = Languages.English;
// Perform OCR on the loaded PDF
processor.PerformOCR(lDoc, @"TessData\");
// Save the processed PDF
lDoc.Save("Sample.pdf");
// Close the document
lDoc.Close(true);
}
using Syncfusion.OCRProcessor;
using Syncfusion.Pdf.Parsing;
// Initialize the OCR processor
using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{
// Load the input PDF document
PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
// Set the OCR language
processor.Settings.Language = Languages.English;
// Perform OCR on the loaded PDF
processor.PerformOCR(lDoc, @"TessData\");
// Save the processed PDF
lDoc.Save("Sample.pdf");
// Close the document
lDoc.Close(true);
}
Imports Syncfusion.OCRProcessor
Imports Syncfusion.Pdf.Parsing
' Initialize the OCR processor
Using processor As New OCRProcessor("TesseractBinaries\")
' Load the input PDF document
Dim lDoc As New PdfLoadedDocument("Input.pdf")
' Set the OCR language
processor.Settings.Language = Languages.English
' Perform OCR on the loaded PDF
processor.PerformOCR(lDoc, "TessData\")
' Save the processed PDF
lDoc.Save("Sample.pdf")
' Close the document
lDoc.Close(True)
End Using
7. 對影像進行OCR識別
這兩個函式庫都可以在 C#.NET 和 .NET Core 應用程式中對影像執行 OCR 操作。
7.1. 使用 IronOCR 對影像進行 OCR 識別
IronOCR 的獨特之處在於,它只需兩行程式碼即可自動偵測和讀取掃描不完美的影像中的文字。
using IronOcr;
// Perform OCR and read text from the specified image
var Result = new IronTesseract().Read(@"images\11111.png").Text;
using IronOcr;
// Perform OCR and read text from the specified image
var Result = new IronTesseract().Read(@"images\11111.png").Text;
Imports IronOcr
' Perform OCR and read text from the specified image
Private Result = (New IronTesseract()).Read("images\11111.png").Text
OCR輸入影像
OCR OUTPUT from IMAGE
OCR Output
Simple Data Outputs:
» NET Text Strings
» Barcode & QR Data & Images
Structured Data Outputs:
» Pages
» Blocks
» Paragraphs
» Lines
» Words
» Characters
Export Documents:
» Searchable PDFs
» hOCR / HTML Export
» Images of any Page, Text Element or Barcode
7.2. 使用 Syncfusion Essential PDF OCR 處理器對影像執行 OCR
Syncfusion Essential PDF 能夠非常準確地從影像中提取文字。
using System.Drawing;
using Syncfusion.OCRProcessor;
// Initialize the OCR processor
using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{
// Load the input image
Bitmap image = new Bitmap("11111.jpeg");
// Set the OCR language
processor.Settings.Language = Languages.English;
// Perform OCR on the loaded image
string ocrText = processor.PerformOCR(image, @"TessData\");
}
using System.Drawing;
using Syncfusion.OCRProcessor;
// Initialize the OCR processor
using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{
// Load the input image
Bitmap image = new Bitmap("11111.jpeg");
// Set the OCR language
processor.Settings.Language = Languages.English;
// Perform OCR on the loaded image
string ocrText = processor.PerformOCR(image, @"TessData\");
}
Imports System.Drawing
Imports Syncfusion.OCRProcessor
' Initialize the OCR processor
Using processor As New OCRProcessor("TesseractBinaries\")
' Load the input image
Dim image As New Bitmap("11111.jpeg")
' Set the OCR language
processor.Settings.Language = Languages.English
' Perform OCR on the loaded image
Dim ocrText As String = processor.PerformOCR(image, "TessData\")
End Using
OCR輸入影像
OCR OUTPUT from IMAGE
OCR Output
Simple Data Output:
+ NET Text Strings
Dee eT Nd
tC eke ass
Biren)
Soy
Seg
ors
eae
eed
TLC
eres
Smt d
See amr'
etd ieot
8.授權
使用 IronOCR 和 Syncfusion Essential PDF 都需要軟體許可。
8.1 IronOCR 許可
IronOCR 為個人非商業專案提供免費開發許可。
IronOCR 為商業許可提供獨特的定價結構。 Lite 套餐起價為 $799,無額外費用。 所有許可證均包含 30 天退款保證、一年的軟體支援和升級、開發、測試、部署、生產有效性以及永久許可證(一次性購買)。 從此頁面了解更多關於 IronOCR 的完整定價結構和許可資訊。
只需一次性支付 $1,599 費用,即可獲得 SaaS 和 OEM 商品的免版稅再分發。
8.2. Syncfusion Essential PDF 許可
Syncfusion Essential PDF 提供三種類型的開發者許可證,但不提供 SaaS 和 OEM 服務。
-社群版授權。社群版授權對開發者和最多 5 名開發者的小型公司免費開放。 它還包括線上支援。 -零售許可證。零售許可證為年度許可證,組織內的每位開發人員必須單獨購買。 零售授權起價為每位開發者每年 $995 美元。 -無限制許可。此選項以更低的價格為整個組織提供相同的年度許可。
View the entire licensing structure for Syncfusion Essential PDF (and for other Syncfusion components) on the product licensing page.
9.結論
IronOCR 總共支援約 125 種全球語言。 其處理能力包括:對 PDF 文件或圖像的部分內容執行 OCR,從 PDF 和照片中提取文字,以及校正品質差的圖像等等。 IronOCR優先考慮速度和準確性。 其準確率高達 99.8%,高於市場上任何其他基於 Tesseract 的 OCR 庫。 IronOCR 開箱即用,無需效能調優或影像預處理。
Syncfusion Essential PDF OCR 也使用了 Google 開源的 Tesseract 引擎。它可以對整個文件或文件的特定部分進行 OCR 識別。 Syncfusion 的 OCR 庫支援 60 多種國際語言。
IronOCR 許可證終身有效,提供無限次支援以及 SaaS 和 OEM 服務。 另一方面,Syncfusion Essential PDF OCR 提供按年付費的許可。 IronOCR 的定價從 $799 起,Syncfusion 的定價從每年 $995 起。
購買完整的Iron Suite ,即可享有 IronOCR 以及其他四款 Iron Software 產品折扣價。 Iron Suite套裝中包含的產品有:
- IronPDF
- IronOCR
- IronXL
- IronBarcode
- IronWebscraper
Iron Software 的授權頁麵包含有關上述五款產品的定價和授權的更詳細資訊。
常見問題解答
如何使用C#對圖像進行OCR?
您可以使用IronOCR在C#中對圖像進行OCR。它提供了從各種圖像格式中提取文字的方法,具有高準確性,並支持超過125種語言。
使用 IronOCR 進行 OCR 任務的優勢是什麼?
IronOCR提供出色的99.8%準確率,支持對特定文件區域進行OCR,具有低質量掃描的圖像優化功能,並支持多種語言。
IronOCR與Syncfusion的OCR能力相比如何?
雖然兩者都使用Tesseract引擎,IronOCR支持更多版本(3-5)和語言(125+),提供更高的準確性,相比Syncfusion的OCR,還提供增強的圖像校正功能。
IronOCR 提供哪些授權選項?
IronOCR提供免費的個人使用開發許可,商業許可起價為一次性$1599,包括永久許可和SaaS/OEM涵蓋。
我可以使用IronOCR從掃描的PDF文件中提取文字嗎?
是的,IronOCR可以使用其基於Tesseract的OCR功能從掃描的PDF文件中提取文字,確保高準確性和語言支持。
IronOCR 支持哪些平台?
IronOCR用途廣泛,支持包括Windows、macOS、Linux、Azure、AWS、Lambda、Mono和Xamarin Mac在內的多個平台。
IronOCR如何處理低質量的圖像掃描?
IronOCR包含增強圖像質量的功能,例如背景噪音清理、對比度增強和分辨率調整,這些功能提高了低質量圖像的OCR結果。
是否可以使用IronOCR對文檔的特定區域進行OCR?
是的,IronOCR允許用戶指定文檔的特定區域或頁面進行OCR,提供靈活性和對文字提取過程的控制。
如何將IronOCR集成到.NET項目中?
IronOCR可以通過Visual Studio的NuGet Packager Manager、從NuGet網站或從IronOCR網站下載集成到.NET項目中。


