Cyrillic Alphabet OCR in C

This article was translated from English: Does it need improvement?
Translated
View the article in English

126 種其他語言

IronOCR 是一個 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言(包括西里爾字母)的圖片和 PDF 文件中讀取文字。

這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或精準度方面,表現均定期優於其他 Tesseract 引擎。

IronOcr.Languages.Cyrillic 的內容

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

  • 西里爾字母
  • 西里爾字母Best
  • 西里爾字母Fast

下載

西里爾字母語言套件 [西里爾文字]

安裝

您首先需要將西里爾字母 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Cyrillic

程式碼範例

此 C# 程式碼範例用於從圖片或 PDF 文件中讀取西里爾字母文字。

using IronOcr;

public class OcrExample
{
    public void ReadCyrillicText()
    {
        // Initialize a new instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Cyrillic language package
        Ocr.Language = OcrLanguage.Cyrillic;

        // Create a new OCR input from an image file
        using (var Input = new OcrInput(@"images\Cyrillic.png"))
        {
            // Read the image using the OCR engine
            var Result = Ocr.Read(Input);

            // Retrieve Recognized Text
            var AllText = Result.Text;

            // Output the recognized text to the console
            Console.WriteLine(AllText);
        }
    }
}
using IronOcr;

public class OcrExample
{
    public void ReadCyrillicText()
    {
        // Initialize a new instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Cyrillic language package
        Ocr.Language = OcrLanguage.Cyrillic;

        // Create a new OCR input from an image file
        using (var Input = new OcrInput(@"images\Cyrillic.png"))
        {
            // Read the image using the OCR engine
            var Result = Ocr.Read(Input);

            // Retrieve Recognized Text
            var AllText = Result.Text;

            // Output the recognized text to the console
            Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Public Class OcrExample
	Public Sub ReadCyrillicText()
		' Initialize a new instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the OCR engine to use the Cyrillic language package
		Ocr.Language = OcrLanguage.Cyrillic

		' Create a new OCR input from an image file
		Using Input = New OcrInput("images\Cyrillic.png")
			' Read the image using the OCR engine
			Dim Result = Ocr.Read(Input)

			' Retrieve Recognized Text
			Dim AllText = Result.Text

			' Output the recognized text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • IronTesseract:這是您用來配置和執行 OCR 任務的 OCR 引擎類別。
  • OcrInput:代表您欲進行 OCR 處理的輸入圖片或文件的類別。
  • OcrLanguage.Cyrillic:指定 OCR 引擎應使用西里爾語語言套件進行辨識。
  • Result.Text:從 OCR 結果物件中取得識別出的文字。

此範例展示了一個簡單的應用案例,其中處理一張含有西里爾文字的圖片以提取文字。