Locating data files when using Tesseract as a library

387 views
Skip to first unread message

Christian Hedin

unread,
Oct 13, 2009, 9:38:35 AM10/13/09
to tesseract-ocr
Hi,

I have compiled Tesseract for iPhone OS and it seems to link and run
fine until I do:

TessBaseAPI::Init(dataPath, NULL, NULL, false, 0, NULL);

According to the API documentation this would use dataPath to locate
the datafiles, right?

Whatever dataPath I use the result is always at runtime:

"Unable to load unicharset file /Users/ciryon/Documents/Coding/
3rdParty-Libraries/iphone-os/share/tessdata/eng.unicharset"

Is this the correct method to specify the data file location (incl the
unicharset file)? If not, how do I specify, dynamically at runtime,
where the files are?

Vodolazov

unread,
Oct 21, 2009, 6:06:35 AM10/21/09
to tesseract-ocr
I had the same problem, and looks like it originates from the fact
that defined TESSDATA_PREFIX macro switches off runtime datapath
definition.
I solved it by compiling with

./configure --prefix=/Users/admin/Projects/OCR/install/ CXXFLAGS=-
UTESSDATA_PREFIX

where -U undefines TESSDATA_PREFIX and something like

_isTesseractEnabled = !(_tessInst.Init("FillipokReader.app/Contents/
share/", "eng"));

works perfectly fine.

This looks like a hack, but I do not know a better way. Maybe this
should be put as a bug request.

On Oct 13, 9:38 pm, Christian Hedin <christian.hedin.jay...@gmail.com>
wrote:
> Hi,
>
> I have compiled Tesseract for iPhone OS and it seems to link and run
> fine until I do:
>
> TessBaseAPI::Init(dataPath, NULL, NULL, false, 0, NULL);
>
> According to the API documentation this would usedataPathto locate
> the datafiles, right?
>
> WhateverdataPathI use the result is always at runtime:

Vodolazov

unread,
Oct 21, 2009, 6:08:22 AM10/21/09
to tesseract-ocr
Compiling with CXXFLAGS=-UTESSDATA_PREFIX solves the problem.

On Oct 13, 9:38 pm, Christian Hedin <christian.hedin.jay...@gmail.com>
wrote:
> Hi,
>
> I have compiled Tesseract for iPhone OS and it seems to link and run
> fine until I do:
>
> TessBaseAPI::Init(dataPath, NULL, NULL, false, 0, NULL);
>
> According to the API documentation this would usedataPathto locate
> the datafiles, right?
>
> WhateverdataPathI use the result is always at runtime:
Reply all
Reply to author
Forward
0 new messages