Spanish OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C#, który pozwala programistom .NET czytać tekst z obrazów i dokumentów PDF w 126 językach, w tym po hiszpańsku.
Jest to zaawansowany fork Tesseracta, zbudowany wyłącznie dla deweloperów .NET i regularnie przewyższający inne silniki Tesseract pod względem szybkości i dokładności.
Zawartość IronOcr.Languages.Spanish
Ta paczka zawiera kilka opcji językowych OCR dla .NET:
- Spanish
- SpanishBest
- SpanishFast
- SpanishOld
- SpanishOldBest
- SpanishOldFast
Pobieranie
Spanish Language Pack [español]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie pakietu Spanish OCR w Twoim projekcie .NET.
Install-Package IronOcr.Languages.Spanish
Przyklad kodu
Ten przykład kodu C# odczytuje tekst hiszpański z obrazu lub dokumentu 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
Powyższy kod pokazuje, jak korzystać z biblioteki IronOCR, aby odczytywać i wydobywać tekst hiszpański z pliku graficznego o nazwie Spanish.png. Upewnij się, że dodasz niezbędne przestrzenie nazw i odpowiednio obsługujesz zasoby w ramach bloków using, gdzie to konieczne.

