I am statically linking to the Tesseract OCR engine on Windows from a command line program written in C++. I would like to initialize Tesseract such that if it is not a Debug build Tesseract does not output text to the console window.
There is an existing question about running the tesseract command line program (not using it as a library) in quiet mode on Linux, link, with an answer stating that what you need to do is set the variable "debug_file" to "/dev/null" which clearly only makes sense on Linux but implies that the idea is to pipe Tesseract's verbosity to a log file. But even setting this variable to an arbitrary file does nothing under Windows. Below I try to do it at initialization time:
GenericVector<STRING> vars;
GenericVector<STRING> vals;
vars.push_back("debug_file");
vals.push_back("C:\\test\\tess.log");
std::string data_path = "garbage data path that will cause Init to issue errors";
auto result = ocr_->Init(data_path.c_str(), "eng", tesseract::OEM_TESSERACT_ONLY, NULL, 0, &vars, &vals, false);
and still see
Error opening data file
garbage_path_that_will_cause_init_to_issue_errors_to_the_cmd_line/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
whether "tess.log" exists or doesn't exist. When I search for documentation of the variables you can pass to Tesseract I see people citing the following as the definitive list: link, which does indeed contain "debug_file" as a variable but has no variable about "quiet mode" or verbosity.