Gurmukhi Alphabet OCR in C# and .NET

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

126 種其他語言

IronOCR 是一款 C# 軟體元件,讓 .NET 開發人員能夠從 126 種語言的圖像和 PDF 文件中讀取文字,其中包括古木基文字。

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

IronOcr.Languages.Gurmukhi 的內容

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

  • 古木基字母
  • 古木基字母Best
  • 古木基字母Fast

下載

古木基字母語言套件 [Gurmukhī]

安裝

我們首先必須將古木基字母 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Gurmukhi

程式碼範例

此 C# 程式碼範例可從圖片或 PDF 文件中讀取古木基文字。

// Import the IronOcr namespace
using IronOcr;

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

        // Set the OCR language to Gurmukhi
        Ocr.Language = OcrLanguage.Gurmukhi;

        // Define the input source for OCR using an image file path
        using (var Input = new OcrInput(@"images\Gurmukhi.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

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

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

        // Set the OCR language to Gurmukhi
        Ocr.Language = OcrLanguage.Gurmukhi;

        // Define the input source for OCR using an image file path
        using (var Input = new OcrInput(@"images\Gurmukhi.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Gurmukhi
		Ocr.Language = OcrLanguage.Gurmukhi

		' Define the input source for OCR using an image file path
		Using Input = New OcrInput("images\Gurmukhi.png")
			' Perform OCR on the input
			Dim Result = Ocr.Read(Input)

			' Retrieve the recognized text
			Dim AllText = Result.Text

			' Output the recognized text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • 請確保您的專案中已安裝必要的 IronOCR 程式庫,以便使用古木基語語言套件。
  • 請修改路徑 "images\Gurmukhi.png",使其指向您要處理的實際圖像檔案。
  • 此程式會從指定的圖片中讀取文字,並將其輸出至控制台。