
* binarization/sauvola_threshold_image.hh: Add ifdefs. * core/object_groups.hh: Fix a wrong assertion. * postprocessing/fill_object_holes.hh: Disable debug output. * preprocessing/denoise_bg.hh: Do not negate the image anymore. --- scribo/ChangeLog | 12 ++++++++++++ scribo/binarization/sauvola_threshold_image.hh | 7 ++++++- scribo/core/object_groups.hh | 2 +- scribo/postprocessing/fill_object_holes.hh | 20 ++++++++++++++++---- scribo/preprocessing/denoise_bg.hh | 6 +++--- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 3888981..8835298 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,17 @@ 2010-06-03 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes. + + * binarization/sauvola_threshold_image.hh: Add ifdefs. + + * core/object_groups.hh: Fix a wrong assertion. + + * postprocessing/fill_object_holes.hh: Disable debug output. + + * preprocessing/denoise_bg.hh: Do not negate the image anymore. + +2010-06-03 Guillaume Lazzara <z@lrde.epita.fr> + Add the binarization tool submitted to H-DIBCO 2010. * src/Makefile.am, diff --git a/scribo/binarization/sauvola_threshold_image.hh b/scribo/binarization/sauvola_threshold_image.hh index c45fc98..5382650 100644 --- a/scribo/binarization/sauvola_threshold_image.hh +++ b/scribo/binarization/sauvola_threshold_image.hh @@ -127,7 +127,6 @@ namespace scribo # endif // ! SCRIBO_SAUVOLA_DEBUG - /*! \brief compute Sauvola's threshold applying directly the formula. \param[in] m_x_y Mean value. @@ -170,20 +169,26 @@ namespace scribo // if (s_N < 0.1f) // { // K_2 = 0.1f; +// # ifdef SCRIBO_SAUVOLA_DEBUG // dbg_k = 0; // dbg_s_n = s_N; +// # endif // !SCRIBO_SAUVOLA_DEBUG // } // else if (s_N > 0.34) // { // K_2 = 0.34; +// # ifdef SCRIBO_SAUVOLA_DEBUG // dbg_k = 255; // dbg_s_n = s_N; +// # endif // !SCRIBO_SAUVOLA_DEBUG // } // else // { // K_2 = s_N; +// # ifdef SCRIBO_SAUVOLA_DEBUG // dbg_k = 150; // dbg_s_n = s_N; +// # endif // !SCRIBO_SAUVOLA_DEBUG // } diff --git a/scribo/core/object_groups.hh b/scribo/core/object_groups.hh index a7bb403..9d9fb25 100644 --- a/scribo/core/object_groups.hh +++ b/scribo/core/object_groups.hh @@ -183,7 +183,7 @@ namespace scribo bool object_groups<L>::is_valid() const { - mln_assertion(data_->components_.nelements() == (nelements())); + mln_assertion(data_->components_.nelements() == (nelements() - 1)); return data_->links_.is_valid(); } diff --git a/scribo/postprocessing/fill_object_holes.hh b/scribo/postprocessing/fill_object_holes.hh index 4771844..7dc53eb 100644 --- a/scribo/postprocessing/fill_object_holes.hh +++ b/scribo/postprocessing/fill_object_holes.hh @@ -41,7 +41,11 @@ # include <mln/core/routine/extend.hh> # include <mln/core/image/dmorph/extended.hh> +# include <mln/data/fill.hh> +# include <mln/data/transform.hh> + # include <mln/extension/duplicate.hh> +# include <mln/extension/adjust_fill.hh> # include <mln/draw/box_plain.hh> # include <mln/util/array.hh> @@ -50,6 +54,14 @@ # include <mln/fun/i2v/array.hh> +# include <mln/value/int_u16.hh> + +# include <mln/labeling/blobs_and_compute.hh> + +# include <mln/logical/not.hh> + +# include <mln/transform/influence_zone_geodesic.hh> + # include <scribo/core/macros.hh> # include <scribo/core/object_groups.hh> # include <scribo/primitive/group/apply.hh> @@ -331,7 +343,7 @@ namespace scribo // Holes card Image - std::cout << "> Holes card image" << std::endl; +// std::cout << "> Holes card image" << std::endl; L nlabels; @@ -345,7 +357,7 @@ namespace scribo // Threshold Image - std::cout << "> Threshold image" << std::endl; +// std::cout << "> Threshold image" << std::endl; I input_i = logical::not_(input); @@ -363,7 +375,7 @@ namespace scribo // Thresholding - std::cout << "> Thresholding" << std::endl; +// std::cout << "> Thresholding" << std::endl; I hole_mask; initialize(hole_mask, holes); @@ -376,7 +388,7 @@ namespace scribo // Cleanup - std::cout << "> Cleanup" << std::endl; +// std::cout << "> Cleanup" << std::endl; data::fill((output | pw::value(hole_mask)).rw(), false); diff --git a/scribo/preprocessing/denoise_bg.hh b/scribo/preprocessing/denoise_bg.hh index 9242f36..14837bb 100644 --- a/scribo/preprocessing/denoise_bg.hh +++ b/scribo/preprocessing/denoise_bg.hh @@ -131,11 +131,11 @@ namespace scribo util::array<unsigned> result = labeling::compute(accu::meta::math::count(), lbl, nlabels); - mln::fun::i2v::array<bool> f(nlabels + 1, true); - f(0) = false; + mln::fun::i2v::array<bool> f(nlabels + 1, false); + f(0) = true; for (unsigned i = 1; i <= nlabels; ++i) if (result(i) < min_card) - f(i) = false; + f(i) = true; scribo::fun::v2b::label_to_bool<unsigned> relabel_f(f); mln_concrete(I) -- 1.5.6.5