Azerbaijani 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.Azerbaijani 的內容

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

  • 阿塞拜疆語
  • 阿塞拜疆語最佳
  • 阿塞拜疆語快速
  • 阿塞拜疆語(西里爾字母)
  • 阿塞拜疆語(西里爾字母)最佳
  • 阿塞拜疆語(西里爾字母)快速

下載

阿塞拜疆語語言套件 [azərbaycan dili]

安裝

我們首先必須將阿塞拜疆語 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Azerbaijani

程式碼範例

此 C# 程式碼範例會從圖片或 PDF 文件中讀取阿塞拜疆語文字。

// Ensure the IronOCR Azerbaijani language package is installed
// PM> Install-Package IronOcr.Languages.Azerbaijani

using IronOcr;

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

        // Specify the language to be Azerbaijani
        Ocr.Language = OcrLanguage.Azerbaijani;

        // Provide the path to the image file containing Azerbaijani text
        using (var Input = new OcrInput(@"images\Azerbaijani.png"))
        {
            // Process the image to extract text
            var Result = Ocr.Read(Input);

            // Extracted text is stored in Result.Text
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
// Ensure the IronOCR Azerbaijani language package is installed
// PM> Install-Package IronOcr.Languages.Azerbaijani

using IronOcr;

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

        // Specify the language to be Azerbaijani
        Ocr.Language = OcrLanguage.Azerbaijani;

        // Provide the path to the image file containing Azerbaijani text
        using (var Input = new OcrInput(@"images\Azerbaijani.png"))
        {
            // Process the image to extract text
            var Result = Ocr.Read(Input);

            // Extracted text is stored in Result.Text
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Module Program
    Sub Main()
        ' Create a new instance of IronTesseract engine
        Dim Ocr As New IronTesseract()

        ' Specify the language to be Azerbaijani
        Ocr.Language = OcrLanguage.Azerbaijani

        ' Provide the path to the image file containing Azerbaijani text
        Using Input As New OcrInput("images\Azerbaijani.png")
            ' Process the image to extract text
            Dim Result = Ocr.Read(Input)

            ' Extracted text is stored in Result.Text
            Dim AllText = Result.Text

            ' Output the extracted text
            Console.WriteLine(AllText)
        End Using
    End Sub
End Module
$vbLabelText   $csharpLabel

在此範例中,我們初始化 IronTesseract 物件,並將其語言設定為阿塞拜疆語。 OcrInput 實例用於從指定的檔案路徑讀取影像。 Ocr.Read 方法會處理圖片以提取文字,該文字可透過 Result.Text 屬性取得。 這便能輕鬆輸出或進行後續處理。