Disabled info and warnings from Tesseract

This commit is contained in:
Evgeny 2016-12-24 10:42:35 +03:00
parent 331a64e387
commit 5e0f9a4898
2 changed files with 25 additions and 7 deletions

View File

@ -215,7 +215,13 @@ struct lib_hardsubx_ctx* _init_hardsubx(struct ccx_s_options *options)
memset(ctx, 0, sizeof(struct lib_hardsubx_ctx));
ctx->tess_handle = TessBaseAPICreate();
if(TessBaseAPIInit3(ctx->tess_handle, NULL, "eng") != 0)
char* pars_vec = strdup("debug_file");
char* pars_values = strdup("/dev/null");
int res = TessBaseAPIInit4(ctx->tess_handle, NULL, "eng", OEM_TESSERACT_ONLY, NULL, 0, &pars_vec,
&pars_values, 1, false);
free(pars_vec);
free(pars_values);
if(res != 0)
{
fatal(EXIT_NOT_ENOUGH_MEMORY, "Not enough memory to initialize Tesseract!");
}

View File

@ -126,12 +126,24 @@ void* init_ocr(int lang_index)
lang_index = 1;
}
if(ccx_options.ocrlang)
ret = TessBaseAPIInit3(ctx->api, NULL, ccx_options.ocrlang);
else if(data_location == 1)
ret = TessBaseAPIInit3(ctx->api, NULL, language[lang_index]);
else
ret = TessBaseAPIInit3(ctx->api, tessdata_dir_path, language[lang_index]);
char* lang = NULL, *tessdata_path = NULL;
if (ccx_options.ocrlang)
lang = ccx_options.ocrlang;
else if (data_location == 1)
lang = language[lang_index];
else {
lang = language[lang_index];
tessdata_path = tessdata_dir_path;
}
char* pars_vec = strdup("debug_file");
char* pars_values = strdup("/dev/null");
ret = TessBaseAPIInit4(ctx->api, tessdata_path, lang, OEM_TESSERACT_ONLY, NULL, 0, &pars_vec,
&pars_values, 1, false);
free(pars_vec);
free(pars_values);
if(ret < 0)
{