C# 與 .NET 中的西弗里斯蘭語 OCR
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.WesternFrisian 的內容
此套件包含 67 種適用於 .NET 的 OCR 語言:
- 西弗里斯蘭語
- 西弗里斯蘭語Best
- 西弗里斯蘭語Fast
下載
西弗里斯蘭語語言套件 [Frysk]
安裝
我們首先必須將 Western Frisian 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。 - 將 OCR 處理設定為使用
OcrLanguage.WesternFrisian語言選項來識別西弗里斯蘭語文字。 - 讀取位於路徑
images\WesternFrisian.png的影像檔案。 - 將識別出的文字儲存至
AllText並 PRINT 至控制台。

