使用 C# 和 .NET 實作西弗里斯蘭語 OCR
This article was translated from English: Does it need improvement?
TranslatedView the article in English
IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言的文本,包括西弗里斯蘭語。
它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.WesternFrisian 的內容
此軟體包包含 67 種適用於 .NET 的 OCR 語言:
- 西弗里西亞人
- WesternFrisianBest
- 西弗里斯蘭快餐
下載
西弗里西亞語語言包 [弗里西亞語]
安裝
我們首先需要做的是將我們的西弗里西亞語OCR 套件安裝到您的 .NET 專案中。
Install-Package IronOCR.Languages.WesternFrisian
程式碼範例
這段 C# 程式碼範例從圖像或 PDF 文件中讀取西弗里西亞語文字。
// Import the IronOcr library
using IronOcr;
class WesternFrisianOcrExample
{
static void Main()
{
// Create a new instance of IronTesseract, which is the OCR engine
var Ocr = new IronTesseract();
// Set the language to Western Frisian
Ocr.Language = OcrLanguage.WesternFrisian;
// Perform OCR on a given image
using (var Input = new OcrInput(@"images\WesternFrisian.png"))
{
// Read the input image and store the result
var Result = Ocr.Read(Input);
// Extract the text from the result
string AllText = Result.Text;
// Output the recognized text to the console
System.Console.WriteLine(AllText);
}
}
}// Import the IronOcr library
using IronOcr;
class WesternFrisianOcrExample
{
static void Main()
{
// Create a new instance of IronTesseract, which is the OCR engine
var Ocr = new IronTesseract();
// Set the language to Western Frisian
Ocr.Language = OcrLanguage.WesternFrisian;
// Perform OCR on a given image
using (var Input = new OcrInput(@"images\WesternFrisian.png"))
{
// Read the input image and store the result
var Result = Ocr.Read(Input);
// Extract the text from the result
string AllText = Result.Text;
// Output the recognized text to the console
System.Console.WriteLine(AllText);
}
}
}' Import the IronOcr library
Imports IronOcr
Friend Class WesternFrisianOcrExample
Shared Sub Main()
' Create a new instance of IronTesseract, which is the OCR engine
Dim Ocr = New IronTesseract()
' Set the language to Western Frisian
Ocr.Language = OcrLanguage.WesternFrisian
' Perform OCR on a given image
Using Input = New OcrInput("images\WesternFrisian.png")
' Read the input image and store the result
Dim Result = Ocr.Read(Input)
' Extract the text from the result
Dim AllText As String = Result.Text
' Output the recognized text to the console
System.Console.WriteLine(AllText)
End Using
End Sub
End Class$vbLabelText $csharpLabel
在這個例子中,我們:
- 初始化 OCR 引擎
IronTesseract。 - 使用
OcrLanguage.WesternFrisian語言選項,將 OCR 過程設定為識別西弗里西亞語文字。 - 讀取位於
images\WesternFrisian.png路徑的圖片檔案。 - 將識別出的文字儲存在
AllText中,並將其列印到控制台。





