Divehi OCR in C# and .NET

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的內容。語言。 Divehi

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

迪維希 迪維希Best 迪維希Fast

下載

迪維希語包[月曆法優]

下載為Zip 檔案

安裝

我們需要做的第一件事是將Divehi OCR 套件安裝到您的.NET專案中。

Install-Package IronOcr.Languages.Divehi

程式碼範例

此 C# 程式碼範例從圖像或 PDF 文件中讀取迪維希語文字。

// Import the IronOcr namespace
using IronOcr;

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

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

        // Load the image or PDF document into the OCR processor
        using (var Input = new OcrInput(@"images\Divehi.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

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

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

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

        // Load the image or PDF document into the OCR processor
        using (var Input = new OcrInput(@"images\Divehi.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
$vbLabelText   $csharpLabel

解釋

-導入IronOCR :範例首先導入必要的IronOCR命名空間。 -建立 OCR 引擎:建立 OCR 引擎 IronTesseract 的實例。 -指定語言:OCR 處理的語言設定為迪維希語,確保針對該語言進行準確識別。 -載入輸入:使用 OcrInput 開啟影像或 PDF 文檔,準備擷取文字。 -執行 OCRRead 方法處理輸入並提取文字。 -文字擷取:辨識出的文字儲存在 AllText 中,並列印到控制台。

這段程式碼展示了一種簡單而強大的方法,利用IronOCR從數位文件中讀取迪維希文字。