Croatian 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 komponenta oprogramowania C#, pozwalająca programistom .NET odczytywać tekst z obrazów i dokumentów PDF w 126 językach, w tym po chorwacku. 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.Croatian

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

  • Chorwacki
  • CroatianBest
  • CroatianFast

Pobieranie

Croatian Language Pack [hrvatski jezik]

Instalacja

Pierwszym krokiem jest zainstalowanie pakietu OCR Chorwacki w swoim projekcie .NET za pomocą NuGet.

Install-Package IronOcr.Languages.Croatian

Przyklad kodu

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

// Add the required namespace for IronOCR
using IronOcr;

class OCRExample
{
    public static void Main()
    {
        // Create a new IronTesseract instance
        var Ocr = new IronTesseract();

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

        // Define the input image or PDF containing Croatian text
        using (var Input = new OcrInput(@"images\Croatian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
// Add the required namespace for IronOCR
using IronOcr;

class OCRExample
{
    public static void Main()
    {
        // Create a new IronTesseract instance
        var Ocr = new IronTesseract();

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

        // Define the input image or PDF containing Croatian text
        using (var Input = new OcrInput(@"images\Croatian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
' Add the required namespace for IronOCR
Imports IronOcr

Friend Class OCRExample
	Public Shared Sub Main()
		' Create a new IronTesseract instance
		Dim Ocr = New IronTesseract()

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

		' Define the input image or PDF containing Croatian text
		Using Input = New OcrInput("images\Croatian.png")
			' Perform OCR on the input
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

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

Wyjaśnienie

  • IronTesseract: To główna klasa używana do wykonywania operacji OCR. Odczytuje tekst z obrazów lub PDF-ów i obsługuje wiele języków.
  • OcrInput: Reprezentuje źródło wejściowe dla OCR, którym może być plik obrazu lub PDF.
  • Ocr.Read: Wykonuje proces OCR na określonym wejściu.
  • Result.Text: Zawiera wyodrębniony tekst z wejścia, który jest następnie drukowany na konsolę.