I tried to extract the texts from an image using Aspose OCR library. The image was an Identification Card, however Aspose was not able to read it correctly.
Here’s my code:
String imagePath = “id.jpg”;
String etalonFile = “englishStandarts.xml”;
String fontFile = “arialAndTimesAndCourierRegular.xml”;
String resourcePath = “resources.zip”;
OcrEngine ocr = new OcrEngine(resourcePath, new int[] {4, 5, 6, 7 }, etalonFile, fontFile);
ocr.getConfig().setNeedRotationCorrection(true);
File image = new File(imagePath);
ocr.setImage(image);
ILanguage language = Language.load(“english”);
ocr.getLanguages().addLanguage(language);
try{
if(ocr.process()){
System.out.println("HEY: "+ocr.getText());
}
}catch(Exception e){
System.err.println(e);
}
Instead of returning texts, it returns something like this:
HEY: 2hs!\l!+iIi!}!!i\ii1i!*!!i=!!\i~\!!-\!i+(!!\1!!
Here’s the link of the image: https://farm8.staticflickr.com/7098/7221631472_dd133f1a1d_m.jpg