Italian OCR in C# and .NET
Curtis Chau
已更新: 2026年8月2日
本文檔的其他版本:
IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言(包括義大利語)的文字。
它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.Italian 的內容
此軟體包包含 6 種適用於 .NET 的 OCR 語言模式:
- 義大利文
- 義大利文Best
- 義大利文Fast
- 義大利文Old
- 義大利文OldBest
- 義大利文OldFast
下載
義大利語語言包[italiano]
安裝
我們首先需要做的是將義大利語OCR 套件安裝到您的 .NET 專案中。
程式碼範例
此 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
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' 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說明:
- 使用 IronOCR: 已包括
IronOcr程式庫以利用其OCR功能。 - 建立 IronTesseract 實例:
IronTesseract是一個用於OCR處理的核心類別。 - 設定語言: OCR 使用
Ocr.Language = OcrLanguage.Italian設定為處理義大利文。 - 讀取輸入: 創建一個
OcrInput對象,指定圖像文件。 - 執行OCR:
Ocr.Read(Input)在輸入圖像上執行OCR處理,並返回文本結果。 - 輸出: 生成的文本存儲在
AllText中,並顯示在控制台上。
確保images\Italian.png文件路徑正確,該文件存在,以便範例正常工作。
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。