German OCR in C# and .NET
本文件的其他版本:
IronOCR 是一個 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言(包括德語)的圖片和 PDF 文件中讀取文字。
這是 Tesseract 的進階分支版本,專為 .NET 開發者打造,無論在速度或準確度方面,其表現均經常優於其他 Tesseract 引擎。
IronOcr.Languages.German 內容
此套件包含 61 種適用於 .NET 的 OCR 語言:
- 德文
- 德文Best
- 德文Fast
- 德文黑體字
下載
德語語言包 [Deutsch]
安裝
我們首先必須將德語 OCR 套件安裝至您的 .NET 專案中。
Install-Package IronOcr.Languages.German
程式碼範例
此 C# 程式碼範例用於從圖片或 PDF 文件中讀取德文文字。
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to German. This must match the language of the document you are scanning.
Ocr.Language = OcrLanguage.German;
using (var Input = new OcrInput(@"images\German.png"))
{
// Perform OCR on the provided image and get the result.
var Result = Ocr.Read(Input);
// Extract all recognized text from the OCR result.
var AllText = Result.Text;
// Optionally, output the recognized text to the console for verification.
Console.WriteLine(AllText);
}
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to German. This must match the language of the document you are scanning.
Ocr.Language = OcrLanguage.German;
using (var Input = new OcrInput(@"images\German.png"))
{
// Perform OCR on the provided image and get the result.
var Result = Ocr.Read(Input);
// Extract all recognized text from the OCR result.
var AllText = Result.Text;
// Optionally, output the recognized text to the console for verification.
Console.WriteLine(AllText);
}
Imports IronOcr
Private Ocr = New IronTesseract()
' Set the OCR language to German. This must match the language of the document you are scanning.
Ocr.Language = OcrLanguage.German
Using Input = New OcrInput("images\German.png")
' Perform OCR on the provided image and get the result.
Dim Result = Ocr.Read(Input)
' Extract all recognized text from the OCR result.
Dim AllText = Result.Text
' Optionally, output the recognized text to the console for verification.
Console.WriteLine(AllText)
End Using
在此範例中,IronTesseract 已設定為使用德語進行 OCR,此設定對於處理包含德語文字的圖片或 PDF 檔案至關重要。 OcrInput 類別用於指定圖像檔案,而 Read 方法則執行 OCR 操作,並回傳擷取的文字。

