Hungarian OCR in C# and .NET
本文件的其他版本:
IronOCR 是一個 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言(包括匈牙利語)的圖片和 PDF 文件中讀取文字。
這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均經常優於其他 Tesseract 引擎。
IronOcr.Languages.Hungarian 內容
此套件包含 52 種適用於 .NET 的 OCR 語言:
- 匈牙利語
- 匈牙利語最佳
- 匈牙利語Fast
下載
匈牙利語語言套件 [magyar]
安裝
我們首先必須將匈牙利語 OCR 套件安裝至您的 .NET 專案中。
Install-Package IronOcr.Languages.Hungarian
程式碼範例
此 C# 程式碼範例用於從圖片或 PDF 文件中讀取匈牙利語文字。
// First, ensure you have installed the Hungarian OCR language pack
// via NuGet: Install-Package IronOcr.Languages.Hungarian
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to Hungarian.
Ocr.Language = OcrLanguage.Hungarian;
// Load the image file containing Hungarian text
using (var Input = new OcrInput(@"images\Hungarian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Retrieve and store the recognized text
var AllText = Result.Text;
// Output the recognized text to the console (for debugging purposes)
Console.WriteLine(AllText);
}
// First, ensure you have installed the Hungarian OCR language pack
// via NuGet: Install-Package IronOcr.Languages.Hungarian
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to Hungarian.
Ocr.Language = OcrLanguage.Hungarian;
// Load the image file containing Hungarian text
using (var Input = new OcrInput(@"images\Hungarian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Retrieve and store the recognized text
var AllText = Result.Text;
// Output the recognized text to the console (for debugging purposes)
Console.WriteLine(AllText);
}
' First, ensure you have installed the Hungarian OCR language pack
' via NuGet: Install-Package IronOcr.Languages.Hungarian
Imports IronOcr
Private Ocr = New IronTesseract()
' Set the OCR language to Hungarian.
Ocr.Language = OcrLanguage.Hungarian
' Load the image file containing Hungarian text
Using Input = New OcrInput("images\Hungarian.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Retrieve and store the recognized text
Dim AllText = Result.Text
' Output the recognized text to the console (for debugging purposes)
Console.WriteLine(AllText)
End Using
此程式碼片段示範如何使用 IronOCR程式庫設定 OCR 讀取器,以識別指定影像檔案中的匈牙利文。擷取的文字儲存於 AllText 變數中,並可於應用程式中依需求使用。 範例中還包含一個可選的控制台輸出,用於在測試期間驗證 OCR 結果。

