C# 中的 Cherokee 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.Cherokee 的內容

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

  • 切羅基字母表
  • 切諾基字母表最佳
  • CherokeeAlphabetFast
  • 切羅基
  • CherokeeBest
  • CherokeeFast

下載

切羅基語包[ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ]

安裝

我們首先需要做的就是將我們的Cherokee OCR 套件安裝到您的 .NET 專案中。

Install-Package IronOCR.Languages.Cherokee

程式碼範例

這段 C# 程式碼範例從圖像或 PDF 文件中讀取切諾基語文字。

// Import the IronOcr namespace
using IronOcr;

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

        // Set the language for OCR to Cherokee
        Ocr.Language = OcrLanguage.Cherokee;

        // Use OcrInput to specify the image or PDF to be read
        using (var Input = new OcrInput(@"images\Cherokee.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

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

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

        // Set the language for OCR to Cherokee
        Ocr.Language = OcrLanguage.Cherokee;

        // Use OcrInput to specify the image or PDF to be read
        using (var Input = new OcrInput(@"images\Cherokee.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

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

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

		' Set the language for OCR to Cherokee
		Ocr.Language = OcrLanguage.Cherokee

		' Use OcrInput to specify the image or PDF to be read
		Using Input = New OcrInput("images\Cherokee.png")
			' Perform OCR on the input document
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

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

以下是程式碼運作方式的簡要說明:

  • IronTesseract:建立 IronTesseract 類別的實例來處理 OCR 操作。
  • OcrLanguage.Cherokee:使用OcrLanguage.Cherokee屬性將語言設定為 Cherokee,該屬性告訴 OCR 引擎識別 Cherokee 文字。
  • OcrInput:OcrInput類別提供一個輸入路徑,影像或 PDF 文件就位於該路徑下。
  • Ocr.Read:呼叫 OCR 物件的Read方法,傳入輸入。 它執行OCR識別過程。
  • Result.Text:從結果中提取識別出的文本,並將其儲存在AllText變數中以供進一步使用。 -控制台輸出:辨識出的文字將列印到控制台。