last-svn-commit-583-g91a43ae Set default window size to 101 in Sauvola examples.

* src/binarization/pgm_sauvola.cc, * src/binarization/ppm_sauvola.cc, * src/binarization/sauvola.cc: Set default window size to 101. --- scribo/ChangeLog | 8 ++++++++ scribo/src/binarization/pgm_sauvola.cc | 4 ++-- scribo/src/binarization/ppm_sauvola.cc | 4 ++-- scribo/src/binarization/sauvola.cc | 15 ++++++++++++--- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index e2c4883..0e2ace9 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,13 @@ 2010-11-15 Guillaume Lazzara <z@lrde.epita.fr> + Set default window size to 101 in Sauvola examples. + + * src/binarization/pgm_sauvola.cc, + * src/binarization/ppm_sauvola.cc, + * src/binarization/sauvola.cc: Set default window size to 101. + +2010-11-15 Guillaume Lazzara <z@lrde.epita.fr> + Improve debug management and outputs for Sauvola. * scribo/binarization/internal/compute_sauvola_threshold.hh: diff --git a/scribo/src/binarization/pgm_sauvola.cc b/scribo/src/binarization/pgm_sauvola.cc index c6ba643..1052766 100644 --- a/scribo/src/binarization/pgm_sauvola.cc +++ b/scribo/src/binarization/pgm_sauvola.cc @@ -34,7 +34,7 @@ const char *args_desc[][2] = { { "input.pgm", "A gray level image." }, { "output.pbm", "A binary image." }, - { "w", "Window size (default 51)." }, + { "w", "Window size (default 101)." }, { "k", "Sauvola's formulae parameter (default 0.34)." }, {0, 0} }; @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) if (argc == 4) w = atoi(argv[3]); else - w = 51; + w = 101; double k; if (argc == 5) diff --git a/scribo/src/binarization/ppm_sauvola.cc b/scribo/src/binarization/ppm_sauvola.cc index 0b798ae..330af70 100644 --- a/scribo/src/binarization/ppm_sauvola.cc +++ b/scribo/src/binarization/ppm_sauvola.cc @@ -34,7 +34,7 @@ const char *args_desc[][2] = { { "input.ppm", "A color image." }, { "output.pbm", "A binary image." }, - { "w", "Window size (default 51)." }, + { "w", "Window size (default 101)." }, { "k", "Sauvola's formulae parameter (default 0.34)." }, {0, 0} }; @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) if (argc == 4) w = atoi(argv[3]); else - w = 51; + w = 101; double k; if (argc == 5) diff --git a/scribo/src/binarization/sauvola.cc b/scribo/src/binarization/sauvola.cc index fb07b0d..3969524 100644 --- a/scribo/src/binarization/sauvola.cc +++ b/scribo/src/binarization/sauvola.cc @@ -24,8 +24,12 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +#include <mln/core/image/image2d.hh> +#include <mln/value/int_u8.hh> #include <mln/io/magick/load.hh> #include <mln/io/pbm/save.hh> +#include <mln/data/transform.hh> +#include <mln/fun/v2v/rgb_to_int_u.hh> #include <scribo/binarization/sauvola.hh> #include <scribo/debug/usage.hh> @@ -34,7 +38,7 @@ const char *args_desc[][2] = { { "input.*", "An image." }, { "output.pbm", "A binary image." }, - { "w", "Window size (default 51)." }, + { "w", "Window size (default 101)." }, { "k", "Sauvola's formulae parameter (default 0.34)." }, {0, 0} }; @@ -56,7 +60,7 @@ int main(int argc, char *argv[]) if (argc >= 4) w = atoi(argv[3]); else - w = 51; + w = 101; double k; if (argc >= 5) @@ -69,7 +73,12 @@ int main(int argc, char *argv[]) image2d<value::rgb8> input; io::magick::load(input, argv[1]); - image2d<bool> out = scribo::binarization::sauvola(input, w, k); + // Convert to Gray level image. + image2d<value::int_u8> + input_1_gl = data::transform(input, mln::fun::v2v::rgb_to_int_u<8>()); + + + image2d<bool> out = scribo::binarization::sauvola(input_1_gl, w, k); io::pbm::save(out, argv[2]); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara