OCR do alfabeto cirílico em C#
O IronOCR é um componente de software C# que permite aos programadores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o alfabeto cirílico.
Trata-se de uma versão avançada do Tesseract, criada exclusivamente para desenvolvedores .NET e que supera regularmente outros mecanismos do Tesseract em termos de velocidade e precisão.
Conteúdo de IronOcr.Languages.Cyrillic
Este pacote contém 73 idiomas de OCR para .NET:
- CyrillicAlphabet
- CyrillicAlphabetBest
- CyrillicAlphabetFast
Baixar
Pacote de idioma do alfabeto cirílico [escritas cirílicas]
Instalação
A primeira coisa que você precisa fazer é instalar o pacote de OCR do alfabeto cirílico no seu projeto .NET.
Exemplo de código
Este exemplo de código C# lê texto em alfabeto cirílico de uma imagem ou documento PDF.
using IronOcr;
public class OcrExample
{
public void ReadCyrillicText()
{
// Initialize a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Cyrillic language package
Ocr.Language = OcrLanguage.Cyrillic;
// Create a new OCR input from an image file
using (var Input = new OcrInput(@"images\Cyrillic.png"))
{
// Read the image using the OCR engine
var Result = Ocr.Read(Input);
// Retrieve Recognized Text
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}Imports IronOcr
Public Class OcrExample
Public Sub ReadCyrillicText()
' Initialize a new instance of the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR engine to use the Cyrillic language package
Ocr.Language = OcrLanguage.Cyrillic
' Create a new OCR input from an image file
Using Input = New OcrInput("images\Cyrillic.png")
' Read the image using the OCR engine
Dim Result = Ocr.Read(Input)
' Retrieve Recognized Text
Dim AllText = Result.Text
' Output the recognized text to the console
Console.WriteLine(AllText)
End Using
End Sub
End ClassImports IronOcr
Public Class OcrExample
Public Sub ReadCyrillicText()
' Initialize a new instance of the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR engine to use the Cyrillic language package
Ocr.Language = OcrLanguage.Cyrillic
' Create a new OCR input from an image file
Using Input = New OcrInput("images\Cyrillic.png")
' Read the image using the OCR engine
Dim Result = Ocr.Read(Input)
' Retrieve Recognized Text
Dim AllText = Result.Text
' Output the recognized text to the console
Console.WriteLine(AllText)
End Using
End Sub
End ClassIronTesseract: Esta é a classe do mecanismo de OCR que você usa para configurar e executar tarefas de OCR.OcrInput: Uma classe que representa a imagem ou documento de entrada no qual você deseja realizar OCR.OcrLanguage.Cyrillic: Especifica que o mecanismo de OCR deve usar o pacote de idioma cirílico para reconhecimento.Result.Text: Acessa o texto reconhecido a partir do objeto de resultado do OCR.
Este exemplo demonstra um caso de uso simples onde uma imagem com texto cirílico é processada para extrair o texto.
Curtis Chau é bacharel em Ciência da Computação (Universidade Carleton) e se especializa em desenvolvimento front-end, com experiência em Node.js, TypeScript, JavaScript e React. Apaixonado por criar interfaces de usuário intuitivas e esteticamente agradáveis, Curtis gosta de trabalhar com frameworks modernos e criar manuais bem estruturados e visualmente atraentes.