Catalan OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR 是一個 C# 軟體組件,允許 .NET 程式員從圖像和 PDF 文件中讀取 126 種語言的文本,包括加泰羅尼亞語。

它是針對 .NET 開發人員專門開發的一個 Tesseract 的高級分支,在速度和準確性方面經常優於其他 Tesseract 引擎。

IronOcr.Languages.Catalan 的內容

此套件包含 .NET 的46種 OCR 語言:

  • Catalan
  • CatalanBest
  • CatalanFast

下載

加泰羅尼亞語言包 style='white-space:default'>[català]

安裝

我們首先要做的是將我們的 Catalan OCR 包安裝到您的 .NET 項目中。

Install-Package IronOCR.Languages.Catalan

代碼示例

此 C# 代碼示例從圖像或 PDF 文件中讀取加泰羅尼亞語文本。

// Import the IronOcr namespace to use its OCR functionality
using IronOcr;

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

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

        // Define the input image or PDF from which you want to read the text
        using (var Input = new OcrInput(@"images\Catalan.png"))
        {
            // Perform OCR reading on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace to use its OCR functionality
using IronOcr;

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

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

        // Define the input image or PDF from which you want to read the text
        using (var Input = new OcrInput(@"images\Catalan.png"))
        {
            // Perform OCR reading on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace to use its OCR functionality
Imports IronOcr

Friend Class CatalanOcrExample
	Shared Sub Main()
		' Create a new instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

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

		' Define the input image or PDF from which you want to read the text
		Using Input = New OcrInput("images\Catalan.png")
			' Perform OCR reading on the input
			Dim Result = Ocr.Read(Input)

			' Retrieve all recognized text
			Dim AllText = Result.Text

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

在此代碼中:

  • 我們創建 IronTesseract 的實例來處理 OCR 操作。
  • Ocr.Language 被指定為加泰羅尼亞語,表示 OCR 引擎應使用加泰羅尼亞語語言模型處理圖像。
  • 我們使用 OcrInput 指定圖像或 PDF 文件的文件路徑。
  • Ocr 對象上調用 Read 方法,並將 OCR 讀取結果存儲在變量 Result 中。
  • 最後,Result.Text 包含識別的文本,該文本將打印到控制台。