Maltese OCR in C# and .NET
Other versions of this document:
IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Maltese.
It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines in both speed and accuracy.
Contents of IronOcr.Languages.Maltese
This package contains 46 OCR languages for .NET:
- Maltese
- MalteseBest
- MalteseFast
Download
Maltese Language Pack [Malti]
Installation
The first thing we have to do is install our Maltese OCR package to your .NET project.
Install-Package IronOCR.Languages.Maltese
Code Example
This C# code example reads Maltese text from an image or PDF document.
// 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
In this example, the IronTesseract OCR engine is utilized to read text from an image file named Maltese.png
. The recognized text is then printed to the console. Ensure that the image path is correct and that the image file contains Maltese text for the OCR to work effectively. The using
statement ensures that resources are properly disposed of once they are no longer needed.