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

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

  • 阿塞拜疆语
  • AzerbaijaniBest
  • AzerbaijaniFast
  • 阿塞拜疆语西里尔字母
  • 阿塞拜疆语西里尔字母最佳
  • 阿塞拜疆语西里尔字母快速

下载

阿塞拜疆语语言包[阿塞拜疆语]

安装

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

Install-Package IronOCR.Languages.Azerbaijani

代码示例

此 C# 代码示例从图像或 PDF 文档中读取阿塞拜疆语文本。

// Ensure the IronOCR Azerbaijani language package is installed
// PM> Install-Package IronOCR.Languages.Azerbaijani

using IronOcr;

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

        // Specify the language to be Azerbaijani
        Ocr.Language = OcrLanguage.Azerbaijani;

        // Provide the path to the image file containing Azerbaijani text
        using (var Input = new OcrInput(@"images\Azerbaijani.png"))
        {
            // Process the image to extract text
            var Result = Ocr.Read(Input);

            // Extracted text is stored in Result.Text
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
// Ensure the IronOCR Azerbaijani language package is installed
// PM> Install-Package IronOCR.Languages.Azerbaijani

using IronOcr;

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

        // Specify the language to be Azerbaijani
        Ocr.Language = OcrLanguage.Azerbaijani;

        // Provide the path to the image file containing Azerbaijani text
        using (var Input = new OcrInput(@"images\Azerbaijani.png"))
        {
            // Process the image to extract text
            var Result = Ocr.Read(Input);

            // Extracted text is stored in Result.Text
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
' Ensure the IronOCR Azerbaijani language package is installed
' PM> Install-Package IronOCR.Languages.Azerbaijani

Imports IronOcr

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

		' Specify the language to be Azerbaijani
		Ocr.Language = OcrLanguage.Azerbaijani

		' Provide the path to the image file containing Azerbaijani text
		Using Input = New OcrInput("images\Azerbaijani.png")
			' Process the image to extract text
			Dim Result = Ocr.Read(Input)

			' Extracted text is stored in Result.Text
			Dim AllText = Result.Text

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

在这个例子中,我们初始化 IronTesseract 对象并将其语言设置为阿塞拜疆语。 OcrInput实例用于从指定的文件路径读取图像。 Ocr.Read方法处理图像以提取文本,可通过Result.Text属性访问该文本。 这样便于输出或进一步处理。