Hebrew 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.Hebrew的內容

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

  • 希伯來文
  • HebrewBest
  • HebrewFast
  • HebrewAlphabet
  • HebrewAlphabetBest
  • HebrewAlphabetFast

下載

希伯來語語言包 style='white-space:default'>[ עברית ]

安裝

我們要做的第一件事是將我們的 希伯來語 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:存儲提取的文本,可用於進一步處理。