|
tesseract 3.04.01
|
#include <ccutil.h>
Public Member Functions | |
| CCUtil () | |
| virtual | ~CCUtil () |
| void | main_setup (const char *argv0, const char *basename) |
| CCUtil::main_setup - set location of tessdata and name of image. | |
| ParamsVectors * | params () |
Public Attributes | |
| STRING | datadir |
| STRING | imagebasename |
| STRING | lang |
| STRING | language_data_path_prefix |
| TessdataManager | tessdata_manager |
| UNICHARSET | unicharset |
| UnicharAmbigs | unichar_ambigs |
| STRING | imagefile |
| STRING | directory |
| char * | m_data_sub_dir = "tessdata/" |
| int | ambigs_debug_level = 0 |
| bool | use_definite_ambigs_for_classifier = 0 |
| bool | use_ambigs_for_adaption = 0 |
Definition at line 8 of file ccutil.cpp.
{
}
| tesseract::CCUtil::~CCUtil | ( | ) | [virtual] |
Definition at line 24 of file ccutil.cpp.
| void tesseract::CCUtil::main_setup | ( | const char * | argv0, |
| const char * | basename | ||
| ) |
CCUtil::main_setup - set location of tessdata and name of image.
| argv0 | - paths to the directory with language files and config files. An actual value of argv0 is used if not NULL, otherwise TESSDATA_PREFIX is used if not NULL, next try to use compiled in -DTESSDATA_PREFIX. If previous is not successful - use current directory. |
| basename | - name of image |
< name of image
< data directory
Definition at line 53 of file mainblk.cpp.
{
imagebasename = basename;
char *tessdata_prefix = getenv("TESSDATA_PREFIX");
if (argv0 != NULL) {
/* Use tessdata prefix from the command line. */
datadir = argv0;
} else if (tessdata_prefix) {
/* Use tessdata prefix from the environment. */
datadir = tessdata_prefix;
#if defined(_WIN32)
} else if (datadir == NULL || access(datadir.string(), 0) != 0) {
/* Look for tessdata in directory of executable. */
static char dir[128];
static char exe[128];
DWORD length = GetModuleFileName(NULL, exe, sizeof(exe));
if (length > 0 && length < sizeof(exe)) {
_splitpath(exe, NULL, dir, NULL, NULL);
datadir = dir;
}
#endif /* _WIN32 */
#if defined(TESSDATA_PREFIX)
} else {
/* Use tessdata prefix which was compiled in. */
#define _STR(a) #a
#define _XSTR(a) _STR(a)
datadir = _XSTR(TESSDATA_PREFIX);
#undef _XSTR
#undef _STR
#endif
}
// datadir may still be empty:
if (datadir.length() == 0) {
datadir = "./";
} else {
// Remove tessdata from the end if present, as we will add it back!
int length = datadir.length();
if (length >= 8 && strcmp(&datadir[length - 8], "tessdata") == 0)
datadir.truncate_at(length - 8);
else if (length >= 9 && strcmp(&datadir[length - 9], "tessdata/") == 0)
datadir.truncate_at(length - 9);
}
// check for missing directory separator
const char *lastchar = datadir.string();
lastchar += datadir.length() - 1;
if ((strcmp(lastchar, "/") != 0) && (strcmp(lastchar, "\\") != 0))
datadir += "/";
datadir += m_data_sub_dir;
}
| ParamsVectors* tesseract::CCUtil::params | ( | ) | [inline] |
| char* tesseract::CCUtil::m_data_sub_dir = "tessdata/" |