Spanish 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.Spanish 內容
此套件包含數種適用於 .NET 的 OCR 語言選項:
- 西班牙文
- 西班牙文Best
- 西班牙文Fast
- 西班牙語舊版
- 西班牙語舊版Best
- 西班牙語舊版Fast
下載
西班牙語語言套件 [español]
安裝
我們首先必須將西班牙文 OCR 套件安裝至您的 .NET 專案中。
Install-Package IronOcr.Languages.Spanish
程式碼範例
此 C# 程式碼範例會從圖片或 PDF 文件中讀取西班牙文內容。
// Import the IronOcr namespace
using IronOcr;
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Spanish
Ocr.Language = OcrLanguage.Spanish;
// Use a using block to manage the OcrInput resource
using (var Input = new OcrInput(@"images\Spanish.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all text from the OCR result
var AllText = Result.Text;
// The 'AllText' variable now contains the Spanish text
}
// Import the IronOcr namespace
using IronOcr;
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Spanish
Ocr.Language = OcrLanguage.Spanish;
// Use a using block to manage the OcrInput resource
using (var Input = new OcrInput(@"images\Spanish.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all text from the OCR result
var AllText = Result.Text;
// The 'AllText' variable now contains the Spanish text
}
' Import the IronOcr namespace
Imports IronOcr
' Create a new instance of the IronTesseract class
Private Ocr = New IronTesseract()
' Set the OCR language to Spanish
Ocr.Language = OcrLanguage.Spanish
' Use a using block to manage the OcrInput resource
Using Input = New OcrInput("images\Spanish.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all text from the OCR result
Dim AllText = Result.Text
' The 'AllText' variable now contains the Spanish text
End Using
$vbLabelText
$csharpLabel
上述程式碼示範了如何利用 IronOCR程式庫,從名為 Spanish.png 的圖像檔案中讀取並擷取西班牙文文字。 請務必包含必要的命名空間,並在必要時於 using 區塊中妥善處理資源。

