Hebrew OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
本文件的其他版本:

IronOCR 是一個 C# 軟體元件,讓 .NET 開發人員能夠從 126 種語言(包括希伯來語)的圖片和 PDF 文件中讀取文字。

這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均定期超越其他 Tesseract 引擎。

IronOcr.Languages.Hebrew 的內容

此套件包含 108 種適用於 .NET 的 OCR 語言:

  • 希伯來語
  • 希伯來語Best
  • 希伯來語Fast
  • 希伯來字母
  • 希伯來字母Best
  • 希伯來字母Fast

下載

希伯來語語言套件 [עברית]

安裝

我們首先必須將希伯來語 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Hebrew

程式碼範例

此 C# 程式碼範例用於從圖片或 PDF 文件中讀取希伯來文。

// Include the IronOcr namespace to work with OCR features
using IronOcr;

// Create an OCR engine
var Ocr = new IronTesseract();

// Set the OCR engine language to Hebrew
Ocr.Language = OcrLanguage.Hebrew;

// Process the image and extract text using OCR
using (var Input = new OcrInput(@"images\Hebrew.png"))
{
    // Read the text from the input image
    var Result = Ocr.Read(Input);

    // Store the extracted text
    var AllText = Result.Text;

    // Output the extracted text to the console (optional)
    Console.WriteLine(AllText);
}
// Include the IronOcr namespace to work with OCR features
using IronOcr;

// Create an OCR engine
var Ocr = new IronTesseract();

// Set the OCR engine language to Hebrew
Ocr.Language = OcrLanguage.Hebrew;

// Process the image and extract text using OCR
using (var Input = new OcrInput(@"images\Hebrew.png"))
{
    // Read the text from the input image
    var Result = Ocr.Read(Input);

    // Store the extracted text
    var AllText = Result.Text;

    // Output the extracted text to the console (optional)
    Console.WriteLine(AllText);
}
' Include the IronOcr namespace to work with OCR features
Imports IronOcr

' Create an OCR engine
Private Ocr = New IronTesseract()

' Set the OCR engine language to Hebrew
Ocr.Language = OcrLanguage.Hebrew

' Process the image and extract text using OCR
Using Input = New OcrInput("images\Hebrew.png")
	' Read the text from the input image
	Dim Result = Ocr.Read(Input)

	' Store the extracted text
	Dim AllText = Result.Text

	' Output the extracted text to the console (optional)
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel
  • IronTesseract:此類別用於初始化 OCR 引擎。
  • OcrInput:此代表 OCR 引擎將讀取的輸入影像或文件。
  • OCR.Read:此方法會處理輸入內容,並返回包含已擷取文字的結果。
  • Result.Text:儲存已擷取的文字,可供後續處理使用。