Thai Alphabet 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 odczytywać tekst z obrazów i dokumentów PDF w 126 językach, w tym tajski alfabet.

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

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

  • Thai
  • ThaiBest
  • ThaiFast
  • ThaiAlphabet
  • ThaiAlphabetBest
  • ThaiAlphabetFast

Pobieranie

Thai Alphabet Language Pack [ไทย]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu OCR Thai Alphabet w twoim projekcie .NET.

Install-Package IronOcr.Languages.Thai

Przyklad kodu

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

// Ensure you have installed the IronOcr.Languages.Thai package via NuGet.
// Import the IronOcr namespace to work with IronOCR classes.
using IronOcr; 

class ThaiOcrExample
{
    static void Main()
    {
        // Create a new instance of IronTesseract for OCR processing
        var ocr = new IronTesseract();

        // Set the language to Thai for Optical Character Recognition
        ocr.Language = OcrLanguage.Thai;

        // Using the 'using' statement ensures that resources are properly disposed.
        using (var input = new OcrInput(@"images\Thai.png"))
        {
            // Perform OCR to read the text from the input image
            var result = ocr.Read(input);

            // Retrieve and store all recognized text from the image
            string allText = result.Text;

            // Optionally, you can output the text to console or log it as needed
            System.Console.WriteLine(allText);
        }
    }
}
// Ensure you have installed the IronOcr.Languages.Thai package via NuGet.
// Import the IronOcr namespace to work with IronOCR classes.
using IronOcr; 

class ThaiOcrExample
{
    static void Main()
    {
        // Create a new instance of IronTesseract for OCR processing
        var ocr = new IronTesseract();

        // Set the language to Thai for Optical Character Recognition
        ocr.Language = OcrLanguage.Thai;

        // Using the 'using' statement ensures that resources are properly disposed.
        using (var input = new OcrInput(@"images\Thai.png"))
        {
            // Perform OCR to read the text from the input image
            var result = ocr.Read(input);

            // Retrieve and store all recognized text from the image
            string allText = result.Text;

            // Optionally, you can output the text to console or log it as needed
            System.Console.WriteLine(allText);
        }
    }
}
Imports IronOcr

Class ThaiOcrExample
    Shared Sub Main()
        ' Create a new instance of IronTesseract for OCR processing
        Dim ocr As New IronTesseract()

        ' Set the language to Thai for Optical Character Recognition
        ocr.Language = OcrLanguage.Thai

        ' Using the 'Using' statement ensures that resources are properly disposed.
        Using input As New OcrInput("images\Thai.png")
            ' Perform OCR to read the text from the input image
            Dim result = ocr.Read(input)

            ' Retrieve and store all recognized text from the image
            Dim allText As String = result.Text

            ' Optionally, you can output the text to console or log it as needed
            System.Console.WriteLine(allText)
        End Using
    End Sub
End Class
$vbLabelText   $csharpLabel

W tym przykładzie odczytujemy tajski tekst z obrazu o nazwie Thai.png znajdującego się w folderze images. Upewnij się, że zamienisz ścieżkę pliku na faktyczną lokalizację swojego obrazu. Język OCR jest ustawiony na tajski przy użyciu OcrLanguage.Thai do określenia pakietu języka tajskiego do rozpoznawania.