Polish 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 czytanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w języku polskim. Jest to zaawansowana gałąź Tesseract, zbudowana wyłącznie dla programistów .NET i regularnie przewyższa inne silniki Tesseract zarówno pod względem prędkości, jak i dokładności.

Zawartość IronOcr.Languages.Polish

Ten pakiet zawiera 43 języki OCR dla .NET:

  • Polish
  • PolishBest
  • PolishFast

Pobieranie

Polish Language Pack [język polski]:

Instalacja

Pierwszym krokiem jest zainstalowanie pakietu OCR Polish w swoim projekcie .NET.

Aby zainstalować za pomocą Menedżera pakietów NuGet, wykonaj następujące polecenie:

Install-Package IronOcr.Languages.Polish

Przyklad kodu

Ten przykład kodu C# demonstruje, jak czytać polski tekst z obrazu lub dokumentu PDF przy użyciu IronOCR.

// Install the IronOcr.Languages.Polish package via NuGet before using this code.
using IronOcr;

public class PolishOcrExample
{
    public void ReadPolishTextFromImage()
    {
        // Initialize the IronTesseract object
        var Ocr = new IronTesseract();

        // Set the language to Polish
        Ocr.Language = OcrLanguage.Polish;

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

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

            // Display or process the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Install the IronOcr.Languages.Polish package via NuGet before using this code.
using IronOcr;

public class PolishOcrExample
{
    public void ReadPolishTextFromImage()
    {
        // Initialize the IronTesseract object
        var Ocr = new IronTesseract();

        // Set the language to Polish
        Ocr.Language = OcrLanguage.Polish;

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

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

            // Display or process the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Install the IronOcr.Languages.Polish package via NuGet before using this code.
Imports IronOcr

Public Class PolishOcrExample
	Public Sub ReadPolishTextFromImage()
		' Initialize the IronTesseract object
		Dim Ocr = New IronTesseract()

		' Set the language to Polish
		Ocr.Language = OcrLanguage.Polish

		' Provide the path to the image or PDF file containing Polish text
		Using Input = New OcrInput("images\Polish.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

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

Ten skrypt inicjalizuje silnik OCR, określa język (polski) i przetwarza obraz znajdujący się pod ścieżką "images\Polish.png", aby wyodrębnić i wyświetlić tekst. Upewnij się, że ścieżka do pliku jest poprawna i że pakiet OCR jest zainstalowany przed uruchomieniem kodu.