27 #ifndef SCRIBO_BINARIZATION_SAUVOLA_MS_SPLIT_HH
28 # define SCRIBO_BINARIZATION_SAUVOLA_MS_SPLIT_HH
30 # include <mln/core/concept/image.hh>
32 # include <mln/border/resize.hh>
34 # include <mln/data/transform.hh>
35 # include <mln/data/split.hh>
37 # include <scribo/binarization/sauvola_ms.hh>
76 unsigned s,
unsigned min_ntrue,
double k2,
77 double k3,
double k4);
87 unsigned s,
unsigned min_ntrue,
double K);
98 unsigned s,
unsigned min_ntrue);
102 # ifndef MLN_INCLUDE_ONLY
105 template <
typename I>
108 unsigned s,
unsigned min_ntrue,
double k2,
109 double k3,
double k4)
111 mln_trace(
"scribo::binarization::sauvola_ms_split");
113 mln_precondition(
exact(input_1_).is_valid());
114 mlc_is(mln_value(I), value::rgb8)::check();
116 const I& input_1 =
exact(input_1_);
120 mln_ch_value(I,
value::int_u8) r_i, g_i, b_i;
122 binarization::internal::k2 = k2;
123 binarization::internal::k3 = k3;
124 binarization::internal::k4 = k4;
127 mln::
data::
split(input_1, r_i, g_i, b_i);
135 border::
resize(r_b, input_1.border());
136 border::
resize(g_b, input_1.border());
137 border::
resize(b_b, input_1.border());
140 initialize(output, input_1);
142 typedef
bool * b_ptr_t;
144 out_ptr = output.buffer(),
145 r_ptr = r_b.buffer(),
146 g_ptr = g_b.buffer(),
147 b_ptr = b_b.buffer();
150 for (
unsigned n = 0; n < output.nelements(); ++n)
160 *out_ptr++ = ntrue >= min_ntrue;
171 template <
typename I>
174 unsigned s,
unsigned min_ntrue,
double K)
181 template <
typename I>
184 unsigned s,
unsigned min_ntrue)
187 SCRIBO_DEFAULT_SAUVOLA_K);
190 # endif // ! MLN_INCLUDE_ONLY
197 #endif // ! SCRIBO_BINARIZATION_SAUVOLA_MS_SPLIT_HH