Tigrinya OCR in C# and .NET

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

126 wiecej jeżyków

IronOCR jest komponentem oprogramowania C#, który umożliwia programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w Tigrinya. Jest to zaawansowany fork Tesseracta, zbudowany wyłącznie dla deweloperów .NET i regularnie przewyższający inne silniki Tesseract pod względem szybkości i dokładności.

Zawartość IronOcr.Languages.Tigrinya

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

  • Tigrinya
  • TigrinyaBest
  • TigrinyaFast

Pobieranie

Tigrinya Language Pack [ትግርኛ]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, to zainstalować pakiet OCR Tigrinya w twoim projekcie .NET.

Install-Package IronOcr.Languages.Tigrinya

Przyklad kodu

Ten przykład kodu C# odczytuje tekst Tigrinya z obrazu lub dokumentu PDF.

using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract to perform OCR
        var Ocr = new IronTesseract();

        // Set the OCR language to Tigrinya
        Ocr.Language = OcrLanguage.Tigrinya;

        // Using statement ensures the OcrInput object is disposed of after use
        using (var Input = new OcrInput(@"images\Tigrinya.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all text recognized in the image and store it in a variable
            var AllText = Result.Text;

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

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract to perform OCR
        var Ocr = new IronTesseract();

        // Set the OCR language to Tigrinya
        Ocr.Language = OcrLanguage.Tigrinya;

        // Using statement ensures the OcrInput object is disposed of after use
        using (var Input = new OcrInput(@"images\Tigrinya.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all text recognized in the image and store it in a variable
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract to perform OCR
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Tigrinya
		Ocr.Language = OcrLanguage.Tigrinya

		' Using statement ensures the OcrInput object is disposed of after use
		Using Input = New OcrInput("images\Tigrinya.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Extract all text recognized in the image and store it in a variable
			Dim AllText = Result.Text

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

Wyjaśnienie

  • IronTesseract: To specjalna klasa z IronOCR używana do rozpoznawania tekstu.
  • Ocr.Language: Ustawia język używany przez silnik OCR. W tym przypadku ustawiono na Tigrinya.
  • OcrInput: Reprezentuje źródło wejściowe, w tym przypadku obraz, który zostanie przekonwertowany na tekst.
  • Ocr.Read(Input): Wykonuje OCR na określonym wejściu i zwraca wyniki.
  • Result.Text: Zawiera tekst wyodrębniony z obrazu wejściowego po procesie OCR.
  • Console.WriteLine(AllText): Wyprowadza wyodrębniony tekst na konsolę. Ta linia jest opcjonalna i może zostać usunięta, jeśli nie jest potrzebne wyjście na konsolę.