gali8 / Tesseract-OCR-iOS

Tesseract OCR iOS is a Framework for iOS7+, compiled also for armv7s and arm64.
http://www.nexor.it
MIT License
4.22k stars 949 forks source link

tessdata not found when running tests #338

Open sebmos opened 7 years ago

sebmos commented 7 years ago

I'm working on a simple test suite to be able to improve my tesseract configuration, but am having trouble running those tests. Whenever G8Tesseract gets initialised, I get the following log messages:

Error opening data file /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/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!

The app itself works just fine. It's using the same code & language as the tests (only one place initializes G8Tesseract, language is hard-coded.) I'm on XCode 9 beta 5 & used the XCode 9-specific steps as outlined in the Installation wiki page. I'm embedding TesseractOCRiOS 4.0.0 through Cocoapods.

I added tessdata to the "Copy Bundle Resources" build phase on the test target, and checked the target membership checkbox in the File Inspector.

Any idea what I could be doing wrong/how I could debug this?

Rufy86 commented 7 years ago

I've the same problem. I'm trying to use Tesseract in a project added with cocoa pods. The project is created with Xcode 9 GM. I've follow the steps Witten in Install section of Wiki. but the problem still.

after that, in the tessdata folder which file is right to add? I'm doing this question because in the tesslang folder of tesseract there are two folders: one best and one normal(?). which is better to add to the tessdata folder?

benediktveith commented 7 years ago

I´ve had the same error as you @sebmos . It was because XCode 9 didn´t created the referenced folder correctly. My solution was to open the project in XCode 8 , create the reference folder, close XCode 8 and finally open the project in XCode 9. After that it worked.

Hope it helps you :)

giann commented 7 years ago

Where exactly should the tessdata folder be ? Wiki says root of project and then same level as AppDelegate (but mine is not at the root). Also, in a workspace, what is the root ? Is it just below the workspace item or inside the project group ? ... Tried a lot of combination and tessdata is still not found. And yes I added it as a reference folder. Also I'm on xcode 9.

RolfHR commented 7 years ago

Can you get it to work if you add it to copy bundle resources under build phases?