
--- scribo/ChangeLog | 5 +++++ scribo/scribo/binarization/sauvola_ms.hh | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index a987ade..3bdcd00 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,10 @@ 2013-03-20 Guillaume Lazzara <z@lrde.epita.fr> + * scribo/binarization/sauvola_ms.hh: Add a new overload and + preconditions. + +2013-03-20 Guillaume Lazzara <z@lrde.epita.fr> + Improve documentation layout. * doc/Doxyfile.in: Improve member functions presentation. diff --git a/scribo/scribo/binarization/sauvola_ms.hh b/scribo/scribo/binarization/sauvola_ms.hh index 0bfd5a4..979a4e9 100644 --- a/scribo/scribo/binarization/sauvola_ms.hh +++ b/scribo/scribo/binarization/sauvola_ms.hh @@ -148,6 +148,13 @@ namespace scribo sauvola_ms(const Image<I>& input_1, unsigned w_1, unsigned s, double k2, double k3, double k4); + /// \overload + /// Allow to specify the same k parameter for all scales. + // + template <typename I> + mln_ch_value(I,bool) + sauvola_ms(const Image<I>& input_1, unsigned w_1, unsigned s, + double all_k); # ifndef MLN_INCLUDE_ONLY @@ -1019,6 +1026,8 @@ namespace scribo mln_trace("scribo::binarization::sauvola_ms"); mln_precondition(exact(input_1_).is_valid()); + mln_precondition(s > 1); + // Gray level images ONLY. mlc_is_not_a(mln_value(I), value::Vectorial)::check(); mlc_is_not(mln_value(I), bool)::check(); @@ -1037,6 +1046,8 @@ namespace scribo mln_trace("scribo::binarization::sauvola_ms"); mln_precondition(exact(input_1_).is_valid()); + mln_precondition(s > 1); + // Gray level images ONLY. mlc_is_not_a(mln_value(I), value::Vectorial)::check(); mlc_is_not(mln_value(I), bool)::check(); @@ -1064,6 +1075,19 @@ namespace scribo } + template <typename I> + mln_ch_value(I,bool) + sauvola_ms(const Image<I>& input_1, unsigned w_1, unsigned s, + double all_k) + { + binarization::internal::k2 = all_k; + binarization::internal::k3 = all_k; + binarization::internal::k4 = all_k; + + return sauvola_ms(input_1, w_1, s); + } + + # endif // ! MLN_INCLUDE_ONLY -- 1.7.2.5