Menu

#15 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!

None
closed
None
1
2018-06-05
2018-01-24
No

Hai sir,
i got a error and i went to searching on google for this error but i can't get the solution and also one of my coulge system work fine with this code i am using stable version 3.4.0 and also tired 3.4.3 in windows 8 pc , so please help me sir.,

I wrote this code:
File f= new File("toastedmsg.png");
File tess=LoadLibs.extractTessResources("tessdata");
ITesseract obj=new Tesseract();
obj.setDatapath(tess.getAbsolutePath());
String res=obj.doOCR(f);
System.out.print(res);

    **but i got this error:**

java.lang.Error: Invalid memory access at com.sun.jna.Native.invokePointer(Native Method) at com.sun.jna.Function.invokePointer(Function.java:470) at com.sun.jna.Function.invoke(Function.java:404) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Library$Handler.invoke(Library.java:212) at com.sun.proxy.$Proxy0.TessBaseAPIGetUTF8Text(Unknown Source) at net.sourceforge.tess4j.Tesseract.getOCRText(Unknown Source) at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at boss.Tess4j.main(Tess4j.java:18) Error opening data file C:\Users\Acer\AppData\Local\Temp\tess4j\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!

i also tried to set system variable but no use for this program:
variable name: TESSDATA_PREFIX
variable value: G:\selenium\libs\Tess4J\tessdata\

Discussion

  • Quan Nguyen

    Quan Nguyen - 2018-01-24

    This is a user error, not a library bug, so should be posted in the Discussion forum, not be filed here.

    LoadLibs.extractTessResources("tessdata"); statement only works for Maven build.

    For Maven, it should be obj.setDatapath(tess.getParent());

    TESSDATA_PREFIX should be set to the parent of tessdata folder, in your case: G:\selenium\libs\Tess4J\

     
  • Quan Nguyen

    Quan Nguyen - 2018-01-30
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB