使用 C# 和 .NET 进行缅甸语 OCR 识别

This article was translated from English: Does it need improvement?
Translated
View the article in English

还有126种语言

IronOCR 是一个 C# 软件组件,它允许 .NET 开发人员从图像和 PDF 文档中读取文本,支持 126 种语言,包括缅甸语。它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。

IronOcr.Languages.Myanmar 的内容

此软件包包含对缅甸特有的 114 种语言的 OCR 支持:

  • MyanmarBest
  • MyanmarFast
  • MyanmarFast
  • MyanmarAlphabetBest
  • MyanmarAlphabetBest
  • MyanmarAlphabetFast

下载

缅甸语语言包[缅甸语]

安装

首先,通过 NuGet 将Myanmar OCR 包安装到您的 .NET 项目中:

Install-Package IronOCR.Languages.Myanmar

代码示例

此 C# 代码示例从图像或 PDF 文档中读取缅甸语文本。

// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

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

        // Define input source - image or PDF containing Myanmar text
        using (var Input = new OcrInput(@"images\Myanmar.png"))
        {
            // Perform OCR on the input and obtain the result
            var Result = Ocr.Read(Input);

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

            // Output the recognized Myanmar text
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

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

        // Define input source - image or PDF containing Myanmar text
        using (var Input = new OcrInput(@"images\Myanmar.png"))
        {
            // Perform OCR on the input and obtain the result
            var Result = Ocr.Read(Input);

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

            // Output the recognized Myanmar text
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Initialize the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

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

		' Define input source - image or PDF containing Myanmar text
		Using Input = New OcrInput("images\Myanmar.png")
			' Perform OCR on the input and obtain the result
			Dim Result = Ocr.Read(Input)

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

			' Output the recognized Myanmar text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

解释

  • IronTesseract :这是 IronOCR 库提供的主要类,用于处理 OCR 任务。
  • Ocr.Language :设置 OCR 的语言; 此示例设置为OcrLanguage.Myanmar
  • OcrInput :用于指定输入源,可以是图像或 PDF 文件。
  • Ocr.Read :执行 OCR 过程并返回OcrResult对象。
  • Result.Text :包含从图像或 PDF 文档中提取的文本。