使用 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.CanadianAboriginal 的內容

此軟體包包含 103 種適用於 .NET 的 OCR 語言:

加拿大原住民字母

  • 加拿大原住民字母表最佳
  • 加拿大原住民字母表快速

下載

加拿大原住民字母語言包[加拿大原住民]

下載為Zip 檔案

安裝

我們首先要做的是將我們的加拿大原住民字母OCR 套件安裝到您的 .NET 專案中。

Install-Package IronOCR.Languages.CanadianAboriginal

程式碼範例

這段 C# 程式碼範例從圖像或 PDF 文件中讀取加拿大原住民字母文字。 它使用 IronOCR 庫進行光學字元辨識。

// Install the IronOCR package via NuGet
// PM> Install-Package IronOcr.Languages.CanadianAboriginal

using IronOcr;

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

        // Set the language to Canadian Aboriginal
        Ocr.Language = OcrLanguage.CanadianAboriginal;

        // Provide the path to the image or PDF for OCR processing
        using (var Input = new OcrInput(@"images\CanadianAboriginal.png"))
        {
            // Perform OCR on the input file
            var Result = Ocr.Read(Input);

            // Extract all recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Install the IronOCR package via NuGet
// PM> Install-Package IronOcr.Languages.CanadianAboriginal

using IronOcr;

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

        // Set the language to Canadian Aboriginal
        Ocr.Language = OcrLanguage.CanadianAboriginal;

        // Provide the path to the image or PDF for OCR processing
        using (var Input = new OcrInput(@"images\CanadianAboriginal.png"))
        {
            // Perform OCR on the input file
            var Result = Ocr.Read(Input);

            // Extract all recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Install the IronOCR package via NuGet
' PM> Install-Package IronOcr.Languages.CanadianAboriginal

Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create an instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the language to Canadian Aboriginal
		Ocr.Language = OcrLanguage.CanadianAboriginal

		' Provide the path to the image or PDF for OCR processing
		Using Input = New OcrInput("images\CanadianAboriginal.png")
			' Perform OCR on the input file
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

			' Output the recognized text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • 上述程式碼使用IronOcr.IronTesseract類別執行 OCR。
  • 它設定OcrLanguage.CanadianAboriginal來指定加拿大原住民文本的語言模型。
  • OcrInput物件載入路徑中指定的圖像。
  • Ocr.Read方法處理影像並傳回辨識出的文字。 最後,將提取的文字列印到控制台。