* scribo/text/recognition.hh: Here.
---
scribo/ChangeLog | 6 ++++
scribo/scribo/text/recognition.hh | 60 +++++++++++++++++--------------------
2 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 4b8d9be..412f271 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,11 @@
2013-06-25 Roland Levillain <roland(a)lrde.epita.fr>
+ Restrict workaround-related locale changes to LC_NUMERIC.
+
+ * scribo/text/recognition.hh: Here.
+
+2013-06-25 Roland Levillain <roland(a)lrde.epita.fr>
+
More locale-related Tesseract workarounds.
* scribo/text/recognition.hh: Here.
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index 614975b..d74ae5c 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -122,12 +122,20 @@ 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");
+ /* Tesseract is known to have issues while reading training
+ data, depending on the locale in use. Training data files
+ contain floating-point values and the decimal separator may
+ either be '.' or ',' which may trigger a fatal error with the
+ following message:
+
+ Error: Illegal min or max specification!
+
+ The recommended solution is to set the locale of LC_NUMERIC
+ to "C". For more information, see:
+
+ http://code.google.com/p/tesseract-ocr/wiki/FAQ#Error:_Illegal_min_or_max_s…
+ */
+ setlocale(LC_NUMERIC, "C");
// Initialize Tesseract.
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
@@ -202,8 +210,8 @@ namespace scribo
delete [] s;
}
- // Restore default locale.
- setlocale(LC_ALL, "");
+ // Restore the default locale from the environment.
+ setlocale(LC_NUMERIC, "");
}
@@ -219,12 +227,8 @@ 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");
+ // See the above explanations about setlocale.
+ setlocale(LC_NUMERIC, "C");
// Initialize Tesseract.
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
@@ -279,8 +283,8 @@ namespace scribo
if (!output_file.empty())
file.close();
- // Restore default locale.
- setlocale(LC_ALL, "");
+ // See the above explanations about setlocale.
+ setlocale(LC_NUMERIC, "");
}
@@ -296,12 +300,8 @@ 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");
+ // See the above explanations about setlocale.
+ setlocale(LC_NUMERIC, "C");
// Initialize Tesseract.
tesseract::TessBaseAPI tess;
@@ -369,8 +369,8 @@ namespace scribo
delete[] s;
}
- // Restore default locale.
- setlocale(LC_ALL, "");
+ // Restore the default locale from the environment.
+ setlocale(LC_NUMERIC, "");
}
@@ -386,12 +386,8 @@ 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");
+ // Restore the default locale from the environment.
+ setlocale(LC_NUMERIC, "C");
// Initialize Tesseract.
tesseract::TessBaseAPI tess;
@@ -439,8 +435,8 @@ namespace scribo
if (!output_file.empty())
file.close();
- // Restore default locale.
- setlocale(LC_ALL, "");
+ // Restore the default locale from the environment.
+ setlocale(LC_NUMERIC, "");
}
--
1.7.10.4
* 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(a)lrde.epita.fr>
+
+ More locale-related Tesseract workarounds.
+
+ * scribo/text/recognition.hh: Here.
+
2013-06-20 Roland Levillain <roland(a)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
* apps/morphers/iz.cc: Here.
Add a copyright notice and a Doxygen header.
---
milena/ChangeLog | 7 +++++++
milena/apps/morphers/iz.cc | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index cd0b401..7c2871f 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2013-06-20 Roland Levillain <roland(a)lrde.epita.fr>
+ Avoid comparisons between signed and unsigned values.
+
+ * apps/morphers/iz.cc: Here.
+ Add a copyright notice and a Doxygen header.
+
+2013-06-20 Roland Levillain <roland(a)lrde.epita.fr>
+
Aesthetic changes.
* mln/value/int_u.hh: Here.
diff --git a/milena/apps/morphers/iz.cc b/milena/apps/morphers/iz.cc
index 4216dc5..1603d38 100644
--- a/milena/apps/morphers/iz.cc
+++ b/milena/apps/morphers/iz.cc
@@ -1,3 +1,32 @@
+// Copyright (C) 2012, 2013 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file
+/// \brief Application of the lazy recorder morpher to the computation
+/// of influence zones.
+
#include <mln/core/image/image2d.hh>
#include <mln/core/alias/neighb2d.hh>
@@ -120,7 +149,7 @@ int main(int argc, char* argv[])
{
image2d<value::rgb8> ws_ = data::convert(value::rgb8(), input);
- data::fill((ws_ | (pw::value(ws) == pw::cst(0))).rw(), literal::red);
+ data::fill((ws_ | (pw::value(ws) == pw::cst(0u))).rw(), literal::red);
io::ppm::save(ws_, "tmp_ws_superpose.ppm");
// test% g++ -I. main.cc -DNDEBUG -O2
@@ -156,8 +185,8 @@ int main(int argc, char* argv[])
image_if< decorated_image< image2d<unsigned int>,
lazy_recorder< image2d<unsigned int> > >,
fun::eq_v2b_expr_< pw::value_< image2d<unsigned int> >,
- pw::cst_<int> > > rec_iz =
- transform::influence_zone_front(rec_lab | (pw::value(ws) == pw::cst(0)),
+ pw::cst_<unsigned int> > > rec_iz =
+ transform::influence_zone_front(rec_lab | (pw::value(ws) == pw::cst(0u)),
c8(),
make::w_window2d(ww));
data::paste(rec_iz, lab);
--
1.7.10.4