Converter Imagem em Texto com Numerais Arábicos no IronOCR
Os pacotes de idiomas árabe, persa e urdu não reconhecem numerais arábicos na leitura de texto?
Este é um problema conhecido com os pacotes de idiomas do Tesseract.
O pacote de idiomas a seguir pode ajudar a resolver esse problema com numerais arábicos: Tessdata de Shreeshrii em árabe
Isso pode então ser usado com o recurso IronOCR para carregar pacotes de idiomas personalizados: Exemplo de idioma personalizado do IronOCR
using IronOcr;
class ArabicNumeralOCR
{
static void Main(string[] args)
{
// Initialize a new instance of IronTesseract for OCR
var Ocr = new IronTesseract();
// Load the custom Tesseract language file for better numeral recognition
Ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");
// Specify the image input for OCR processing
using (var Input = new OcrInput(@"images\image.png"))
{
// Execute the OCR process on the input image
var Result = Ocr.Read(Input);
// Output the recognized text
Console.WriteLine(Result.Text);
}
}
}
using IronOcr;
class ArabicNumeralOCR
{
static void Main(string[] args)
{
// Initialize a new instance of IronTesseract for OCR
var Ocr = new IronTesseract();
// Load the custom Tesseract language file for better numeral recognition
Ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");
// Specify the image input for OCR processing
using (var Input = new OcrInput(@"images\image.png"))
{
// Execute the OCR process on the input image
var Result = Ocr.Read(Input);
// Output the recognized text
Console.WriteLine(Result.Text);
}
}
}
Imports IronOcr
Friend Class ArabicNumeralOCR
Shared Sub Main(ByVal args() As String)
' Initialize a new instance of IronTesseract for OCR
Dim Ocr = New IronTesseract()
' Load the custom Tesseract language file for better numeral recognition
Ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata")
' Specify the image input for OCR processing
Using Input = New OcrInput("images\image.png")
' Execute the OCR process on the input image
Dim Result = Ocr.Read(Input)
' Output the recognized text
Console.WriteLine(Result.Text)
End Using
End Sub
End Class
Nota: Este exemplo em C# demonstra como usar um arquivo de idioma Tesseract personalizado no IronOCR para melhorar o reconhecimento de numerais arábicos em imagens. Pressupõe-se que você já tenha baixado o pacote de idiomas apropriado e o colocado no local especificado. Certifique-se de instalar o IronOCR e adicionar o tratamento de erros necessário no código de produção.

