0
votes

I try to train language for tesseract. I'm using Tess4J for OCR process. I use jTessBoxEditor and SerakTesseractTrainer for training operation. After I prepare my traindata, I put it at Tesseract/tessdata and Tess4j/tessdata folder.

Then, I set new language like this:

    Tesseract tesseract = new Tesseract();
    tesseract.setLanguage("custom");

After I execute program, I get this error:

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

I check my folders; custom.traineddata is in tess4j/tessdata and tesseract/tessdata folder. I have other languages that are working fine. I don't know why it can't find new language data? I appreciate any help.

1
Please do not edit your question to add an answer, actually add an answer by answering your own question. - Rob Murray
If your problem solve kindly add answer or delete your question. - Nimit Parekh
I add an answer and remove edit part from my question. - bodoroman

1 Answers

1
votes

I solved the issue:

I have to add custom.traineddata to myproject/tessdata folder. After adding, it works.