27 #ifndef SCRIBO_TOOLCHAIN_TEXT_IN_DOC_PREPROCESS_HH
28 # define SCRIBO_TOOLCHAIN_TEXT_IN_DOC_PREPROCESS_HH
35 #include <mln/core/concept/image.hh>
36 #include <mln/data/transform.hh>
37 #include <mln/fun/v2v/rgb_to_int_u.hh>
39 #include <scribo/binarization/sauvola_ms.hh>
41 #include <scribo/preprocessing/split_bg_fg.hh>
42 #include <scribo/preprocessing/deskew.hh>
44 #include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
74 unsigned lambda,
double K,
bool enable_deskew,
101 template <typename I>
128 template <typename I>
131 double k2,
double k3,
double k4,
bool enable_fg_bg,
132 Image<I>& fg,
bool enable_deskew,
bool verbose);
138 template <typename I>
141 bool enable_fg_bg,
Image<I>& fg,
142 bool enable_deskew,
bool verbose);
145 # ifndef MLN_INCLUDE_ONLY
148 template <
typename I>
157 template <
typename I>
160 unsigned lambda,
double K,
bool enable_deskew,
163 const I& input =
exact(input_);
164 mln_precondition(input.is_valid());
166 if (enable_fg_bg && lambda == 0)
167 lambda = 1.2 * (input.nrows() + input.ncols());
172 enable_fg_bg, tmp_fg, enable_deskew, verbose);
177 template <typename I>
187 template <
typename I>
190 double k2,
double k3,
double k4,
bool enable_fg_bg,
191 Image<I>& fg,
bool enable_deskew,
bool verbose)
193 mln_trace(
"scribo::toolchain::text_in_doc_preprocess");
195 const I& input =
exact(input_);
196 mln_precondition(input.is_valid());
198 internal::text_in_doc_preprocess_functor<I> f;
204 f.enable_fg_extraction = enable_fg_bg;
206 f.enable_deskew = enable_deskew;
217 template <typename I>
220 bool enable_fg_bg,
Image<I>& fg,
221 bool enable_deskew,
bool verbose)
224 SCRIBO_DEFAULT_SAUVOLA_K, SCRIBO_DEFAULT_SAUVOLA_K,
225 enable_fg_bg, fg, enable_deskew, verbose);
228 # endif // ! MLN_INCLUDE_ONLY
236 #endif // SCRIBO_TOOLCHAIN_TEXT_IN_DOC_PREPROCESS_HH