Hungarian OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR 是一個 C# 軟體組件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取文字,包括 126 種語言,其中包括匈牙利語。

它是一個專為 .NET 開發者設計的 Tesseract 高級分支,在速度和準確性方面經常優於其他 Tesseract 引擎。

IronOcr.Languages.Hungarian 的內容

此套件包含 52 種 .NET 的 OCR 語言:

  • 匈牙利
  • 匈牙利最佳
  • 匈牙利快速

下載

匈牙利語言包 style='white-space:default'>[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
$vbLabelText   $csharpLabel

該代碼片段演示了如何使用 IronOCR 庫設置 OCR 讀取器,以識別來自指定圖像文件的匈牙利文本。提取的文本儲存在 AllText 變數中,並可以根據需要在應用程序內使用。 該示例還包括可選的控制台輸出,以驗證測試期間的 OCR 結果。