Tibetan Alphabet 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.Tibetan 的內容
此套件包含 114 種適用於 .NET 的 OCR 語言:
- 藏文
- 藏文Best
- 藏文Fast
- 藏文字母
- 藏文字母Best
- 藏文字母Fast
下載
藏文語系套件 [藏文標準]
安裝
您首先需要將"藏文字母 OCR"套件安裝至您的 .NET 專案中。
Install-Package IronOcr.Languages.Tibetan
程式碼範例
此 C# 程式碼範例用於從圖片或 PDF 文件中讀取藏文字元。
// Import the IronOcr namespace to use its components
using IronOcr;
class Program
{
static void Main()
{
// Initialize a new IronTesseract object for OCR
var Ocr = new IronTesseract();
// Set the OCR language to Tibetan
Ocr.Language = OcrLanguage.Tibetan;
// Use a using statement for automatic resource disposal
using (var Input = new OcrInput(@"images\Tibetan.png"))
{
// Perform OCR to read text from the input image
var Result = Ocr.Read(Input);
// Retrieve all recognized text from the OCR Result
var AllText = Result.Text;
// Output the recognized text to the console
// Note: Ensure that the console supports Tibetan script for correct display
Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace to use its components
using IronOcr;
class Program
{
static void Main()
{
// Initialize a new IronTesseract object for OCR
var Ocr = new IronTesseract();
// Set the OCR language to Tibetan
Ocr.Language = OcrLanguage.Tibetan;
// Use a using statement for automatic resource disposal
using (var Input = new OcrInput(@"images\Tibetan.png"))
{
// Perform OCR to read text from the input image
var Result = Ocr.Read(Input);
// Retrieve all recognized text from the OCR Result
var AllText = Result.Text;
// Output the recognized text to the console
// Note: Ensure that the console supports Tibetan script for correct display
Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace to use its components
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Initialize a new IronTesseract object for OCR
Dim Ocr = New IronTesseract()
' Set the OCR language to Tibetan
Ocr.Language = OcrLanguage.Tibetan
' Use a using statement for automatic resource disposal
Using Input = New OcrInput("images\Tibetan.png")
' Perform OCR to read text from the input image
Dim Result = Ocr.Read(Input)
' Retrieve all recognized text from the OCR Result
Dim AllText = Result.Text
' Output the recognized text to the console
' Note: Ensure that the console supports Tibetan script for correct display
Console.WriteLine(AllText)
End Using
End Sub
End Class
$vbLabelText
$csharpLabel
備註
- OCR 函式庫 (
IronTesseract) 已設定為從提供的圖片中讀取藏文。 OcrInput負責載入輸入圖片,並透過using語句確保資源被正確釋放。Result.Text包含經 OCR 處理的文字,可直接列印或在應用程式中使用。

