C# 和 .NET 中的匈牙利語 OCR
This article was translated from English: Does it need improvement?
TranslatedView the article in English
Other versions of this document:
IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言(包括匈牙利語)的文字。
它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.Hungarian 的內容
此軟體包包含 52 種適用於 .NET 的 OCR 語言:
- 匈牙利語
- 匈牙利最佳
- 匈牙利快餐
下載
匈牙利語語言包[匈牙利語]
安裝
我們首先需要做的是將我們的匈牙利語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$vbLabelText $csharpLabel
這段程式碼示範如何使用 IronOCR 庫設定 OCR 閱讀器,以識別指定圖像檔案中的匈牙利文字。提取的文字儲存在AllText變數中,可根據需要在應用程式中使用。 此範例還包括一個可選的控制台輸出,用於在測試期間驗證 OCR 結果。





