Reputation: 475
I'm starting to Asprise Java technology. I would like to use a method that converts an image to a text (OCR).
import com.asprise.util.ocr.OCR;
public class Test {
public static void main(String[] args) throws IOException {
BufferedImage image = ImageIO.read(new File("D:\\HEAD2.png"));
String s = new OCR().recognizeEverything(image);
// prints the results.
System.out.println("RESULTS: \n"+ s);
}
}
but I find these errors
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINDOWS\system32\AspriseOCR.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.asprise.util.ocr.OCR.loadLibrary(OCR.java:247)
at com.asprise.util.ocr.OCR.<init>(OCR.java:56)
I download the file Asprise OCR-Java-4.0 Windows_XP_32bit
I add the aspriseOCR.jar file in my eclipse project librairy
I also add AspriseOCR.dll file as C:. \ WINDOWS \ system32 but nothing happens .. thank you to help me
Upvotes: 4
Views: 5659
Reputation: 354
It seems you are using version 4.
To fix your error:
Download the newer version (version 5) of Asprise OCR SDK Library API for Java
Add the single jar file aocr.jar to your classpath.
That's it.
I've upgraded your code in your post to this new version:
import com.asprise.ocr.Ocr
...
public class Test {
public static void main(String[] args) throws IOException {
Ocr.setUp(); // one time setup
Ocr ocr = new Ocr(); // create a new OCR engine
ocr.startEngine("eng", Ocr.SPEED_FASTEST); // English
String s = ocr.recognize(new File[] {new File("D:\\HEAD2.png")},
Ocr.RECOGNIZE_TYPE_ALL, Ocr.OUTPUT_FORMAT_PLAINTEXT);
System.out.println("Result: " + s);
ocr.stopEngine();
}
}
There is no dependency DLL in this new version.
Upvotes: 3