Portuguese 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.Portuguese 內容

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

  • 葡萄牙語
  • 葡萄牙語最佳
  • 葡萄牙語Fast

下載

葡萄牙語語言套件 [português]

安裝

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

Install-Package IronOcr.Languages.Portuguese

程式碼範例

此 C# 程式碼範例會從圖片或 PDF 文件中讀取葡萄牙文內容。

// Required using directive for IronOcr
using IronOcr;

var Ocr = new IronTesseract();

// Specify the language for OCR as Portuguese
Ocr.Language = OcrLanguage.Portuguese;

// Load the image or PDF from which to read the text
using (var Input = new OcrInput(@"images\Portuguese.png"))
{
    // Perform OCR on the input
    var Result = Ocr.Read(Input);

    // Retrieve the recognized text
    var AllText = Result.Text;

    // Output the extracted text
    Console.WriteLine(AllText);
}
// Required using directive for IronOcr
using IronOcr;

var Ocr = new IronTesseract();

// Specify the language for OCR as Portuguese
Ocr.Language = OcrLanguage.Portuguese;

// Load the image or PDF from which to read the text
using (var Input = new OcrInput(@"images\Portuguese.png"))
{
    // Perform OCR on the input
    var Result = Ocr.Read(Input);

    // Retrieve the recognized text
    var AllText = Result.Text;

    // Output the extracted text
    Console.WriteLine(AllText);
}
' Required using directive for IronOcr
Imports IronOcr

Private Ocr = New IronTesseract()

' Specify the language for OCR as Portuguese
Ocr.Language = OcrLanguage.Portuguese

' Load the image or PDF from which to read the text
Using Input = New OcrInput("images\Portuguese.png")
	' Perform OCR on the input
	Dim Result = Ocr.Read(Input)

	' Retrieve the recognized text
	Dim AllText = Result.Text

	' Output the extracted text
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

此程式碼示範如何設定並使用 IronOCR程式庫,從圖片中讀取葡萄牙文。 請確保圖片或 PDF 文件的路徑正確無誤。 識別出的文字將儲存於 AllText 變數中,並 PRINT 至控制台。