Afrikaans 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#, pozwalający programistom .NET na odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w języku afrikaans.

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

Pakiet ten zawiera 52 języki OCR dla .NET:

  • Afrikaans
  • AfrikaansBest
  • AfrikaansFast

Pobieranie

Afrikaans Language Pack [Afrikaans]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu OCR dla języka Afrikaans do Twojego projektu .NET.

Install-Package IronOcr.Languages.Afrikaans

Przyklad kodu

Ten przykład kodu C# odczytuje tekst w języku afrikaans z obrazu lub dokumentu PDF.

// First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
// This example requires the IronOcr C# package to read text from images or PDFs.

using IronOcr;

var Ocr = new IronTesseract(); // Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans; // Set the language to Afrikaans

// Load the image or PDF document into an OcrInput object
using (var Input = new OcrInput(@"images\Afrikaans.png"))
{
    // Perform OCR on the input document
    var Result = Ocr.Read(Input);

    // Retrieve the complete recognized text
    var AllText = Result.Text;

    // Output the recognized text (this step is customizable for your use-case)
    Console.WriteLine(AllText);
}
// First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
// This example requires the IronOcr C# package to read text from images or PDFs.

using IronOcr;

var Ocr = new IronTesseract(); // Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans; // Set the language to Afrikaans

// Load the image or PDF document into an OcrInput object
using (var Input = new OcrInput(@"images\Afrikaans.png"))
{
    // Perform OCR on the input document
    var Result = Ocr.Read(Input);

    // Retrieve the complete recognized text
    var AllText = Result.Text;

    // Output the recognized text (this step is customizable for your use-case)
    Console.WriteLine(AllText);
}
' First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
' This example requires the IronOcr C# package to read text from images or PDFs.

Imports IronOcr

Private Ocr = New IronTesseract() ' Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans ' Set the language to Afrikaans

' Load the image or PDF document into an OcrInput object
Using Input = New OcrInput("images\Afrikaans.png")
	' Perform OCR on the input document
	Dim Result = Ocr.Read(Input)

	' Retrieve the complete recognized text
	Dim AllText = Result.Text

	' Output the recognized text (this step is customizable for your use-case)
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

Wyjaśnienie:

  • IronTesseract: Ta klasa jest częścią biblioteki IronOCR i służy do ustawienia procesu OCR.
  • OcrLanguage: Ta właściwość ustawia język dla OCR. Tutaj ustawiony jest na afrikaans.
  • OcrInput: Ta klasa kapsułkuje plik wejściowy dla procesu OCR. Obsługuje różne formaty obrazów i pliki PDF.
  • Ocr.Read(): Ta metoda wykonuje proces OCR i zwraca rozpoznany tekst zawinięty w obiekt wynikowy.
  • Result.Text: Ta właściwość zawiera tekst wyodrębniony z dokumentu wejściowego.