使用 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 的内容。语言。马拉雅拉姆语

此软件包包含 126 种适用于 .NET 的 OCR 语言:

  • 马拉雅拉姆语
  • 马拉雅拉姆语Best
  • 马拉雅拉姆语Fast -马拉雅拉姆语字母表 -马拉雅拉姆语字母表Best -马拉雅拉姆语字母表Fast

下载

马拉雅拉姆语语言包[马拉雅拉姆语]

下载为Zip 文件

安装

我们首先需要做的是将Malayalam OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Malayalam

代码示例

此 C# 代码示例从图像或 PDF 文档中读取马拉雅拉姆语文本。

// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract
        var Ocr = new IronTesseract();

        // Set the language to Malayalam
        Ocr.Language = OcrLanguage.Malayalam;

        // Process the image to extract text using OCR
        using (var Input = new OcrInput(@"images\Malayalam.png"))
        {
            // Read the text from the input object
            var Result = Ocr.Read(Input);

            // Extract and store the recognized text
            var AllText = Result.Text;

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

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract
        var Ocr = new IronTesseract();

        // Set the language to Malayalam
        Ocr.Language = OcrLanguage.Malayalam;

        // Process the image to extract text using OCR
        using (var Input = new OcrInput(@"images\Malayalam.png"))
        {
            // Read the text from the input object
            var Result = Ocr.Read(Input);

            // Extract and store the recognized text
            var AllText = Result.Text;

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

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract
		Dim Ocr = New IronTesseract()

		' Set the language to Malayalam
		Ocr.Language = OcrLanguage.Malayalam

		' Process the image to extract text using OCR
		Using Input = New OcrInput("images\Malayalam.png")
			' Read the text from the input object
			Dim Result = Ocr.Read(Input)

			' Extract and store the recognized text
			Dim AllText = Result.Text

			' Output the recognized text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • 该代码演示了如何设置 IronOCR 以对指定图像执行马拉雅拉姆语的 OCR 识别。
  • OcrInput对象用于输入图像文件。
  • Ocr.Read函数处理图像并提取文本。
  • 提取的文本存储在AllText中,并打印到控制台。