Tesseract "estimating resolution as 304" 行逐字打印 + 打印时间 >1 秒。为什么以及如何压制?
Tesseract "estimating resolution as 304" line prints word by word + takes >1 second to print. Why and how to supress?
tesseract::TessBaseAPI tess;
if (tess.Init("./languages/fast/", "eng"))
{
std::cout << "OCRTesseract: Could not initialize tesseract." << std::endl;
std::exit(1);
}
tess.SetPageSegMode(tesseract::PageSegMode::PSM_AUTO);
tess.SetVariable("save_best_choices", "T");
tess.SetVariable("user_defined_dpi", "70");
auto buffer = ocrQueue.getBuffer();
tess.SetImage((const unsigned char*)buffer->data(), buffer->getWidth(), buffer->getHeight(), 3, buffer->getWidth()*3);
tess.Recognize(0);
std::cout << tess.GetUTF8Text() << std::endl;
每次运行这段代码我都会得到
Estimating resolution as 304
打印时间超过 1 秒,而且一个字一个字地打印,这很烦人。
如何抑制这个?
tess.SetVariable("user_defined_dpi", "71");
或
tess.SetVariable("debug_file", "/dev/null");
tesseract::TessBaseAPI tess;
if (tess.Init("./languages/fast/", "eng"))
{
std::cout << "OCRTesseract: Could not initialize tesseract." << std::endl;
std::exit(1);
}
tess.SetPageSegMode(tesseract::PageSegMode::PSM_AUTO);
tess.SetVariable("save_best_choices", "T");
tess.SetVariable("user_defined_dpi", "70");
auto buffer = ocrQueue.getBuffer();
tess.SetImage((const unsigned char*)buffer->data(), buffer->getWidth(), buffer->getHeight(), 3, buffer->getWidth()*3);
tess.Recognize(0);
std::cout << tess.GetUTF8Text() << std::endl;
每次运行这段代码我都会得到
Estimating resolution as 304
打印时间超过 1 秒,而且一个字一个字地打印,这很烦人。
如何抑制这个?
tess.SetVariable("user_defined_dpi", "71");
或
tess.SetVariable("debug_file", "/dev/null");