Macedonian OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
本文件的其他版本:

IronOCR 是一個 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言(包括馬其頓語)的圖片和 PDF 文件中讀取文字。 這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均定期超越其他 Tesseract 引擎。

IronOcr.Languages.Macedonian 的內容

此套件包含 55 種適用於 .NET 的 OCR 語言:

  • 馬其頓語
  • 馬其頓語最佳
  • 馬其頓語Fast

下載

馬其頓語語言套件 [македонски јазик]

安裝

我們首先必須將馬其頓語 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Macedonian

程式碼範例

此 C# 程式碼範例用於從圖片或 PDF 文件中讀取馬其頓語文字。

// Using IronOcr namespace
using IronOcr;

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

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

        // Using OcrInput to load an image
        using (var Input = new OcrInput(@"images\Macedonian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

            // Get the recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Using IronOcr namespace
using IronOcr;

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

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

        // Using OcrInput to load an image
        using (var Input = new OcrInput(@"images\Macedonian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

            // Get the recognized text
            var AllText = Result.Text;

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

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

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

		' Using OcrInput to load an image
		Using Input = New OcrInput("images\Macedonian.png")
			' Perform OCR on the input
			Dim Result = Ocr.Read(Input)

			' Get the recognized text
			Dim AllText = Result.Text

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

說明:

  • IronTesseract:這是 IronOCR程式庫中的一個類別,提供執行 OCR 操作的功能。
  • OcrInput:此類別用於指定需從中擷取文字的圖片或 PDF 檔案。
  • Ocr.Read(): 此方法對指定的輸入執行 OCR 處理,並返回包含識別文字的結果。

若要執行此程式碼,請確保您的專案中已安裝 IronOCR程式庫,並載入馬其頓語語言套件。