使用 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)将提取的文本输出到控制台。