Sundanese OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
本文件的其他版本:

IronOCR 是一款 C# 軟體元件,讓 .NET 開發人員能夠從 126 種語言(包括松達語)的圖片和 PDF 文件中讀取文字。

這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均定期超越其他 Tesseract 引擎。

IronOcr.Languages.Sundanese 的內容

此套件包含 52 種適用於 .NET 的 OCR 語言:

  • 蘇丹語
  • 蘇丹語Best
  • 蘇丹語Fast

下載

蘇丹語語言套件 [Basa Sunda]

安裝

我們首先必須將 Sundanese OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Sundanese

程式碼範例

此 C# 程式碼範例會從圖片或 PDF 文件中讀取蘇丹語文字。

// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese;

        // Initialize the OCR input with an image file containing Sundanese text
        using (var Input = new OcrInput(@"images\Sundanese.png"))
        {
            // Process the input and get the result
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            System.Co/nsole.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese;

        // Initialize the OCR input with an image file containing Sundanese text
        using (var Input = new OcrInput(@"images\Sundanese.png"))
        {
            // Process the input and get the result
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            System.Co/nsole.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Class Program
    Shared Sub Main()
        ' Create a new instance of the IronTesseract class
        Dim Ocr As New IronTesseract()

        ' Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese

        ' Initialize the OCR input with an image file containing Sundanese text
        Using Input As New OcrInput("images\Sundanese.png")
            ' Process the input and get the result
            Dim Result = Ocr.Read(Input)

            ' Extract all recognized text from the result
            Dim AllText = Result.Text

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

說明

  • 我們首先導入 IronOcr 命名空間,以使用其 OCR 功能。
  • 建立 IronTesseract 的實例,作為我們的主要 OCR 引擎。
  • 我們將 Language 屬性設定為 OcrLanguage.Sundanese,以指定引擎應預期讀取蘇門答臘語文字。
  • 我們建立一個 OcrInput 物件,用以指定 OCR 引擎的圖像檔案來源。
  • Read 方法會處理輸入內容並嘗試識別文字。
  • 識別出的文字會儲存於 AllText 變數中,並隨後 PRINT 至控制台。

此設定可透過在 .NET 環境中使用 IronOCR程式庫,實現對圖像中蘇丹語文字的強大辨識能力。