1
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 jai.imageio.core@1.4.0/com.github.jaiimageio.impl.plugins.tiff.TIFFImageReader.getNumImages(TIFFImageReader.java:259) at tess4j@3.4.8/net.sourceforge.tess4j.util.ImageIOHelper.getIIOImageList(Unknown Source) at tess4j@3.4.8/net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at tess4j@3.4.8/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)

nicolajava
  • 11
  • 1
  • "Input not set!" indicates the engine cannot locate the specified input file. You'd want to verify the file existence first: `if (aFile.exists()) {...}` – nguyenq Dec 30 '21 at 00:49
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 31 '21 at 02:45

0 Answers0