Free Support Forum - aspose.com

How to extract text from image?

I tried extracting text from an image but the accuracy of result is not good. Is there a way to extract text from images accurately?

AsposeOCR asposeOCR = new AsposeOCR();
ArrayList rectArray = new ArrayList();
rectArray.add(new Rectangle(50, 50, 350, 350));
String text = asposeOCR.RecognizePage(“excel-invoice-template.png”, rectArray);
System.out.println("Text using AsposeOCR " + text);

Input file : excel-invoice-template.png (16.5 KB)

Obtained result : ObtainedResult.zip (208 Bytes)

@Sathiya22

We have logged an issue as OCRJAVA-102 in our issue tracking system for the sake of further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thanks for your support.

I would like to clarify my other doubt. Does AsposeOCR require a dependency called “onnxruntime” ?
I get this exception when using asposeOCR

Exception in thread “main” java.lang.NoClassDefFoundError: ai/onnxruntime/OrtException
Caused by: java.lang.ClassNotFoundException: ai.onnxruntime.OrtException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

Can you please give the official website link to download onnxruntime?
Thanks

@Sathiya22

Yes, your understanding is correct. Aspose.OCR has dependency upon onnxruntime. Please include following dependency in your pom.xml file and all necessary JARs would be installed accordingly:

<dependency>
 <groupId>com.aspose</groupId>
 <artifactId>aspose-ocr</artifactId>
 <version>21.1</version>
</dependency>

OR you can download the JARs from here.

Thanks for the clarification

@Sathiya22

It is to update you that we are working on improving the recognition quality in cases like one in the logged issue. Some improvements will be available in 21.2 release that will be published next week.
Currently, we are unable to provide accurate results for the Invoice images. The only way to recognize such images is to specify text areas manually. We are working on new table processing and document structure recognition tools that we plan to release later this year.