Cyrillic Alphabet OCR in C

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

126 wiecej jeżyków

IronOCR to komponent oprogramowania C# pozwalający programistom .NET na odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym cyrylicy.

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

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

  • Cyrylica
  • CyrylicaNajlepsza
  • CyrylicaSzybka

Pobieranie

Cyrillic Alphabet Language Pack [Cyrillic scripts]

Instalacja

Pierwszą rzeczą, którą musisz zrobić, jest zainstalowanie pakietu OCR Cyrylica w swoim projekcie .NET.

Install-Package IronOcr.Languages.Cyrillic

Przyklad kodu

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

using IronOcr;

public class OcrExample
{
    public void ReadCyrillicText()
    {
        // Initialize a new instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Cyrillic language package
        Ocr.Language = OcrLanguage.Cyrillic;

        // Create a new OCR input from an image file
        using (var Input = new OcrInput(@"images\Cyrillic.png"))
        {
            // Read the image using the OCR engine
            var Result = Ocr.Read(Input);

            // Retrieve Recognized Text
            var AllText = Result.Text;

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

public class OcrExample
{
    public void ReadCyrillicText()
    {
        // Initialize a new instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Cyrillic language package
        Ocr.Language = OcrLanguage.Cyrillic;

        // Create a new OCR input from an image file
        using (var Input = new OcrInput(@"images\Cyrillic.png"))
        {
            // Read the image using the OCR engine
            var Result = Ocr.Read(Input);

            // Retrieve Recognized Text
            var AllText = Result.Text;

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

Public Class OcrExample
	Public Sub ReadCyrillicText()
		' Initialize a new instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the OCR engine to use the Cyrillic language package
		Ocr.Language = OcrLanguage.Cyrillic

		' Create a new OCR input from an image file
		Using Input = New OcrInput("images\Cyrillic.png")
			' Read the image using the OCR engine
			Dim Result = Ocr.Read(Input)

			' Retrieve Recognized Text
			Dim AllText = Result.Text

			' Output the recognized text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • IronTesseract: To klasa silnika OCR, której używasz do konfigurowania i wykonywania zadań OCR.
  • OcrInput: Klasa reprezentująca obraz wejściowy lub dokument, na którym chcesz wykonać OCR.
  • OcrLanguage.Cyrillic: Określa, że silnik OCR powinien używać pakietu języka cyrylicy do rozpoznawania.
  • Result.Text: Uzyskuje dostęp do rozpoznanego tekstu z obiektu wyników OCR.

Ten przykład demonstruje prosty przypadek użycia, w którym obraz z tekstem cyrylicą jest przetwarzany w celu wyodrębnienia tekstu.