Maltese OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Inne wersje tego dokumentu:

IronOCR to komponent oprogramowania C# umożliwiający programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym po maltańsku.

Jest to zaawansowany fork Tesseract, stworzony wyłącznie dla programistów .NET i regularnie przewyższa inne silniki Tesseract zarówno pod względem szybkości, jak i dokładności.

Zawartość IronOcr.Languages.Maltese

Ten pakiet zawiera 46 języków OCR dla .NET:

  • Malteski
  • MalteseBest
  • MalteseFast

Pobieranie

Pakiet językowy maltański [Malti]

  • Pobierz jako Zip
  • Zainstaluj z pomocą NuGet

Instalacja

Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu OCR maltańskiego do projektu .NET.

Install-Package IronOcr.Languages.Maltese

Przyklad kodu

Ten przykład kodu w C# odczytuje tekst maltański z obrazu lub dokumentu 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
$vbLabelText   $csharpLabel

W tym przykładzie silnik OCR IronTesseract jest wykorzystywany do odczytania tekstu z pliku obrazów o nazwie Maltese.png. Rozpoznany tekst jest następnie drukowany na konsolę. Upewnij się, że ścieżka obrazu jest poprawna i że plik obrazu zawiera tekst maltański, aby OCR działał skutecznie. Instrukcja using zapewnia, że zasoby są prawidłowo zwalniane, gdy nie są już potrzebne.