使用 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.Assamese 的内容

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

阿萨姆语

  • AssameseBest
  • AssameseFast

下载

阿萨姆语语言包[阿萨姆语] 下载为Zip 文件

安装

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

Install-Package IronOCR.Languages.Assamese

代码示例

这段 C# 代码示例从图像或 PDF 文档中读取阿萨姆语文本。

// Make sure to install the necessary package:
// PM> Install-Package IronOcr.Languages.Assamese

using IronOcr;

class OCRExample
{
    public void ReadAssameseText()
    {
        // Create an instance of IronTesseract OCR engine
        var Ocr = new IronTesseract();

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

        // Create an OCR input object with the specified image or PDF file
        using (var Input = new OcrInput(@"images\Assamese.png"))
        {
            // Read the text from the input file
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Make sure to install the necessary package:
// PM> Install-Package IronOcr.Languages.Assamese

using IronOcr;

class OCRExample
{
    public void ReadAssameseText()
    {
        // Create an instance of IronTesseract OCR engine
        var Ocr = new IronTesseract();

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

        // Create an OCR input object with the specified image or PDF file
        using (var Input = new OcrInput(@"images\Assamese.png"))
        {
            // Read the text from the input file
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Make sure to install the necessary package:
' PM> Install-Package IronOcr.Languages.Assamese

Imports IronOcr

Friend Class OCRExample
	Public Sub ReadAssameseText()
		' Create an instance of IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

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

		' Create an OCR input object with the specified image or PDF file
		Using Input = New OcrInput("images\Assamese.png")
			' Read the text from the input file
			Dim Result = Ocr.Read(Input)

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

			' Output the recognized text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • IronTesseract :这是负责 OCR 操作的主要类。
  • OcrLanguage.Assamese :指定 OCR 的语言。 在这种情况下,语言设置为阿萨姆语。
  • OcrInput :此类用于加载要从中提取文本的图像或 PDF。
  • Result.Text :包含从图像或 PDF 中提取的完整文本。