Problem using the Tess4J OCR, i try to work on a screenshot .jpeg

233 Views Asked by At
ITesseract instance = new Tesseract();  

try {
        BufferedImage img = null;
        img = ImageIO.read(new File("C:\\Users\\nicol\\eclipse-workspace2\\Read\\images\\text.jpeg"));
        instance.setDatapath("C:\\Users\\nicol\\eclipse-workspace2\\Read\\tessdata");
        String result = instance.doOCR(img);
        System.out.println(result);}
        catch(TesseractException e){
             e.printStackTrace();
             
        }
            
        }
       

}

And here i have the output :

00:27:23.450 [main] ERROR net.sourceforge.tess4j.Tesseract - Input not set! java.lang.IllegalStateException: Input not set! at [email protected]/com.github.jaiimageio.impl.plugins.tiff.TIFFImageReader.getNumImages(TIFFImageReader.java:259) at [email protected]/net.sourceforge.tess4j.util.ImageIOHelper.getIIOImageList(Unknown Source) at [email protected]/net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at [email protected]/net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at read.test.main(test.java:18)

I've made sure the file path is correct like i could have seen in some other posts (1st time stackoverflowing, sorry of the editioning that might not be correct)

0

There are 0 best solutions below