26 #ifndef SCRIBO_BINARIZATION_INTERNAL_NIBLACK_FUNCTOR_HH
27 # define SCRIBO_BINARIZATION_INTERNAL_NIBLACK_FUNCTOR_HH
33 # include <mln/core/image/image2d.hh>
34 # include <mln/core/alias/neighb2d.hh>
35 # include <mln/extension/fill.hh>
37 # include <scribo/binarization/internal/niblack_formula.hh>
39 # ifdef SCRIBO_LOCAL_THRESHOLD_DEBUG
40 # include <scribo/binarization/internal/local_threshold_debug.hh>
41 # endif // ! SCRIBO_LOCAL_THRESHOLD_DEBUG
70 void exec(
double mean,
double stddev);
80 const mln_value(I)*
pi;
90 #ifndef MLN_INCLUDE_ONLY
95 : input(
exact(input_)),
96 pi(&input(input.domain().pmin())),
99 mln_precondition(
exact(input).is_valid());
102 template <
typename I>
104 niblack_functor<I>::init()
108 next_line = 2 * input.border();
110 po = &output(output.domain().pmin());
113 template <
typename I>
115 niblack_functor<I>::exec(
double mean,
double stddev)
117 mln_assertion(input.border() == output.border());
119 double th = formula_(mean, stddev, K_);
121 *po++ = (*
pi++ <= th);
124 template <
typename I>
126 niblack_functor<I>::end_of_row(
int)
132 template <
typename I>
134 niblack_functor<I>::finalize()
138 #endif // ! MLN_INCLUDE_ONLY
146 #endif // SCRIBO_BINARIZATION_INTERNAL_NIBLACK_FUNCTOR_HH