Panjabi 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.Panjabi 的內容
此套件包含 46 種適用於 .NET 的 OCR 語言:
- Panjabi
- PanjabiBest
- PanjabiFast
下載
旁遮普語語言套件 [ਪਜਾਬੀ]
安裝
我們首先必須將 Panjabi OCR 套件安裝到您的 .NET 專案中。
Install-Package IronOcr.Languages.Panjabi
程式碼範例
此 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();
// Set the language to Panjabi
Ocr.Language = OcrLanguage.Panjabi;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Panjabi.png"))
{
// Perform OCR on the input file
var Result = Ocr.Read(Input);
// Extract and store the recognized text from the OCR result
var AllText = Result.Text;
}
}
}
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the language to Panjabi
Ocr.Language = OcrLanguage.Panjabi;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Panjabi.png"))
{
// Perform OCR on the input file
var Result = Ocr.Read(Input);
// Extract and store the recognized text from the OCR result
var AllText = Result.Text;
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the language to Panjabi
Ocr.Language = OcrLanguage.Panjabi
' Define the input image or PDF file
Using Input = New OcrInput("images\Panjabi.png")
' Perform OCR on the input file
Dim Result = Ocr.Read(Input)
' Extract and store the recognized text from the OCR result
Dim AllText = Result.Text
End Using
End Sub
End Class
$vbLabelText
$csharpLabel
說明
- IronTesseract:這是 IronOCR 為 OCR 操作所提供的主要類別。
- Ocr.Language:我們指定 OCR 引擎應使用的語言。 此處設定為旁遮普語。
- OcrInput:此類別用於指定需執行 OCR 處理的輸入檔案(圖片或 PDF)。
- Ocr.Read(): 此方法執行實際的 OCR 任務,並返回包含擷取文字的結果。
- Result.Text:此變數包含對輸入檔案執行 OCR 後所擷取的文字。
此範例展示如何在 .NET 應用程式中有效運用 IronOCR程式庫,從圖片或 PDF 文件中擷取旁遮普語文字。

