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

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

  • 拉丁文
  • 拉丁文Best
  • 拉丁文Fast

下載

拉丁語語言套件 [latine]

安裝

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

Install-Package IronOcr.Languages.Latin

程式碼範例

此 C# 程式碼範例用於從圖片或 PDF 文件中讀取拉丁文內容。

// Install the IronOcr.Languages.Latin package via NuGet
using IronOcr;

var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Latin;

// Create an OCR input object by specifying the image or PDF file path
using (var Input = new OcrInput(@"images\Latin.png"))
{
    // Perform OCR on the input
    var Result = Ocr.Read(Input);
    // Retrieve the recognized text
    var AllText = Result.Text;
    // Log or process the recognized text
}
// Install the IronOcr.Languages.Latin package via NuGet
using IronOcr;

var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Latin;

// Create an OCR input object by specifying the image or PDF file path
using (var Input = new OcrInput(@"images\Latin.png"))
{
    // Perform OCR on the input
    var Result = Ocr.Read(Input);
    // Retrieve the recognized text
    var AllText = Result.Text;
    // Log or process the recognized text
}
' Install the IronOcr.Languages.Latin package via NuGet
Imports IronOcr

Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Latin

' Create an OCR input object by specifying the image or PDF file path
Using Input = New OcrInput("images\Latin.png")
	' Perform OCR on the input
	Dim Result = Ocr.Read(Input)
	' Retrieve the recognized text
	Dim AllText = Result.Text
	' Log or process the recognized text
End Using
$vbLabelText   $csharpLabel
  • 此範例展示如何初始化 IronTesseract 物件,並將 OCR 語言設定為拉丁語。
  • OcrInput 封裝了輸入檔案,在此案例中為一張包含拉丁文字的圖片。
  • Ocr.Read 方法會處理輸入內容,並返回一個 OcrResult 物件,您可以從中提取已識別的文字。