I’m using Visual Studio 2017. When trying to extract the text from any of the sample images, OCR returns nothing.
Dim L As New Aspose.OCR.License
L.SetLicense(My.Application.Info.DirectoryPath & “\Aspose.Total.lic”)
Dim OCREng As New Aspose.OCR.OcrEngine
'OCR.Image = Aspose.OCR.ImageStream.FromStream(mem, Aspose.OCR.ImageStreamFormat.Bmp)
OCREng.Image = Aspose.OCR.ImageStream.FromFile("C:\Users\Peter.ZABY\Desktop\Aspose.OCR-for-.NET-master\Examples\Data\OCR\Sample.bmp")
If OCREng.Process() Then
Dim ret As String = OCREng.Text.ToString
End If
We have tried to reproduce the issue at our end. We have found no issue, the code executed successfully. Sample code snippet and input image is attached for your reference.
CODE:
var sb = new StringBuilder();
OcrEngine ocrEngine = new OcrEngine();
ocrEngine.Image = ImageStream.FromFile(@"E:\Ctrash\Input\Sample.bmp");
//ocrEngine.Config.DoSpellingCorrection = true;
//ocrEngine.Config.ProcessColoredBackground = true;
if (ocrEngine.Process())
{
sb.Append(ocrEngine.Text);
sb.Append(Environment.NewLine);
}
Console.WriteLine(sb);