在C#及.NET中的西弗里斯語OCR

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.WesternFrisian的內容

此套件包含67種.NET的OCR語言:

  • WesternFrisian
  • WesternFrisianBest
  • WesternFrisianFast

下載

西弗里斯語語言包 [Frysk]

安裝

我們首先要做的是將西弗里斯語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中並將其列印到控制臺。