* src/binarization/sauvola_ms.cc: Add negate option.
* src/binarization/sauvola_ms_debug.cc: Fix invalid k parameter
value.
---
scribo/ChangeLog | 9 +++++++++
scribo/src/binarization/sauvola_ms.cc | 7 ++++++-
scribo/src/binarization/sauvola_ms_debug.cc | 8 ++++----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 64e13a6..8d45b42 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,12 @@
+2013-01-24 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix binarization programs.
+
+ * src/binarization/sauvola_ms.cc: Add negate option.
+
+ * src/binarization/sauvola_ms_debug.cc: Fix invalid k parameter
+ value.
+
2012-11-05 Guillaume Lazzara <z(a)lrde.epita.fr>
* scribo/binarization/sauvola_ms.hh: Fix overlapping area
diff --git a/scribo/src/binarization/sauvola_ms.cc
b/scribo/src/binarization/sauvola_ms.cc
index 970e2aa..f05186a 100644
--- a/scribo/src/binarization/sauvola_ms.cc
+++ b/scribo/src/binarization/sauvola_ms.cc
@@ -33,6 +33,7 @@
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_luma.hh>
#include <mln/util/timer.hh>
+#include <mln/logical/not.hh>
#include <scribo/binarization/sauvola_ms.hh>
#include <scribo/debug/option_parser.hh>
@@ -50,6 +51,7 @@ static const scribo::debug::arg_data arg_desc[] =
static const scribo::debug::toggle_data toggle_desc[] =
{
// name, description, default value
+ { "negate", "Negate output image.", false},
{0, 0, false}
};
@@ -147,5 +149,8 @@ int main(int argc, char *argv[])
scribo::debug::logger().stop_local_time_logging("Binarized in");
- io::magick::save(output, options.arg("output.*"));
+ if (options.is_enabled("negate"))
+ io::magick::save(logical::not_(output), options.arg("output.*"));
+ else
+ io::magick::save(output, options.arg("output.*"));
}
diff --git a/scribo/src/binarization/sauvola_ms_debug.cc
b/scribo/src/binarization/sauvola_ms_debug.cc
index d4dcc14..434556a 100644
--- a/scribo/src/binarization/sauvola_ms_debug.cc
+++ b/scribo/src/binarization/sauvola_ms_debug.cc
@@ -66,9 +66,9 @@ static const scribo::debug::opt_data opt_desc[] =
"given prefix.", "<prefix>", 0, 1, 0 },
{ "all-k", "Sauvola's formulae parameter",
"<value>", 0, 1, "0.34" },
- { "k2", "Sauvola's formulae parameter",
"<value>", 0, 1, "0.20" },
- { "k3", "Sauvola's formulae parameter",
"<value>", 0, 1, "0.30" },
- { "k4", "Sauvola's formulae parameter",
"<value>", 0, 1, "0.50" },
+ { "k2", "Sauvola's formulae parameter",
"<value>", 0, 1, 0 },
+ { "k3", "Sauvola's formulae parameter",
"<value>", 0, 1, 0 },
+ { "k4", "Sauvola's formulae parameter",
"<value>", 0, 1, 0 },
{ "s", "First subsampling ratio. Possible values: 2 or 3.",
"ratio",
scribo::debug::check_sauvola_first_subsampling, 1, "3" },
@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
for (unsigned i = 0; i < geom::nrows(output); ++i)
for (unsigned j = 0; j < geom::ncols(output); ++j)
if (output.at_(i,j))
- scale_bin.at_(i,j) = binarization::internal::debug_e_2.at_(i/3, j/3);
+ scale_bin.at_(i,j) = binarization::internal::debug_e_2.at_(i/s, j/s);
else
scale_bin.at_(i,j) = 0;
--
1.7.2.5