Catalan 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 w C#, umożliwiający programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w katalońskim.

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

Zawartość IronOcr.Languages.Catalan

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

  • Kataloński
  • CatalanBest
  • CatalanFast

Pobieranie

Catalan Language Pack [català]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, to zainstalować nasz pakiet OCR Kataloński do projektu .NET.

Install-Package IronOcr.Languages.Catalan

Przyklad kodu

Ten przykład kodu C# odczytuje tekst kataloński z obrazu lub dokumentu PDF.

// Import the IronOcr namespace to use its OCR functionality
using IronOcr;

class CatalanOcrExample
{
    static void Main()
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Set the language for OCR processing to Catalan
        Ocr.Language = OcrLanguage.Catalan;

        // Define the input image or PDF from which you want to read the text
        using (var Input = new OcrInput(@"images\Catalan.png"))
        {
            // Perform OCR reading on the input
            var Result = Ocr.Read(Input);

            // Retrieve all recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace to use its OCR functionality
using IronOcr;

class CatalanOcrExample
{
    static void Main()
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Set the language for OCR processing to Catalan
        Ocr.Language = OcrLanguage.Catalan;

        // Define the input image or PDF from which you want to read the text
        using (var Input = new OcrInput(@"images\Catalan.png"))
        {
            // Perform OCR reading on the input
            var Result = Ocr.Read(Input);

            // Retrieve all recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace to use its OCR functionality
Imports IronOcr

Friend Class CatalanOcrExample
	Shared Sub Main()
		' Create a new instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

		' Set the language for OCR processing to Catalan
		Ocr.Language = OcrLanguage.Catalan

		' Define the input image or PDF from which you want to read the text
		Using Input = New OcrInput("images\Catalan.png")
			' Perform OCR reading on the input
			Dim Result = Ocr.Read(Input)

			' Retrieve all recognized text
			Dim AllText = Result.Text

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

W tym kodzie:

  • Tworzymy instancję IronTesseract do obsługi operacji OCR.
  • Ocr.Language jest określony jako Kataloński, co oznacza, że silnik OCR powinien przetwarzać obrazy, używając modelu języka katalońskiego.
  • Używamy OcrInput do określenia ścieżki pliku obrazu lub dokumentu PDF.
  • Metoda Read jest wywoływana na obiekcie Ocr, a wyniki odczytu OCR są przechowywane w zmiennej Result.
  • Na koniec Result.Text zawiera rozpoznany tekst, który jest wypisywany na konsolę.