使用 C# 和 .NET 進行吉爾吉斯語 OCR 識別

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

吉爾吉斯 新增 125 種 OCR 語言

IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言(包括吉爾吉斯語)的文字。

它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。

IronOcr.Languages.Kyrgyz 的內容

此軟體包包含 43 種適用於 .NET 的 OCR 語言:

  • 吉爾吉斯
  • KyrgyzBest
  • KyrgyzFast

下載

吉爾吉斯語語言包[吉爾吉斯語]

安裝

我們首先需要做的就是將我們的吉爾吉斯語OCR 套件安裝到您的 .NET 專案中。

Install-Package IronOCR.Languages.Kyrgyz

程式碼範例

此 C# 程式碼範例從圖像或 PDF 文件中讀取吉爾吉斯語文字。

// Import the IronOcr namespace
using IronOcr;

public class KyrgyzOcrExample
{
    public void PerformOcr()
    {
        // Initialize IronTesseract for OCR operations
        var Ocr = new IronTesseract();

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

        // Define the input using an image file path
        using (var Input = new OcrInput(@"images\Kyrgyz.png"))
        {
            // Perform OCR and get the result
            var Result = Ocr.Read(Input);

            // Extracted text from the image
            string AllText = Result.Text;

            // Output the extracted text (or use it in your application as needed)
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

public class KyrgyzOcrExample
{
    public void PerformOcr()
    {
        // Initialize IronTesseract for OCR operations
        var Ocr = new IronTesseract();

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

        // Define the input using an image file path
        using (var Input = new OcrInput(@"images\Kyrgyz.png"))
        {
            // Perform OCR and get the result
            var Result = Ocr.Read(Input);

            // Extracted text from the image
            string AllText = Result.Text;

            // Output the extracted text (or use it in your application as needed)
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Public Class KyrgyzOcrExample
	Public Sub PerformOcr()
		' Initialize IronTesseract for OCR operations
		Dim Ocr = New IronTesseract()

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

		' Define the input using an image file path
		Using Input = New OcrInput("images\Kyrgyz.png")
			' Perform OCR and get the result
			Dim Result = Ocr.Read(Input)

			' Extracted text from the image
			Dim AllText As String = Result.Text

			' Output the extracted text (or use it in your application as needed)
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • 此程式碼區塊初始化一個IronTesseract物件以執行 OCR。
  • 它使用OcrLanguage.Kyrgyz枚舉將語言設定為吉爾吉斯語。
  • OcrInput類別用於指定要從中提取文字的圖像的檔案路徑。
  • Ocr.Read(Input)執行 OCR 過程,並提供包含擷取文字的結果,可透過Result.Text存取。 最後, Console.WriteLine(AllText)將擷取的文字輸出到控制台。