Croatian 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.Croatian 的內容

此套件包含 49 種 .NET OCR 語言支援,包括:

  • 克羅埃西亞語
  • 克羅埃西亞語最佳
  • 克羅埃西亞語Fast

下載

克羅埃西亞語語言套件 [hrvatski jezik]

安裝

第一步是透過 NuGet 將克羅埃西亞語 OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Croatian

程式碼範例

此 C# 程式碼範例用於從圖片或 PDF 文件中讀取克羅埃西亞語文字。

// Add the required namespace for IronOCR
using IronOcr;

class OCRExample
{
    public static void Main()
    {
        // Create a new IronTesseract instance
        var Ocr = new IronTesseract();

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

        // Define the input image or PDF containing Croatian text
        using (var Input = new OcrInput(@"images\Croatian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            System.Co/nsole.WriteLine(AllText);
        }
    }
}
// Add the required namespace for IronOCR
using IronOcr;

class OCRExample
{
    public static void Main()
    {
        // Create a new IronTesseract instance
        var Ocr = new IronTesseract();

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

        // Define the input image or PDF containing Croatian text
        using (var Input = new OcrInput(@"images\Croatian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

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

Class OCRExample
    Public Shared Sub Main()
        ' Create a new IronTesseract instance
        Dim Ocr As New IronTesseract()

        ' Set the OCR language to Croatian
        Ocr.Language = OcrLanguage.Croatian

        ' Define the input image or PDF containing Croatian text
        Using Input As New OcrInput("images\Croatian.png")
            ' Perform OCR on the input
            Dim Result = Ocr.Read(Input)

            ' Extract all recognized text
            Dim AllText = Result.Text

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

說明

  • IronTesseract:這是用於執行 OCR 操作的主要類別。 它能從圖片或 PDF 檔案中讀取文字,並支援多種語言。
  • OcrInput:代表 OCR 的輸入來源,可以是圖片或 PDF 檔案。
  • Ocr.Read:對指定的輸入執行 OCR 處理。
  • Result.Text:包含從輸入資料中擷取的文字,該文字隨後會輸出至控制台。