Marathi 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#, który pozwala programistom .NET na odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w języku marathi.

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.Marathi

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

  • Marathi
  • MarathiBest
  • MarathiFast

Pobieranie

Marathi Language Pack [मराठी]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie pakietu OCR dla Marathi w projekcie .NET.

Install-Package IronOcr.Languages.Marathi

Przyklad kodu

Ten przykład kodu C# odczytuje tekst w języku marathi z obrazu lub dokumentu PDF.

// Include the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the OCR engine
        var Ocr = new IronTesseract();

        // Specify the language as Marathi
        Ocr.Language = OcrLanguage.Marathi;

        // Load the image or PDF document to be processed
        using (var Input = new OcrInput(@"images\Marathi.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to console
            Console.WriteLine(AllText);
        }
    }
}
// Include the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the OCR engine
        var Ocr = new IronTesseract();

        // Specify the language as Marathi
        Ocr.Language = OcrLanguage.Marathi;

        // Load the image or PDF document to be processed
        using (var Input = new OcrInput(@"images\Marathi.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to console
            Console.WriteLine(AllText);
        }
    }
}
' Include the IronOcr namespace
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Initialize the OCR engine
		Dim Ocr = New IronTesseract()

		' Specify the language as Marathi
		Ocr.Language = OcrLanguage.Marathi

		' Load the image or PDF document to be processed
		Using Input = New OcrInput("images\Marathi.png")
			' Perform OCR on the input document
			Dim Result = Ocr.Read(Input)

			' Get the recognized text
			Dim AllText = Result.Text

			' Output the recognized text to console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Wyjaśnienie:

  • Ten kod używa klasy IronTesseract z biblioteki IronOCR do wykonania OCR.
  • Właściwość Ocr.Language jest ustawiona na używanie pakietu językowego marathi.
  • Tworzony jest OcrInput z użyciem ścieżki do obrazu lub PDF zawierającej tekst w języku marathi.
  • Metoda Ocr.Read() przetwarza dane wejściowe i wyodrębnia tekst.
  • Rozpoznany tekst jest przechowywany w zmiennej AllText i drukowany na konsolę.