在 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.Greek 的內容
此軟體包包含 102 種適用於 .NET 的 OCR 語言:
- 希臘文
- GreekBest
- GreekFast 希臘字母
- GreekAlphabetBest
- GreekAlphabetFast
下載
希臘字母語言包[希臘語]
安裝
第一步是將希臘字母OCR 套件安裝到您的 .NET 專案中。
Install-Package IronOCR.Languages.Greek
程式碼範例
這段 C# 程式碼範例從圖像或 PDF 文件中讀取希臘字母文字。
// Import the IronOcr namespace
using IronOcr;
class GreekOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Greek
Ocr.Language = OcrLanguage.Greek;
// Load the image or PDF containing Greek text
using (var Input = new OcrInput(@"images\Greek.png"))
{
// Perform OCR and get the result
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}// Import the IronOcr namespace
using IronOcr;
class GreekOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Greek
Ocr.Language = OcrLanguage.Greek;
// Load the image or PDF containing Greek text
using (var Input = new OcrInput(@"images\Greek.png"))
{
// Perform OCR and get the result
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}' Import the IronOcr namespace
Imports IronOcr
Friend Class GreekOcrExample
Shared Sub Main()
' Initialize the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR language to Greek
Ocr.Language = OcrLanguage.Greek
' Load the image or PDF containing Greek text
Using Input = New OcrInput("images\Greek.png")
' Perform OCR and get the result
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Output the recognized text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class$vbLabelText $csharpLabel
- IronTesseract :此類負責執行 OCR 操作。
- OcrInput :此類用於載入影像或 PDF 檔案以進行 OCR 處理。
- Ocr.Read() : 對輸入資料執行 OCR 並提供識別文字的方法。
在執行此程式碼之前,請確保 IronOcr 程式庫和希臘語語言套件已正確安裝在您的 .NET 專案中。 這段程式碼將輸出從images/Greek.png圖像中提取的文字。





