
* scribo/text/recognition.hh: Here. --- scribo/ChangeLog | 6 ++++++ scribo/scribo/text/recognition.hh | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index c937a09..4b8d9be 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh index a4db088..614975b 100644 --- a/scribo/scribo/text/recognition.hh +++ b/scribo/scribo/text/recognition.hh @@ -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) -- 1.7.10.4