Italian 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.Italian 內容
此套件包含 6 種適用於 .NET 的 OCR 語言模式:
- 義大利文
- 義大利文Best
- 義大利文Fast
- 義大利文舊版
- 義大利文舊版Best
- 義大利文舊版Fast
下載
義大利語語言套件 [italiano]
安裝
我們首先必須將義大利文 OCR 套件安裝至您的 .NET 專案中。
Install-Package IronOcr.Languages.Italian
程式碼範例
此 C# 程式碼範例用於從圖片或 PDF 文件中讀取義大利文內容。
// Include IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian;
// Read text from an image file
using (var Input = new OcrInput(@"images\Italian.png"))
{
// Perform OCR to get the text content from the image
var Result = Ocr.Read(Input);
// Get and print all the recognized text
var AllText = Result.Text;
Console.WriteLine(AllText);
}
}
}
// Include IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian;
// Read text from an image file
using (var Input = new OcrInput(@"images\Italian.png"))
{
// Perform OCR to get the text content from the image
var Result = Ocr.Read(Input);
// Get and print all the recognized text
var AllText = Result.Text;
Console.WriteLine(AllText);
}
}
}
' Include IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian
' Read text from an image file
Using Input = New OcrInput("images\Italian.png")
' Perform OCR to get the text content from the image
Dim Result = Ocr.Read(Input)
' Get and print all the recognized text
Dim AllText = Result.Text
Console.WriteLine(AllText)
End Using
End Sub
End Class
$vbLabelText
$csharpLabel
說明:
- 使用 IronOCR:已包含
IronOcr程式庫以利用其 OCR 功能。 - 建立 IronTesseract 實例:
IronTesseract是一個用於 OCR 處理的核心類別。 - 語言設定:OCR 已設定使用
Ocr.Language = OcrLanguage.Italian處理義大利語。 - 讀取輸入:建立一個
OcrInput物件來指定圖片檔案。 - 執行 OCR:
Ocr.Read(Input)對輸入的影像執行 OCR 處理,並返回文字結果。 - 輸出:生成的文字儲存於
AllText並顯示於控制台。
請確保 images\Italian.png 的檔案路徑正確,且該檔案確實存在,以確保範例能正常運作。

