Aspose OCR Text Extract

package com.ocr;
import java.io.FileInputStream;
import java.io.IOException;

import com.aspose.ocr.AsposeLicenseException;
import com.aspose.ocr.ILanguage;
import com.aspose.ocr.ImageStream;
import com.aspose.ocr.Language;
import com.aspose.ocr.License;
import com.aspose.ocr.OcrEngine;
import com.aspose.ocr.RecognitionBlock;

public class AsposeOCRDemo {
public static String myDir = "c:/temp/";

public static void main(String args[]) throws IOException{
// Instantiate an instance of license and set the license file through its path
License license = new License();
try {
license.setLicense("/OCR/Aspose.OCR.lic");
} catch (AsposeLicenseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
// Set the paths
String imagePath = "/OCR/Sample.png";

// I Just changed the Resource file name to AsposeResources.zip
String resourcesFolderPath = "/OCR/AsposeResources.zip";

// Create an instance of OcrEngine
OcrEngine ocr = new OcrEngine();
// Set Resources for OcrEngine
ocr.setResource(new FileInputStream(resourcesFolderPath));
// Set NeedRotationCorrection property to false
//ocr.getConfig().setNeedRotationCorrection(false);

// Set image file
ocr.setImage(ImageStream.fromFile(imagePath));

// Add language
ILanguage language = Language.load("English");
ocr.getLanguages().addLanguage(language);

// Perform OCR and get extracted text
try {
if (ocr.process()) {
System.out.println("\ranswer -> " + ocr.getText());
}
} catch (Exception e) {
e.printStackTrace();
}
}catch(Exception e){
e.printStackTrace();
}
}
}


I tried to convert this PNG and iam getting the value converted to : answer -> naullowan

Let me know why this issue is happening, i got the Temp license also applied to the same

More information on:


Aspose OCR 2.0 and the appropriate Resource File

Let me know if there are any updates on the same

Hi Ravikumar,


Thank you for contacting Aspose support.

We have thoroughly evaluated your presented scenario while using the latest version of Aspose.OCR for Java 2.0.0, and we are unable to get the correct results from your provided sample image. Please note, the recommended resolution for an image (on which OCR operation has to be performed) is 300 DPI. Unfortunately, changing the resolution of your provided image from 96 to 300 DPI didn’t produce desired results. In order to further investigate the matter, and to provide a fix, we have logged the problem in our bug tracking system under the ticket OCR-33825. Please spare us little time to properly investigate the problem cause on our end. In the meanwhile, we will keep you posted with updates in this regard.

Hi I tried with some other sample Images also with 300 DPI with 30 PT Font, still it’s not working properly


Will there be any change in the Java API based on Images, Irrespective of Image, the OCR API should give accurate results right???

Can you confirm on the same?

Adding the Image File i have tried also here…

Please let me know if there is any resolution for the same

Hi Ravikumar,


Thank you for writing back.

We have evaluated your recently provided image against the latest build of Aspose.OCR for Java 2.0.0, and we have received the garbage data. We are still looking into it by tweaking the configurations to extract a more reliable data. Anyway, the resolution of this image is 96DPI, that is not recommended for OCR operation at the moment. Please also share other images (of 300DPI with 30pt font size) that you have mentioned in you post. We will look into them for further investigation & correction purposes.

Regarding your other question, the OcrEngine can reliably extract text from image having 300DPI resolution with at least 16pt font size. Moreover, there are limitation regarding the font type, for instance Aspose.OCR for Java can recognize Ariel, Times New Roman, Tahoma, Calibri & Verdana whereas other fonts are not supported at the moment.

Please let me know if my understanding of your inquiry is incorrect.

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