Adriano_jvma
Adriano_jvma

Reputation: 475

Teeseract (Tess4J ocr java with eclipse)Configuration

I have a small question. I try to test a sample exemple .Getting Text from images(scaned text) with OCR (Tess4J) Tesseract java and eclipse.

File imageFile = new File("D:\\HEAD2.png");
                Tesseract instance = Tesseract.getInstance();  // JNA Interface Mapping            
               // Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping

                try {
                    String result = instance.doOCR(imageFile);
                    System.out.println(result);
                } catch (TesseractException e) {
                    System.err.println(e.getMessage());
                }

this is how I configure my application:

1)Download Tess4J the folder that contains (tess4j.jar, folder tessdata, libtesseract302.dll, liblept168.dll)

2) I add the jar in the path of the application 3) I add the other in the current directory of the application

Finally, the example works well. But today ,when I execute this exempble he referred me error

Error opening data file \Application Data\Tesseract-OCR\tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages!

after also download tesseractOCR.exe in C: \ programmeFiles \ TesseractOCR .it works fine But When also delet thisprogramm also works fine ..waht is the role of this this programm

it works fine even without instance.setDatapath("C:\\Program Files\\Tesseract-OCR"); .I don't figure out !!

Upvotes: 3

Views: 6016

Answers (1)

Shimbawa
Shimbawa

Reputation: 262

Try without spaces in your path ? (Application Data)

Do you need libs on disk ? It works well with maven dependencies:

    <dependency>
        <groupId>net.sourceforge.tess4j</groupId>
        <artifactId>tess4j</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.lept4j</groupId>
        <artifactId>lept4j</artifactId>
        <version>1.1.1</version>
    </dependency>

Upvotes: 1

Related Questions