OCR ruso en C# y .NET
Other versions of this document:
IronOCR es un componente de software C# que permite a los desarrolladores .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el ruso.
Es una bifurcación avanzada de Tesseract, creada exclusivamente para desarrolladores de .NET y supera regularmente a otros motores de Tesseract tanto en velocidad como en precisión.
Contenido de IronOcr.Languages.Russian
Este paquete contiene 46 idiomas OCR para .NET:
- Ruso
- RusoBest
- RusoFast
Descargar
Paquete de idioma ruso [русский язык]
Instalación
Lo primero que tenemos que hacer es instalar nuestro paquete de OCR ruso en su proyecto .NET.
Install-Package IronOCR.Languages.Russian
Ejemplo de código
Este ejemplo de código C# lee texto ruso de una imagen o documento PDF.
// Import the IronOCR namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize IronTesseract, an OCR object
var Ocr = new IronTesseract();
// Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian;
// Create an OCR input for the Russian image
using (var Input = new OcrInput(@"images\Russian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all the recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}// Import the IronOCR namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize IronTesseract, an OCR object
var Ocr = new IronTesseract();
// Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian;
// Create an OCR input for the Russian image
using (var Input = new OcrInput(@"images\Russian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all the recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}' Import the IronOCR namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Initialize IronTesseract, an OCR object
Dim Ocr = New IronTesseract()
' Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian
' Create an OCR input for the Russian image
Using Input = New OcrInput("images\Russian.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all the recognized text
Dim AllText = Result.Text
' Output the recognized text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class- El código anterior importa la biblioteca necesaria de IronOCR e inicializa
IronTesseract, una clase usada para realizar tareas de OCR. - Configura el idioma para la OCR en ruso usando
Ocr.Language = OcrLanguage.Russian. - Luego, abre el archivo de imagen especificado
Russian.pngusando la claseOcrInput. - El método
Readdel objetoOcrse utiliza para procesar la imagen y reconocer el texto, - Finalmente, extrae el texto reconocido de
Result.Texty lo muestra.





