Lithuanian 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.Lithuanian 內容

此套件包含 55 種適用於 .NET 的 OCR 語言:

  • 立陶宛語
  • 立陶宛語最佳
  • 立陶宛語Fast

下載

立陶宛語語言套件 [lietuvių kalba]

安裝

我們首先必須將立陶宛語 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Lithuanian

程式碼範例

此 C# 程式碼範例會從圖片或 PDF 文件中讀取立陶宛文內容。

// Include the IronOcr namespace to use OCR features
using IronOcr;

class Program
{
    static void Main(string[] args)
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Set the OCR language to Lithuanian
        Ocr.Language = OcrLanguage.Lithuanian;

        // Use a using statement to ensure that the OcrInput object is disposed of properly
        using (var Input = new OcrInput(@"images\Lithuanian.png"))
        {
            // Perform OCR on the input image and store the result
            var Result = Ocr.Read(Input);

            // Extract the text from the OCR result
            var AllText = Result.Text;

            // For demonstration purposes, output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Include the IronOcr namespace to use OCR features
using IronOcr;

class Program
{
    static void Main(string[] args)
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Set the OCR language to Lithuanian
        Ocr.Language = OcrLanguage.Lithuanian;

        // Use a using statement to ensure that the OcrInput object is disposed of properly
        using (var Input = new OcrInput(@"images\Lithuanian.png"))
        {
            // Perform OCR on the input image and store the result
            var Result = Ocr.Read(Input);

            // Extract the text from the OCR result
            var AllText = Result.Text;

            // For demonstration purposes, output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Include the IronOcr namespace to use OCR features
Imports IronOcr

Friend Class Program
	Shared Sub Main(ByVal args() As String)
		' Create a new instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Lithuanian
		Ocr.Language = OcrLanguage.Lithuanian

		' Use a using statement to ensure that the OcrInput object is disposed of properly
		Using Input = New OcrInput("images\Lithuanian.png")
			' Perform OCR on the input image and store the result
			Dim Result = Ocr.Read(Input)

			' Extract the text from the OCR result
			Dim AllText = Result.Text

			' For demonstration purposes, output the extracted text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel