last-svn-commit-582-g87a2f38 Improve debug management and outputs for Sauvola.

* scribo/binarization/internal/compute_sauvola_threshold.hh: New. Move sauvola_threshold related routines here. * scribo/binarization/internal/first_pass_functor.hh, * scribo/binarization/sauvola.hh, * scribo/binarization/sauvola_ms.hh, * scribo/binarization/sauvola_threshold_image.hh: Move debug variables... * scribo/binarization/internal/sauvola_debug.hh: ... here. New. * scribo/binarization/sauvola_threshold_image_debug.hh: Remove. * src/binarization/Makefile.am, * src/binarization/sauvola_debug.cc, * src/binarization/sauvola_ms_debug.cc: Improve debug outputs. * src/binarization/pgm_sauvola_threshold_image.cc: New. --- scribo/ChangeLog | 23 +++++++++++++++++ .../{sauvola.cc => pgm_sauvola_threshold_image.cc} | 26 +++++++++---------- 2 files changed, 35 insertions(+), 14 deletions(-) copy scribo/src/binarization/{sauvola.cc => pgm_sauvola_threshold_image.cc} (77%) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index eceb1ba..e2c4883 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -19,6 +19,29 @@ * src/binarization/sauvola_debug.cc, * src/binarization/sauvola_ms_debug.cc: Improve debug outputs. + * src/binarization/pgm_sauvola_threshold_image.cc: New. + +2010-11-15 Guillaume Lazzara <z@lrde.epita.fr> + + Improve debug management and outputs for Sauvola. + + * scribo/binarization/internal/compute_sauvola_threshold.hh: + New. Move sauvola_threshold related routines here. + + * scribo/binarization/internal/first_pass_functor.hh, + * scribo/binarization/sauvola.hh, + * scribo/binarization/sauvola_ms.hh, + * scribo/binarization/sauvola_threshold_image.hh: Move debug + variables... + + * scribo/binarization/internal/sauvola_debug.hh: ... here. New. + + * scribo/binarization/sauvola_threshold_image_debug.hh: Remove. + + * src/binarization/Makefile.am, + * src/binarization/sauvola_debug.cc, + * src/binarization/sauvola_ms_debug.cc: Improve debug outputs. + 2010-08-06 Arthur Crepin-Leblond <crepin@lrde.epita.fr> Add arrows shortcuts. diff --git a/scribo/src/binarization/sauvola.cc b/scribo/src/binarization/pgm_sauvola_threshold_image.cc similarity index 77% copy from scribo/src/binarization/sauvola.cc copy to scribo/src/binarization/pgm_sauvola_threshold_image.cc index fb07b0d..a38784a 100644 --- a/scribo/src/binarization/sauvola.cc +++ b/scribo/src/binarization/pgm_sauvola_threshold_image.cc @@ -1,5 +1,4 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,17 +23,16 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#include <mln/io/magick/load.hh> -#include <mln/io/pbm/save.hh> +#include <mln/io/pgm/all.hh> #include <scribo/binarization/sauvola.hh> #include <scribo/debug/usage.hh> const char *args_desc[][2] = { - { "input.*", "An image." }, - { "output.pbm", "A binary image." }, - { "w", "Window size (default 51)." }, + { "input.pgm", "A graylevel image." }, + { "output.pgm", "A threshold image." }, + { "w", "Window size (default 101)." }, { "k", "Sauvola's formulae parameter (default 0.34)." }, {0, 0} }; @@ -46,8 +44,8 @@ int main(int argc, char *argv[]) if (argc != 5 && argc != 4 && argc != 3) return scribo::debug::usage(argv, - "Binarization based on Sauvola's algorithm.", - "input.* output.pbm <w> <k>", + "Compute a threshold image based on Sauvola's algorithm.", + "input.pgm output.pgm <w> <k>", args_desc); trace::entering("main"); @@ -56,7 +54,7 @@ int main(int argc, char *argv[]) if (argc >= 4) w = atoi(argv[3]); else - w = 51; + w = 101; double k; if (argc >= 5) @@ -66,13 +64,13 @@ int main(int argc, char *argv[]) std::cout << "Using w=" << w << " and k=" << k << std::endl; - image2d<value::rgb8> input; - io::magick::load(input, argv[1]); + image2d<value::int_u8> input; + io::pgm::load(input, argv[1]); - image2d<bool> out = scribo::binarization::sauvola(input, w, k); + image2d<value::int_u8> out = scribo::binarization::sauvola_threshold_image(input, w, k); - io::pbm::save(out, argv[2]); + io::pgm::save(out, argv[2]); trace::exiting("main"); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara