OCREngine hanging when process method is called. Version 2.2

I am trying to call the OcrEngine component and the code is hanging on the Process method.


static void Main(string[] args)
{
var license = new License();
license.SetLicense(“Aspose.Total.lic”);
var ocrEngine = new OcrEngine();
ocrEngine.Image = ImageStream.FromFile(@“images\SampleImage.tif”);
ocrEngine.Config.RemoveNonText = true;
var result = ocrEngine.Process();
var text = ocrEngine.Pages[0].PageText;
}

The call succeeded for the first 5 times but returned garbled ocr text. It took about 30 seconds per page. I am using the 2.2 version. I am also not sure if I need to set the english language and/or set the resources property (which no longer seems to exist in version 2.2)

Any ideas?


I am trying to call the OcrEngine component and the code is hanging on the Process method.


static void Main(string[] args)
{
var license = new License();
license.SetLicense(“Aspose.Total.lic”);
var ocrEngine = new OcrEngine();
ocrEngine.Image = ImageStream.FromFile(@“images\SampleImage.tif”);
ocrEngine.Config.RemoveNonText = true;
var result = ocrEngine.Process();
var text = ocrEngine.Pages[0].PageText;
}

The call succeeded for the first 5 times but returned garbled ocr text. It took about 30 seconds per page. I am using the 2.2 version. I am also not sure if I need to set the english language and/or set the resources property (which no longer seems to exist in version 2.2)

Any ideas?

Hi Kevin,


Thank you for contacting Aspose support.

Since the release of Aspose.OCR for .NET 2.2.0, you do not need to set the language as well as the resource property. The aforesaid release has embedded the resources to perform the OCR operation for English language (default language) into the Aspose.OCR assembly.

Your code is correct as we have evaluated the case with a few sample images of our own. Unfortunately, we are unable to observe the said problem. We suspect that the problem could be more related to the sample itself, therefore we would request you to please share the sample image for further investigation.

I attached 3 files

1) 12345.tif - 300 dpi test file

2) OCR - Exception .jpg - VisualStudio Exception Watch - Index out of bounds when calling Process method

3) OCR - Exception 2.jpg - Visual Studio Exception

I am wondering if I should start using an older version?

Hi Kevin,


Thank you for providing the sample image. By checking the provided screenshots, we have noticed that you are setting the OcrConfig.Whitelist property that is causing the IndexOutOfRange error for some unknown reason. We have logged this problem in our bug tracking system under the ticket OCR-33918 for further investigation and correction purposes. Please spare us little time to properly analyze the scenario to isolate the problem cause. In the meanwhile, we will keep you posted with updates in this regard.

Please note, if you do not set the aforesaid property, you can avoid the exception and the process will not hang as well, so you do not need to downgrade the API version for this reason.

I removed the Whitelist setting and it did not crash. Unfortunately, it took 20 seconds to process a 300 dpi image that has only 5 upper case test words on it. It got a poor text result as well. See the attachment. I am surely doing something wrong. Any suggestions would be greatly appreciated.

Hi Kevin,


We have logged the problem of poor recognition results in our bug tracking system under the ticket OCR-33921 for further investigation. Please allow us some time to properly analyze the scenario to isolate the problem cause, and to provide the fix at earliest possible. In the meanwhile, we will keep you posted with updates in this regard.

The issues you have found earlier (filed as OCR-33921;OCR-33918) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.