Maltese OCR in C# and .NET
本文件的其他版本:
IronOCR 是一個 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言(包括馬耳他語)的圖片和 PDF 文件中讀取文字。
這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均定期超越其他 Tesseract 引擎。
IronOcr.Languages.Maltese 的內容
此套件包含 46 種適用於 .NET 的 OCR 語言:
- 馬耳他語
- 馬耳他語Best
- 馬耳他語Fast
下載
馬爾他語語言套件 [Malti]
安裝
我們首先必須將馬耳他語 OCR 套件安裝至您的 .NET 專案中。
Install-Package IronOcr.Languages.Maltese
程式碼範例
此 C# 程式碼範例用於從圖片或 PDF 文件中讀取馬耳他語文字。
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Maltese
Ocr.Language = OcrLanguage.Maltese;
// Define the input image or PDF document
using (var Input = new OcrInput(@"images\Maltese.png"))
{
// Perform OCR on the input and retrieve the result
var Result = Ocr.Read(Input);
// Get all the recognized text
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Maltese
Ocr.Language = OcrLanguage.Maltese;
// Define the input image or PDF document
using (var Input = new OcrInput(@"images\Maltese.png"))
{
// Perform OCR on the input and retrieve the result
var Result = Ocr.Read(Input);
// Get all the recognized text
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Initialize the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR language to Maltese
Ocr.Language = OcrLanguage.Maltese
' Define the input image or PDF document
Using Input = New OcrInput("images\Maltese.png")
' Perform OCR on the input and retrieve the result
Dim Result = Ocr.Read(Input)
' Get all the recognized text
Dim AllText = Result.Text
' Output the recognized text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class
在此範例中,採用 IronTesseract OCR 引擎從名為 Maltese.png 的圖像檔案中讀取文字。 識別出的文字隨後會輸出至控制台。 請確保圖片路徑正確,且圖片檔案中包含馬耳他語文字,以利 OCR 有效運作。 using 語句可確保資源在不再需要時被妥善釋放。

