使用 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 提取的完整文字。