46 {
47 if (std::getenv("TESSDATA_PREFIX") == nullptr) {
48 std::string binary_path = *pArgv[0];
49 const std::string filepath = dirname(&binary_path[0]);
50
51 const std::string tessdata_path = filepath + "/" + "tessdata";
52 if (setenv("TESSDATA_PREFIX", tessdata_path.c_str(), 1) != 0) {
53 printf("Setenv failed\n");
54 std::abort();
55 }
56 }
57
59 if (api->
Init(
nullptr,
"eng") != 0) {
60 printf("Cannot initialize API\n");
61 abort();
62 }
63
64
66
67 return 0;
68}
bool SetVariable(const char *name, const char *value)
int Init(const char *datapath, const char *language, OcrEngineMode mode, char **configs, int configs_size, const std::vector< std::string > *vars_vec, const std::vector< std::string > *vars_values, bool set_only_non_debug_params)