Hi,
I have trying to read text from an image using ocr.getText(), but i am getting below exception :
com.aspose.ocr.OcrException: Error occurred during recognition.
Could you please explain why this exception occurs?And also is it mandatory to set “setResource”? if so what argument should be passed in setResource? whether we should give existing folder and file name?
Thanks in Advance
Hi Aruna,
Thank you for using Aspose products, and welcome to Aspose.OCR support forum.
The exception “OcrException: Error occurred during recognition.” may occur due to several reasons. Two of the major reasons are as follow,
- You are not setting the resources in your application. Please note, the resources (available as zip archive) contains the data necessary to perform OCR whereas the said data comprises of XML Etalon and font collection files. It is mandatory to set the resources in your application before calling the OcrEngine.process method. Resources can be set using the OcrEngine.setResource method that accepts an instance of FileInputStream. For better elaboration please check the detailed article on how to perform OCR operation on an image.
- Second reason could be due to the unavailability of required fonts on the machine where OCR operation has to be performed. This scenario may occur when Aspose.OCR for Java is used on Unix/Linux environments which do not come with TrueType fonts by default. If this could be the reason then please go through the article explaining
how to install Microsoft TrueType fonts
.
In case above discussion does not help in your scenario then please share the sample image along with your environment details for further investigation.