Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No input source set error exception Tess4J

Tags:

java

ocr

tess4j

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..

like image 691
Aleksandar Đokić Avatar asked Apr 09 '26 23:04

Aleksandar Đokić


1 Answers

Your input file location is not a valid , try a valid file location or try testing with local file location.

like image 55
ravthiru Avatar answered Apr 11 '26 13:04

ravthiru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!