
--- scribo/ChangeLog | 4 ++ scribo/scribo/toolchain/text_in_doc_preprocess.hh | 32 ++++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 4c98593..bb3b4aa 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,7 @@ +2010-08-31 Guillaume Lazzara <z@lrde.epita.fr> + + * scribo/toolchain/text_in_doc_preprocess.hh: Add a new overload. + 2010-08-26 Guillaume Lazzara <z@lrde.epita.fr> Rename examples. diff --git a/scribo/scribo/toolchain/text_in_doc_preprocess.hh b/scribo/scribo/toolchain/text_in_doc_preprocess.hh index cff99f7..d7757ff 100644 --- a/scribo/scribo/toolchain/text_in_doc_preprocess.hh +++ b/scribo/scribo/toolchain/text_in_doc_preprocess.hh @@ -76,6 +76,22 @@ namespace scribo mln_ch_value(I,bool) text_in_doc_preprocess(const Image<I>& input, unsigned lambda); + /*! \brief Preprocess a document before looking for its content. + + \param[in] input An image. + \param[in] lambda Parameter to the background removal. + \param[in,out] fg The foreground layer of \p input. + + If lambda is set to '0' no background removal is + performed. Otherwise, a background removal is performed with the + given \p lambda value. + + */ + template <typename I> + mln_ch_value(I,bool) + text_in_doc_preprocess(const Image<I>& input, unsigned lambda, + Image<I>& fg); + # ifndef MLN_INCLUDE_ONLY @@ -84,8 +100,6 @@ namespace scribo mln_ch_value(I,bool) text_in_doc_preprocess(const Image<I>& input_, bool enable_fg_bg) { - trace::entering("scribo::toolchain::text_in_doc_preprocess"); - const I& input = exact(input_); mln_precondition(input.is_valid()); @@ -95,18 +109,27 @@ namespace scribo mln_ch_value(I,bool) output = text_in_doc_preprocess(input, lambda); - trace::exiting("scribo::toolchain::text_in_doc_preprocess"); return output; } + template <typename I> + mln_ch_value(I,bool) + text_in_doc_preprocess(const Image<I>& input, unsigned lambda) + { + I tmp; + return text_in_doc_preprocess(input, lambda, tmp); + } + template <typename I> mln_ch_value(I,bool) - text_in_doc_preprocess(const Image<I>& input_, unsigned lambda) + text_in_doc_preprocess(const Image<I>& input_, unsigned lambda, + Image<I>& fg_) { trace::entering("scribo::toolchain::text_in_doc_preprocess"); const I& input = exact(input_); + I& fg = exact(fg_); mln_precondition(input.is_valid()); mln_concrete(I) input_rgb = input; @@ -116,6 +139,7 @@ namespace scribo { std::cout << "Extracting foreground..." << std::endl; input_rgb = preprocessing::split_bg_fg(input, lambda, 32).second(); + fg = input_rgb; } // Convert to Gray level image. -- 1.5.6.5