We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

What is Resource.zip file used in OCR

what is resource.zip file in OCR - java

Hi Krishnaram,


Thank you for considering Aspose APIs.

The file Resouce.zip contains all the additional resources required for the OCR operation. Please download the latest resources, and we also suggest you to use the latest version of Aspose.OCR for .NET 2.0.0 API for your testing.

Please feel free to contact us back in case you face any difficulty.

I tried to read a text from a simple JPG/bmp file using Aspose.OCR for Java 2.0.0 and it is not working

The image given with the source code is working properly but when I change the image it is not working.
Please kindly suggest a solution.
Attaching the images I tried.

Result I got is "vFcv mane fEM`

source code

/*
* Copyright 2001-2013 Aspose Pty Ltd. All Rights Reserved.
*
* This file is part of Aspose.OCR. The source code in this file
* is only intended as a supplement to the documentation, and is provided
* “as is”, without warranty of any kind, either expressed or implied.
/

package programmersguide.workingwithocr.performocronimage.java;

import com.aspose.ocr.;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;

public class PerformOCROnImage
{
public static void main(String[] args) throws Exception
{
// The path to the documents directory.
String dataDir = “C:/Ram/Test/image/”;

/// Set the paths
String imagePath = dataDir+ “sample.png”;
String resourcesFolderPath = dataDir+ “resource.zip”;

// Create an instance of OcrEngine
OcrEngine ocr = new OcrEngine();
// Set Resources for OcrEngine
ocr.setResource(new FileInputStream(resourcesFolderPath));

// 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();
}

}


}




Hi Krishnaram,


Thank you for writing back.

We have evaluated your presented scenario against the latest version of Aspose.OCR for Java 2.0.0 and your provided sample to receive the similar results. There are two most probable reasons for such results so you must take account of the following.

  • Aspose.OCR APIs works well with images having better resolution, where recommended resolution is 300 DPI.
  • The current implementation of the Aspose.OCR APIs support limited set of font families such as Arial, Times New Roman, Courier New, Tahoma, Calibri and Verdana.

In order to work the same sample, we would request you to please first try by saving the same image in higher resolution.