Reputation: 2333
I just downloaded Tess4J from http://tess4j.sourceforge.net/ and imported it in netbeans. Code is running but when i enter URL for image and try to convert it i'm getting an error.
My code:
public static void main(String[] args) {
File imageFile = new File("http://www.example.com/example-image.png");
Tesseract instance = Tesseract.getInstance(); //
try {
String result = instance.doOCR(imageFile);
System.out.println(result);
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
}
Output error:
02:51:36.251 [main] ERROR net.sourceforge.tess4j.Tesseract - No input source set!
java.lang.IllegalStateException: No input source set!
java.lang.IllegalStateException: No input source set!
at com.sun.imageio.plugins.png.PNGImageReader.getNumImages(PNGImageReader.java:1347)
at net.sourceforge.tess4j.util.ImageIOHelper.getIIOImageList(ImageIOHelper.java:337)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:212)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:196)
at Testing.main(Testing.java:23)
Anyone else experienced something like this before? I found 3 more similar topics on stackoverflow but they did not help me..
Upvotes: 3
Views: 6944
Reputation: 9623
Your input file location is not a valid , try a valid file location or try testing with local file location.
Upvotes: 5