Commit 508408f7 authored by Roland Levillain's avatar Roland Levillain
Browse files

More locale-related Tesseract workarounds.

	* scribo/text/recognition.hh: Here.
parent 26bb7741
2013-06-25 Roland Levillain <roland@lrde.epita.fr>
More locale-related Tesseract workarounds.
* scribo/text/recognition.hh: Here.
2013-06-20 Roland Levillain <roland@lrde.epita.fr>
Provide default arguments in function declarations only.
......
......@@ -296,6 +296,12 @@ namespace scribo
{
mln_trace("scribo::text::recognition");
// Tesseract is known to have issues while reading training data
// depending on the current locales in use. Training data files use
// float data and the decimal separator can be either '.' or ','
// causing errors.
// Setting locale to "C" fix that issue.
setlocale(LC_ALL, "C");
// Initialize Tesseract.
tesseract::TessBaseAPI tess;
......@@ -363,6 +369,8 @@ namespace scribo
delete[] s;
}
// Restore default locale.
setlocale(LC_ALL, "");
}
......@@ -378,6 +386,13 @@ namespace scribo
const I& line = exact(line_);
mln_precondition(line.is_valid());
// Tesseract is known to have issues while reading training data
// depending on the current locales in use. Training data files use
// float data and the decimal separator can be either '.' or ','
// causing errors.
// Setting locale to "C" fix that issue.
setlocale(LC_ALL, "C");
// Initialize Tesseract.
tesseract::TessBaseAPI tess;
if (tess.Init(NULL, language, tesseract::OEM_DEFAULT) == -1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment