olena-2.0-408-g48849ed Improve documentation of Scribo.

* doc/scribo/binarization/binarization.dox, * doc/scribo/binarization/kim.dox, * doc/scribo/binarization/otsu.dox, * doc/scribo/binarization/wolf.dox, * doc/scribo/core/component_set.dox, * doc/scribo/filter/component_groups.dox, * doc/scribo/filter/component_links.dox, * doc/scribo/filter/components.dox, * doc/scribo/filter/elements.dox, * doc/scribo/filter/line_links.dox, * doc/scribo/filter/paragraphs.dox, * doc/scribo/primitive/extract/separators.dox, * scribo/core/component_info.hh, * scribo/core/tag/component.hh: Add more documentation. * doc/scribo/layout/layout.dox, * doc/scribo/namespaces.dox, * doc/scribo/primitive/extract/components.dox, * doc/scribo/primitive/extract/extract.dox: New. * scribo/binarization/internal/local_threshold_core.hh, * scribo/binarization/internal/singh_formula.hh, * scribo/binarization/kim.hh, * scribo/binarization/niblack_fast.hh, * scribo/binarization/niblack_threshold.hh, * scribo/binarization/otsu.hh, * scribo/binarization/otsu_threshold.hh, * scribo/binarization/sauvola_ms_split.hh, * scribo/binarization/singh.hh, * scribo/binarization/wolf.hh, * scribo/binarization/wolf_fast.hh, * scribo/core/component_set.hh, * scribo/core/concept/serializable.hh, * scribo/core/object_links.hh, * scribo/debug/logger.hh, * scribo/filter/paragraphs_in_borders.hh, * scribo/filter/separators_in_borders.hh, * scribo/filter/separators_vert_in_borders.hh, * scribo/layout/xy_cut.hh, * scribo/primitive/extract/components.hh, * scribo/primitive/extract/lines_v_single.hh, * scribo/subsampling/bilinear.hh, * scribo/text/merging_hdoc.hh: Fix existing documentation. --- scribo/ChangeLog | 48 +++++++++ scribo/doc/scribo/binarization/binarization.dox | 8 +- scribo/doc/scribo/binarization/kim.dox | 23 ++++ scribo/doc/scribo/binarization/otsu.dox | 11 ++- scribo/doc/scribo/binarization/wolf.dox | 6 + scribo/doc/scribo/core/component_set.dox | 90 ++++++++++++++++ scribo/doc/scribo/filter/component_groups.dox | 2 +- scribo/doc/scribo/filter/component_links.dox | 2 +- scribo/doc/scribo/filter/components.dox | 2 +- scribo/doc/scribo/filter/elements.dox | 2 +- scribo/doc/scribo/filter/line_links.dox | 4 +- scribo/doc/scribo/filter/paragraphs.dox | 4 +- scribo/doc/scribo/layout/layout.dox | 6 + scribo/doc/scribo/namespaces.dox | 7 ++ scribo/doc/scribo/primitive/extract/components.dox | 7 ++ scribo/doc/scribo/primitive/extract/extract.dox | 7 ++ scribo/doc/scribo/primitive/extract/separators.dox | 8 +- .../binarization/internal/local_threshold_core.hh | 6 +- .../scribo/binarization/internal/singh_formula.hh | 13 +-- scribo/scribo/binarization/kim.hh | 22 +--- scribo/scribo/binarization/niblack_fast.hh | 20 ++-- scribo/scribo/binarization/niblack_threshold.hh | 12 +-- scribo/scribo/binarization/otsu.hh | 8 +- scribo/scribo/binarization/otsu_threshold.hh | 12 +- scribo/scribo/binarization/sauvola_ms_split.hh | 19 ++-- scribo/scribo/binarization/singh.hh | 10 +- scribo/scribo/binarization/wolf.hh | 20 ++-- scribo/scribo/binarization/wolf_fast.hh | 19 ++-- scribo/scribo/core/component_info.hh | 10 ++ scribo/scribo/core/component_set.hh | 77 +++++++++----- scribo/scribo/core/concept/serializable.hh | 9 +- scribo/scribo/core/object_links.hh | 8 +- scribo/scribo/core/tag/component.hh | 56 +++++++--- scribo/scribo/debug/logger.hh | 8 +- scribo/scribo/filter/paragraphs_in_borders.hh | 50 +++++---- scribo/scribo/filter/separators_in_borders.hh | 63 ++++++------ scribo/scribo/filter/separators_vert_in_borders.hh | 51 +++++----- scribo/scribo/layout/xy_cut.hh | 14 ++- scribo/scribo/primitive/extract/components.hh | 40 +++++--- scribo/scribo/primitive/extract/lines_v_single.hh | 2 +- scribo/scribo/subsampling/bilinear.hh | 4 +- scribo/scribo/text/merging_hdoc.hh | 112 ++++---------------- 42 files changed, 552 insertions(+), 350 deletions(-) create mode 100644 scribo/doc/scribo/binarization/kim.dox create mode 100644 scribo/doc/scribo/binarization/wolf.dox create mode 100644 scribo/doc/scribo/core/component_set.dox create mode 100644 scribo/doc/scribo/layout/layout.dox create mode 100644 scribo/doc/scribo/namespaces.dox create mode 100644 scribo/doc/scribo/primitive/extract/components.dox create mode 100644 scribo/doc/scribo/primitive/extract/extract.dox diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 954af2c..ede4371 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,53 @@ 2013-03-20 Guillaume Lazzara <z@lrde.epita.fr> + Improve documentation of Scribo. + + * doc/scribo/binarization/binarization.dox, + * doc/scribo/binarization/kim.dox, + * doc/scribo/binarization/otsu.dox, + * doc/scribo/binarization/wolf.dox, + * doc/scribo/core/component_set.dox, + * doc/scribo/filter/component_groups.dox, + * doc/scribo/filter/component_links.dox, + * doc/scribo/filter/components.dox, + * doc/scribo/filter/elements.dox, + * doc/scribo/filter/line_links.dox, + * doc/scribo/filter/paragraphs.dox, + * doc/scribo/primitive/extract/separators.dox, + * scribo/core/component_info.hh, + * scribo/core/tag/component.hh: Add more documentation. + + * doc/scribo/layout/layout.dox, + * doc/scribo/namespaces.dox, + * doc/scribo/primitive/extract/components.dox, + * doc/scribo/primitive/extract/extract.dox: New. + + * scribo/binarization/internal/local_threshold_core.hh, + * scribo/binarization/internal/singh_formula.hh, + * scribo/binarization/kim.hh, + * scribo/binarization/niblack_fast.hh, + * scribo/binarization/niblack_threshold.hh, + * scribo/binarization/otsu.hh, + * scribo/binarization/otsu_threshold.hh, + * scribo/binarization/sauvola_ms_split.hh, + * scribo/binarization/singh.hh, + * scribo/binarization/wolf.hh, + * scribo/binarization/wolf_fast.hh, + * scribo/core/component_set.hh, + * scribo/core/concept/serializable.hh, + * scribo/core/object_links.hh, + * scribo/debug/logger.hh, + * scribo/filter/paragraphs_in_borders.hh, + * scribo/filter/separators_in_borders.hh, + * scribo/filter/separators_vert_in_borders.hh, + * scribo/layout/xy_cut.hh, + * scribo/primitive/extract/components.hh, + * scribo/primitive/extract/lines_v_single.hh, + * scribo/subsampling/bilinear.hh, + * scribo/text/merging_hdoc.hh: Fix existing documentation. + +2013-03-20 Guillaume Lazzara <z@lrde.epita.fr> + Replace \fixme with FIXME. * scribo/binarization/global_threshold_auto.hh, diff --git a/scribo/doc/scribo/binarization/binarization.dox b/scribo/doc/scribo/binarization/binarization.dox index 5a11603..145bf14 100644 --- a/scribo/doc/scribo/binarization/binarization.dox +++ b/scribo/doc/scribo/binarization/binarization.dox @@ -1,6 +1,6 @@ /*! \defgroup grpalgobin Binarization - * - * \brief Binarization algorithms. - * - * \ingroup grproutine + + \brief Binarization algorithms. + + \ingroup grproutine */ diff --git a/scribo/doc/scribo/binarization/kim.dox b/scribo/doc/scribo/binarization/kim.dox new file mode 100644 index 0000000..c3f9ff8 --- /dev/null +++ b/scribo/doc/scribo/binarization/kim.dox @@ -0,0 +1,23 @@ +/*! \defgroup grpalgobinkim Kim + + \brief Kim's Binarization implementations. + + This algorithms performs a first rough binarization on the input + (here we use Sauvola's method). Then text lines are roughly + detected by grouping connected components. For each text lines, + character thickness and x height is computed. Finally, each + lines is binarized again, using text features as parameters for + adjusting the final threshold. + + This algorithms considers that global and local statistics + should be used to compute a threshold in text areas. + + This is an improvement of Sauvola's method. + + This implementation is based on the paper "Multi-Window + Binarization of Camera Image for Document Recognition", In-Jung + Kim, Proceedings of the 9th International Workshop on Frontiers + in Handwriting Recognition (IWFHR-9 2004) + + \ingroup grpalgobin + */ diff --git a/scribo/doc/scribo/binarization/otsu.dox b/scribo/doc/scribo/binarization/otsu.dox index 4ae3f6e..7f56b36 100644 --- a/scribo/doc/scribo/binarization/otsu.dox +++ b/scribo/doc/scribo/binarization/otsu.dox @@ -1,6 +1,9 @@ /*! \defgroup grpalgobinotsu Otsu - * - * \brief Otsu's Binarization implementations. - * - * \ingroup grpalgobin + + \brief Otsu's Binarization implementations. + + This implementation is based on Ocropus's implementation. + http://code.google.com/p/ocropus/ + + \ingroup grpalgobin */ diff --git a/scribo/doc/scribo/binarization/wolf.dox b/scribo/doc/scribo/binarization/wolf.dox new file mode 100644 index 0000000..1dc87fe --- /dev/null +++ b/scribo/doc/scribo/binarization/wolf.dox @@ -0,0 +1,6 @@ +/*! \defgroup grpalgobinwolf Wolf + * + * \brief Wolf's Binarization implementations. + * + * \ingroup grpalgobin + */ diff --git a/scribo/doc/scribo/core/component_set.dox b/scribo/doc/scribo/core/component_set.dox new file mode 100644 index 0000000..ccde17c --- /dev/null +++ b/scribo/doc/scribo/core/component_set.dox @@ -0,0 +1,90 @@ +/*! + \class scribo::component_set + + This structure is used to store rich information related to + components in an image. + + It can be constructed directly from a labeled image and the number + of components, or using primitive::extract::components (easier and + recommanded) with a binary image. + + \code + mln::image2d<bool> ima; + mln::io::pbm::load(ima, "document.pbm"); + + typedef scribo::def::lbl_type V; + typedef mln::image2d<V> L; + V ncomps; + component_set<L> comps = primitive::extract::components(ima, c4(), ncomps); + \endcode + + Each component is associated to an id, \ref component_id_t. This + id is equivalent to the component label in the label image (\ref + labeled_image()). + + A component_set is considered as valid if it has been initialized + (i.e. not instantiated with the default constructor). + + On construction, information is automatically computed for each + components. To iterate over all the components and get that + information, use operator()() or info(): + + \code + for_all_comps(c,comps) + { + const scribo::component_info<L>& comp_info = comps.info(c); + + // Some code here... + } + \endcode + + Among component information, a component::Tag tag is stored and + used to mark specific components. This tag can be massively + updated for all components using update_tags(). The function + passed to this method must implement the following interface: + + \code + template <typename L> + struct my_function + : mln::Function_v2b< my_function<L> > + { + // Constructor + my_function(const scribo::component_set<L>& components) + : components_(components) + { + } + + // Core function + bool operator()(const mln_value(L)& l) const + { + if (l == mln::literal::zero) + return false; + return true;// your test here + } + + /// Component set. + scribo::component_set<L> components_; + }; + \endcode + + Tags can be used to filter/make a selection of + components. Routines performing this selection/filtering + automatically are listed in \ref grpalgofiltercomp section. + + Components considered as separators in the input image (lines, + blocks, ...) may be processed separately and are useful of the + rest of the layout analysis. This structure allows you to store a + binary image of separators which will be used in some routines to + prevent wrong regrouping. Note that no component information will + be computed for separators. The separator image can be managed + with has_separators(), add_separators(), separators(), and + clear_separators(). + + scribo::component_set is the first data structure in the + hierarchical representation of a document as explained in \ref + grpstruct. + + \sa component_info, component::Tag, component::Type, grpstruct, + grpalgofiltercomp. + +*/ \ No newline at end of file diff --git a/scribo/doc/scribo/filter/component_groups.dox b/scribo/doc/scribo/filter/component_groups.dox index 3cdc6e7..34b9c7d 100644 --- a/scribo/doc/scribo/filter/component_groups.dox +++ b/scribo/doc/scribo/filter/component_groups.dox @@ -1,4 +1,4 @@ -/*! \defgroup grpalgofiltercompgroup Component Groups +/*! \defgroup grpalgofiltercompgroup Component Group Filtering * * \brief Component groups filtering routines. * diff --git a/scribo/doc/scribo/filter/component_links.dox b/scribo/doc/scribo/filter/component_links.dox index f577dec..6b0fb99 100644 --- a/scribo/doc/scribo/filter/component_links.dox +++ b/scribo/doc/scribo/filter/component_links.dox @@ -1,4 +1,4 @@ -/*! \defgroup grpalgofiltercomplink Component Links +/*! \defgroup grpalgofiltercomplink Component Link Filtering * * \brief Component links filtering routines. * diff --git a/scribo/doc/scribo/filter/components.dox b/scribo/doc/scribo/filter/components.dox index 7a23912..f098ae8 100644 --- a/scribo/doc/scribo/filter/components.dox +++ b/scribo/doc/scribo/filter/components.dox @@ -1,4 +1,4 @@ -/*! \defgroup grpalgofiltercomp Components +/*! \defgroup grpalgofiltercomp Component Filtering * * \brief Component filtering routines. * diff --git a/scribo/doc/scribo/filter/elements.dox b/scribo/doc/scribo/filter/elements.dox index ce0720d..2b8b50c 100644 --- a/scribo/doc/scribo/filter/elements.dox +++ b/scribo/doc/scribo/filter/elements.dox @@ -1,4 +1,4 @@ -/*! \defgroup grpalgofilterelt Elements +/*! \defgroup grpalgofilterelt Element Filtering * * \brief Elements filtering routines. * diff --git a/scribo/doc/scribo/filter/line_links.dox b/scribo/doc/scribo/filter/line_links.dox index 9510d14..5206951 100644 --- a/scribo/doc/scribo/filter/line_links.dox +++ b/scribo/doc/scribo/filter/line_links.dox @@ -1,6 +1,6 @@ -/*! \defgroup grpalgofilterlinelink Line Links +/*! \defgroup grpalgofilterlinelink Line Link Filtering * - * \brief Line links filtering routines. + * \brief Line link filtering routines. * * \ingroup grpalgofilter */ diff --git a/scribo/doc/scribo/filter/paragraphs.dox b/scribo/doc/scribo/filter/paragraphs.dox index d0e4a3e..1c922d1 100644 --- a/scribo/doc/scribo/filter/paragraphs.dox +++ b/scribo/doc/scribo/filter/paragraphs.dox @@ -1,6 +1,6 @@ -/*! \defgroup grpalgofilterpar Paragraphs +/*! \defgroup grpalgofilterpar Paragraph Filtering * - * \brief Paragraphs filtering routines. + * \brief Paragraph filtering routines. * * \ingroup grpalgofilter */ diff --git a/scribo/doc/scribo/layout/layout.dox b/scribo/doc/scribo/layout/layout.dox new file mode 100644 index 0000000..4e72f3f --- /dev/null +++ b/scribo/doc/scribo/layout/layout.dox @@ -0,0 +1,6 @@ +/*! \defgroup grpalgolayout Layout Analysis + * + * \brief Document Layout Analysis algorithms. + * + * \ingroup grproutine + */ diff --git a/scribo/doc/scribo/namespaces.dox b/scribo/doc/scribo/namespaces.dox new file mode 100644 index 0000000..f35e86b --- /dev/null +++ b/scribo/doc/scribo/namespaces.dox @@ -0,0 +1,7 @@ +/*! \namespace scribo + \brief The main namespace of the Scribo module. +*/ + +/*! \namespace scribo::component + \brief Namespace of classes related to components. +*/ \ No newline at end of file diff --git a/scribo/doc/scribo/primitive/extract/components.dox b/scribo/doc/scribo/primitive/extract/components.dox new file mode 100644 index 0000000..60af13c --- /dev/null +++ b/scribo/doc/scribo/primitive/extract/components.dox @@ -0,0 +1,7 @@ +/*! \defgroup extractprimitivecomps Components Extraction + + \brief All routines/algorithms to extract components. + + \ingroup grproutine + +*/ \ No newline at end of file diff --git a/scribo/doc/scribo/primitive/extract/extract.dox b/scribo/doc/scribo/primitive/extract/extract.dox new file mode 100644 index 0000000..dde4ee7 --- /dev/null +++ b/scribo/doc/scribo/primitive/extract/extract.dox @@ -0,0 +1,7 @@ +/*! \defgroup extractprimitive Primitive Extraction + + \brief All routines/algorithms to extract primitive objects. + + \ingroup grproutine + +*/ \ No newline at end of file diff --git a/scribo/doc/scribo/primitive/extract/separators.dox b/scribo/doc/scribo/primitive/extract/separators.dox index 62f022b..6bd9917 100644 --- a/scribo/doc/scribo/primitive/extract/separators.dox +++ b/scribo/doc/scribo/primitive/extract/separators.dox @@ -1,6 +1,6 @@ /*! \defgroup extractprimitiveseps Lines and Separators extraction - * - * \brief All routines/algorithms to extract lines and separators. - * - * \ingroup grproutine + + \brief All routines/algorithms to extract lines and separators. + + \ingroup extractprimitive */ diff --git a/scribo/scribo/binarization/internal/local_threshold_core.hh b/scribo/scribo/binarization/internal/local_threshold_core.hh index af8d4aa..5de9761 100644 --- a/scribo/scribo/binarization/internal/local_threshold_core.hh +++ b/scribo/scribo/binarization/internal/local_threshold_core.hh @@ -69,9 +69,9 @@ namespace scribo /*! \brief Run Sauvola core algorithm. Use functor \p f to compute the threshold and perform computation. - \input[in] input An image. - \input[in] f Functor computing Sauvola's formula. - \input[in] window_size The window size. + \param[in] input An image. + \param[in] f Functor computing Sauvola's formula. + \param[in] window_size The window size. */ template <typename I, typename F> diff --git a/scribo/scribo/binarization/internal/singh_formula.hh b/scribo/scribo/binarization/internal/singh_formula.hh index e307a2c..e7627c0 100644 --- a/scribo/scribo/binarization/internal/singh_formula.hh +++ b/scribo/scribo/binarization/internal/singh_formula.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2012, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -59,20 +60,18 @@ namespace scribo /*! \brief Compute a threshold using Singh's formula. + \param[in] v The current image value. \param[in] m_x_y Mean value. - \param[in] s_x_y Standard deviation. - \param[in] k Control the threshold value in the local + \param[in] K Control the threshold value in the local window. The higher, the lower the threshold form the local mean m(x, y). - \param[in] R Maximum value of the standard deviation (128 - for grayscale documents). \return A threshold. */ double operator()(const V& v, const double m_x_y, const double K) const; - /*! - \overload K = 0.34. + /*! \overload + K = 0.34. */ double operator()(const V& v, const double m_x_y) const; diff --git a/scribo/scribo/binarization/kim.hh b/scribo/scribo/binarization/kim.hh index f0e066c..7495cfa 100644 --- a/scribo/scribo/binarization/kim.hh +++ b/scribo/scribo/binarization/kim.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2012, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -46,27 +47,14 @@ namespace scribo /*! \brief Kim's binarization - This algorithms performs a first rough binarization on the input - (here we use Sauvola's method). Then text lines are roughly - detected by grouping connected components. For each text lines, - character thickness and x height is computed. Finally, each - lines is binarized again, using text features as parameters for - adjusting the final threshold. - - This algorithms considers that global and local statistics - should be used to compute a threshold in text areas. - - This is an improvement of Sauvola's method. + \copydetails grpalgobinkim \param[in] input A gray-level image. \param[in] window_size the window size to be used for the first binarization. \param[in] k Sauvola's formula parameter. - This implementation is based on the paper "Multi-Window - Binarization of Camera Image for Document Recognition", In-Jung - Kim, Proceedings of the 9th International Workshop on Frontiers - in Handwriting Recognition (IWFHR-9 2004) + \ingroup grpalgobinkim */ template <typename I> mln_ch_value(I, bool) @@ -74,6 +62,8 @@ namespace scribo /*! \overload k is set to SCRIBO_DEFAULT_SAUVOLA_K. + + \ingroup grpalgobinkim */ template <typename I> mln_ch_value(I, bool) diff --git a/scribo/scribo/binarization/niblack_fast.hh b/scribo/scribo/binarization/niblack_fast.hh index 5143a4d..6e8f608 100644 --- a/scribo/scribo/binarization/niblack_fast.hh +++ b/scribo/scribo/binarization/niblack_fast.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010, 2011, 2012 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2009, 2010, 2011, 2012, 2013 EPITA Research and +// Development Laboratory (LRDE) // // This file is part of Olena. // @@ -50,12 +50,13 @@ namespace scribo is faster than the original implementation thanks to the use of integral images. - \input[in] input An image. - \input[in] window_size The window size. - \input[in] K Sauvola's formulae constant. + \param[in] input An image. + \param[in] window_size The window size. + \param[in] K Sauvola's formulae constant. \return A binary image. + \ingroup grpalgobinniblack */ template <typename I> mln_ch_value(I, bool) @@ -68,15 +69,18 @@ namespace scribo Sauvola's formulae constant K is set to SCRIBO_DEFAULT_NIBLACK_K. + \ingroup grpalgobinniblack */ template <typename I> mln_ch_value(I, bool) niblack_fast(const Image<I>& input, unsigned window_size); - /// \overload - /// The window size is set to 11. - // + /*! \overload + The window size is set to 11. + + \ingroup grpalgobinniblack + */ template <typename I> mln_ch_value(I, bool) niblack_fast(const Image<I>& input); diff --git a/scribo/scribo/binarization/niblack_threshold.hh b/scribo/scribo/binarization/niblack_threshold.hh index ceb9415..2106128 100644 --- a/scribo/scribo/binarization/niblack_threshold.hh +++ b/scribo/scribo/binarization/niblack_threshold.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -49,14 +49,12 @@ namespace scribo using namespace mln; - /*! \brief Compute an image of local threshold using Niblack algorithm. + /*! \brief Compute an image of local threshold using Niblack + algorithm. - \param[in] input A gray level image. - \param[in] window_size The window size. + \param[in] input A gray level image. + \param[in] window_size The window size. \param[in] K Controls the threshold value in the local window. - \param[out] simple The sum of all intensities of \p input. - \param[out] squared The sum of all squared intensities of \p - input. \return An image of local thresholds. diff --git a/scribo/scribo/binarization/otsu.hh b/scribo/scribo/binarization/otsu.hh index 2a8163d..8bb56ce 100644 --- a/scribo/scribo/binarization/otsu.hh +++ b/scribo/scribo/binarization/otsu.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -39,10 +40,9 @@ namespace scribo using namespace mln; - /*! An implementation of Otsu's binarization algorithm. + /*! \brief An implementation of Otsu's binarization algorithm. - It is based on Ocropus's implementation. - http://code.google.com/p/ocropus/ + \copydetails grpalgobinotsu \param[in] input A gray-scale image. diff --git a/scribo/scribo/binarization/otsu_threshold.hh b/scribo/scribo/binarization/otsu_threshold.hh index 1ee4b42..99ad6b1 100644 --- a/scribo/scribo/binarization/otsu_threshold.hh +++ b/scribo/scribo/binarization/otsu_threshold.hh @@ -42,16 +42,16 @@ namespace scribo using namespace mln; - /*! Compute a global binarization threshold using Otsu's algorithm. + /*! \brief Compute a global binarization threshold using Otsu's + algorithm. - It is based on Ocropus's implementation. - http://code.google.com/p/ocropus/ + \copydetails grpalgobinotsu - \param[in] input A gray-scale image. + \param[in] input A gray-scale image. - \return A global threshold value. + \return A global threshold value. - \ingroup grpalgobinotsu + \ingroup grpalgobinotsu */ template <typename I> mln_value(I) diff --git a/scribo/scribo/binarization/sauvola_ms_split.hh b/scribo/scribo/binarization/sauvola_ms_split.hh index c577d52..330a2cc 100644 --- a/scribo/scribo/binarization/sauvola_ms_split.hh +++ b/scribo/scribo/binarization/sauvola_ms_split.hh @@ -72,23 +72,26 @@ namespace scribo */ template <typename I> mln_ch_value(I, bool) - sauvola_ms_split(const Image<I>& input_1_, unsigned w_1, + sauvola_ms_split(const Image<I>& input_1, unsigned w_1, unsigned s, unsigned min_ntrue, double k2, double k3, double k4); - /// \overload - /// k2, k3 and k4 are set to \p K. + /*! \overload + k2, k3 and k4 are set to \p K. + + \ingroup grpalgobinsauvola + */ template <typename I> mln_ch_value(I, bool) sauvola_ms_split(const Image<I>& input_1, unsigned w_1, unsigned s, unsigned min_ntrue, double K); - /// \overload - /// k2, k3 and k4 are set to 0.34. - /// - /// \ingroup grpalgobinsauvola - // + /*! \overload + k2, k3 and k4 are set to 0.34. + + \ingroup grpalgobinsauvola + */ template <typename I> mln_ch_value(I, bool) sauvola_ms_split(const Image<I>& input_1, unsigned w_1, diff --git a/scribo/scribo/binarization/singh.hh b/scribo/scribo/binarization/singh.hh index d66fd04..ae84d62 100644 --- a/scribo/scribo/binarization/singh.hh +++ b/scribo/scribo/binarization/singh.hh @@ -45,9 +45,9 @@ namespace scribo /*! \brief Convert an image into a binary image. - \input[in] input An image. - \input[in] window_size The window size. - \input[in] K Singh's formulae constant. + \param[in] input An image. + \param[in] window_size The window size. + \param[in] K Singh's formulae constant. \return A binary image. @@ -62,8 +62,8 @@ namespace scribo Singh's formulae constant K is set to 0.34. - \input[in] input An image. - \input[in] window_size The window size. + \param[in] input An image. + \param[in] window_size The window size. \return A binary image. diff --git a/scribo/scribo/binarization/wolf.hh b/scribo/scribo/binarization/wolf.hh index aadf2af..840d69f 100644 --- a/scribo/scribo/binarization/wolf.hh +++ b/scribo/scribo/binarization/wolf.hh @@ -47,9 +47,9 @@ namespace scribo /*! \brief Convert an image into a binary image. - \input[in] input An image. - \input[in] window_size The window size. - \input[in] K Wolf's formulae constant. + \param[in] input An image. + \param[in] window_size The window size. + \param[in] K Wolf's formulae constant. \return A binary image. @@ -57,6 +57,7 @@ namespace scribo Enhancement and Binarization in Multimedia Documents", Christian Wolf, Jean-Michel Jolion, Françoise Chassaing, ICPR 2002. + \ingroup grpalgobinwolf */ template <typename I> mln_ch_value(I, bool) @@ -68,20 +69,23 @@ namespace scribo Wolf's formulae constant K is set to 0.34. - \input[in] input An image. - \input[in] window_size The window size. + \param[in] input An image. + \param[in] window_size The window size. \return A binary image. + \ingroup grpalgobinwolf */ template <typename I> mln_ch_value(I, bool) wolf(const Image<I>& input, unsigned window_size); - /// \overload - /// The window size is set to 11. - // + /*! \overload + The window size is set to 11. + + \ingroup grpalgobinwolf + */ template <typename I> mln_ch_value(I, bool) wolf(const Image<I>& input); diff --git a/scribo/scribo/binarization/wolf_fast.hh b/scribo/scribo/binarization/wolf_fast.hh index e0cf56d..a984532 100644 --- a/scribo/scribo/binarization/wolf_fast.hh +++ b/scribo/scribo/binarization/wolf_fast.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2012, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -46,9 +47,9 @@ namespace scribo /*! \brief Convert an image into a binary image. - \input[in] input An image. - \input[in] window_size The window size. - \input[in] K Wolf's formulae constant. + \param[in] input An image. + \param[in] window_size The window size. + \param[in] K Wolf's formulae constant. \return A binary image. @@ -60,6 +61,7 @@ namespace scribo is faster than the original implementation thanks to the use of integral images. + \ingroup grpalgobinwolf */ template <typename I> mln_ch_value(I, bool) @@ -71,15 +73,18 @@ namespace scribo Wolf's formulae constant K is set to 0.34. + \ingroup grpalgobinwolf */ template <typename I> mln_ch_value(I, bool) wolf_fast(const Image<I>& input, unsigned window_size); - /// \overload - /// The window size is set to 11. - // + /*! \overload + The window size is set to 11. + + \ingroup grpalgobinwolf + */ template <typename I> mln_ch_value(I, bool) wolf_fast(const Image<I>& input); diff --git a/scribo/scribo/core/component_info.hh b/scribo/scribo/core/component_info.hh index b42787f..d8e3381 100644 --- a/scribo/scribo/core/component_info.hh +++ b/scribo/scribo/core/component_info.hh @@ -47,9 +47,19 @@ namespace scribo // Forward declarations. template <typename L> class component_set; + /*! \brief The type of the component ids. + + This id is mainly used in structures like scribo::component_set + and scribo::component_info structures. It refers to the actual + label used in the underlying labeled component image stored in + scribo::component_set. + */ typedef mln::util::object_id<scribo::ComponentId, unsigned> component_id_t; + /*! \brief Component information data structure. + + */ template <typename L> class component_info : public Serializable<component_info<L> > { diff --git a/scribo/scribo/core/component_set.hh b/scribo/scribo/core/component_set.hh index 32eb636..789c752 100644 --- a/scribo/scribo/core/component_set.hh +++ b/scribo/scribo/core/component_set.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -74,7 +74,10 @@ namespace scribo namespace internal { - /// Data structure for \c scribo::component_set<I>. + /*! \internal \brief Data structure for \c scribo::component_set. + + \ingroup grpstruct + */ template <typename L> struct component_set_data { @@ -118,10 +121,10 @@ namespace scribo } // end of namespace scribo::internal - /// \brief Represents all the components in a document image. - /// - /// \ingroup grpstruct - // + /*! \brief Represents all the components in a document image. + + \ingroup grpstruct + */ template <typename L> class component_set : public Serializable<component_set<L> > { @@ -139,27 +142,31 @@ namespace scribo public: - /// Constructors - /// @{ - /// Constructor without argument. + // Constructors + + /// Default. component_set(); - // Constructor from internal data. + /// Constructor from internal data. component_set(const mln::util::tracked_ptr<data_t>& data); - /// Constructor from an image \p ima and the number of labels \p ncomps. + /// Constructor from an image \p ima and the number of labels \p + /// ncomps. component_set(const L& ima, const mln_value(L)& ncomps); - /// Constructor from an image \p ima, the number of labels \p ncomps and - /// attributes values (bounding box and mass center). + /// Constructor from an image \p ima, the number of labels \p + /// ncomps and attributes values (bounding box and mass center). component_set(const L& ima, const mln_value(L)& ncomps, const mln::util::array<pair_accu_t>& attribs, component::Type type = component::Undefined); + /// Constructor from an image \p ima, the number of labels \p + /// ncomps and attributes values (bounding box and mass center). component_set(const L& ima, const mln_value(L)& ncomps, const mln::util::array<pair_data_t>& attribs, component::Type type = component::Undefined); - /// @} + + // Misc Members /// Return the component count. mln_value(L) nelements() const; @@ -177,7 +184,8 @@ namespace scribo const component_info<L>& operator()(const component_id_t& id) const; - /// Update tag of components set to 'false' in \p f with \p tag. + /// Update component tag for which \p f returns 'False', with \p + /// tag. template <typename F> void update_tags(const mln::Function_v2b<F>& f, component::Tag tag); @@ -187,55 +195,66 @@ namespace scribo /// Return the underlying labeled image const L& labeled_image() const; - /// Is this component set valid? + /// A component_set is considered as valid if it has been + /// initialized (i.e. not instantiated with the default + /// constructor). bool is_valid() const; - /// Separators components related routines. - /// @{ + // Separators components related routines. /// Return true if an image of separator exists. bool has_separators() const; - /// Add separators in the underlying labeled image. + /// Add a new separator binary image or perform a logical OR with + /// the existing one. void add_separators(const mln_ch_value(L, bool)& ima); - /// Return the Boolean image of separators. + /// Return the binary image of separators. const mln_ch_value(L, bool)& separators() const; - /// Remove any existing separators. + /// Clear separator image. void clear_separators(); - /// @} - - - /// Internal methods - /// @{ + // Internal methods + /// \internal /// Return all the component infos. + // const mln::util::array<scribo::component_info<L> >& infos_() const; + /// \internal /// Unique set Id. + // id_t id_() const; + /// \internal /// Read/Write access to the underlying labeled image. - /// Careful! Write in this image at your own risks! It may lead to + /// + /// \warning Write in this image at your own risks! It may lead to /// non-synchronised related data. // L& labeled_image_(); + /// \internal + /// Force replacing the underlying labeled image. \warning Use it + /// at your own risks... This image may not + /// + /// reflect the component information stored in this + /// component_set. + // void update_labeled_image_(const L& lbl); + /// \internal /// Return the underlying labeled image where invalid components /// have been erased. /// - /// WARNING: this image is computed on the fly...! + /// \warning this image is computed on the fly...! // mln_concrete(L) valid_comps_image_() const; - /// @} protected: /// Duplicate the underlying image and create a new component_set. diff --git a/scribo/scribo/core/concept/serializable.hh b/scribo/scribo/core/concept/serializable.hh index 6e661a6..e016667 100644 --- a/scribo/scribo/core/concept/serializable.hh +++ b/scribo/scribo/core/concept/serializable.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -28,7 +29,7 @@ /// \file /// -/// Concept for serializer visitors. +/// Concept for objects that can be serialized. # include <mln/core/concept/object.hh> # include <scribo/core/concept/serialize_visitor.hh> @@ -36,11 +37,13 @@ namespace scribo { - /// \brief Link functor concept. + /// \brief Concept for objects that can be serialized. template <typename E> class Serializable : public mln::Object<E> { public: + + /// Allow this object to be serialized by \p visitor. template <typename E2> void accept(const SerializeVisitor<E2>& visitor) const; }; diff --git a/scribo/scribo/core/object_links.hh b/scribo/scribo/core/object_links.hh index a2543a7..0515d84 100644 --- a/scribo/scribo/core/object_links.hh +++ b/scribo/scribo/core/object_links.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -94,7 +94,7 @@ namespace scribo bool has_linking_enabled(unsigned comp_id) const; /// Return True if component \p comp_id has a link starting from - /// itself to another one. + /// itself to another component. bool is_linked(unsigned comp_id) const; unsigned nelements() const; @@ -108,8 +108,8 @@ namespace scribo /// linked later. void clear(unsigned id); - /// Do not allow component with id \p id to be linked to anyother - /// ones. + /// Do not allow component with id \p id to be linked to another + /// component. void disable_linking(unsigned id); /// Get link id for component \p comp_id. diff --git a/scribo/scribo/core/tag/component.hh b/scribo/scribo/core/tag/component.hh index d5afb36..5cf62fc 100644 --- a/scribo/scribo/core/tag/component.hh +++ b/scribo/scribo/core/tag/component.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -27,48 +27,70 @@ #ifndef SCRIBO_CORE_TAG_COMPONENT_HH # define SCRIBO_CORE_TAG_COMPONENT_HH -# include <iostream> - /// \file /// /// \brief Component tags. +# include <iostream> + namespace scribo { - // Component id tag. + /// Component id tag. struct ComponentId; - namespace component { + /*! \brief All possible tags that can be used for components. + + component::Tag values can be converted to String using + operator<<(std::ostream &ostr, const Tag &tag). String values + can be converted to component::Tag using str2tag(). + + \sa scribo::component_set scribo::component_info + */ enum Tag { - None = 0, - Ignored + None = 0, ///< No tag set. + Ignored ///< To be ignored in further processing. }; + /*! \brief All possible types of components. + + component::Type values can be converted to String using + operator<<(std::ostream &ostr, const Type &type). String values + can be converted to component::Type using str2type(). + + \sa scribo::component_set scribo::component_info str2type() + */ enum Type { - Undefined = 0, - Character, - VerticalLineSeparator, - HorizontalLineSeparator, - WhitespaceSeparator, - Noise, - Punctuation, - Image, - DropCapital + Undefined = 0, ///< No type defined. + Character, ///< Character. + VerticalLineSeparator, ///< Vertical line separator. + HorizontalLineSeparator, ///< Horizontal line separator. + WhitespaceSeparator, ///< whitespace separator. + Noise, ///< Noise. + Punctuation, ///< Punctuation. + Image, ///< Image. + DropCapital ///< Drop capital. }; + /// \brief Operator allowing scribo::component::Tag to be printed + /// out. std::ostream& operator<<(std::ostream& ostr, const Tag& tag); + + /// \brief Convert a std::string to a scribo::component::Tag. Tag str2tag(const std::string& str); + /// \brief Operator allowing scribo::component::Type to be printed + /// out. std::ostream& operator<<(std::ostream& ostr, const Type& type); + /// \brief Convert a std::string to a scribo::component::Type. Type str2type(const std::string& str); @@ -176,4 +198,4 @@ namespace scribo } // end of namespace scribo -#endif // ! SCRIBO_CORE_TAG_COMP_HH +#endif // ! SCRIBO_CORE_TAG_COMPONENT_HH diff --git a/scribo/scribo/debug/logger.hh b/scribo/scribo/debug/logger.hh index 5c0fcbe..b65b04a 100644 --- a/scribo/scribo/debug/logger.hh +++ b/scribo/scribo/debug/logger.hh @@ -50,8 +50,8 @@ namespace scribo /*! \brief Enum defining different level of image logging - According to the debug level set in #logger_ the image may - be saved or not. + According to the debug level set in scribo::debug::logger_ the + image may be saved or not. */ enum Level { @@ -65,8 +65,8 @@ namespace scribo /*! \brief Enum defining different modes of text logging - According to the verbose mode set in #logger_ the text may - be logged or not. + According to the verbose mode set in scribo::debug::logger_ the + text may be logged or not. */ enum VerboseMode { diff --git a/scribo/scribo/filter/paragraphs_in_borders.hh b/scribo/scribo/filter/paragraphs_in_borders.hh index e05534c..f32ba44 100644 --- a/scribo/scribo/filter/paragraphs_in_borders.hh +++ b/scribo/scribo/filter/paragraphs_in_borders.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -46,29 +47,30 @@ namespace scribo using namespace mln; - /// \brief Invalidate paragraphs located close to the image borders. - /// - /// \param[in,out] doc A document structure. - /// - /// Warning: it does not remove paragraphs from separator - /// image. It only invalidate separator components in their - /// respective component_set. - /// - /// \verbatim - /// - /// ----------- - /// |_!____!__| - /// | ! ! <--------- Paragraphs located in this area are - /// | ! ! | invalidated. - /// | ! ! | - /// |_!____!__| - /// | ! ! | - /// ----------- - /// - /// \endverbatim - /// - /// \ingroup grpalgofilterpar - // + /*! \brief Invalidate paragraphs located close to the image + borders. + + \param[in,out] doc A document structure. + + Warning: it does not remove paragraphs from separator + image. It only invalidate separator components in their + respective component_set. + + \verbatim + + ----------- + |_!____!__| + | ! ! <--------- Paragraphs located in this area are + | ! ! | invalidated. + | ! ! | + |_!____!__| + | ! ! | + ----------- + + \endverbatim + + \ingroup grpalgofilterpar + */ template <typename L> void paragraphs_in_borders(document<L>& doc); diff --git a/scribo/scribo/filter/separators_in_borders.hh b/scribo/scribo/filter/separators_in_borders.hh index 304e785..ae9ff70 100644 --- a/scribo/scribo/filter/separators_in_borders.hh +++ b/scribo/scribo/filter/separators_in_borders.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -46,36 +47,36 @@ namespace scribo using namespace mln; - /// \brief Invalidate separators located close to the image - /// borders. - /// - /// \param[in,out] doc A document structure. - /// \param[in] vratio Ratio to be used for evaluating the inner - /// border size in which vertical separators - /// will be invalidated. - /// \param[in] hratio Ratio to be used for evaluating the inner - /// border size in which horizontal separators - /// will be invalidated. - /// - /// Warning: it does not remove separators from separator - /// image. It only invalidate separator components in their - /// respective component_set. - /// - /// \verbatim - /// - /// ----------- - /// |_!____!__| - /// | ! ! <--------- Separators located in this area are - /// | ! ! | invalidated. - /// | ! ! | - /// |_!____!__| - /// | ! ! | - /// ----------- - /// - /// \endverbatim - /// - /// \ingroup grpalgofilterelt - // + /*! \brief Invalidate separators located close to the image + borders. + + \param[in,out] doc A document structure. + \param[in] vratio Ratio to be used for evaluating the inner + border size in which vertical separators + will be invalidated. + \param[in] hratio Ratio to be used for evaluating the inner + border size in which horizontal separators + will be invalidated. + + \warning it does not remove separators from separator image. It + only invalidate separator components in their respective + component_set. + + \verbatim + + ----------- + |_!____!__| + | ! ! <--------- Separators located in this area are + | ! ! | invalidated. + | ! ! | + |_!____!__| + | ! ! | + ----------- + + \endverbatim + + \ingroup grpalgofilterelt + */ template <typename L> void separators_in_borders(document<L>& doc, float vratio, float hratio); diff --git a/scribo/scribo/filter/separators_vert_in_borders.hh b/scribo/scribo/filter/separators_vert_in_borders.hh index a20625c..a836554 100644 --- a/scribo/scribo/filter/separators_vert_in_borders.hh +++ b/scribo/scribo/filter/separators_vert_in_borders.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -48,30 +49,30 @@ namespace scribo using namespace mln; - /// \brief Invalidate vertical separators located close to the image - /// borders. - /// - /// \param[in,out] doc A document structure. - /// - /// Warning: it does not remove separators from separator - /// image. It only invalidate separator components in their - /// respective component_set. - /// - /// \verbatim - /// - /// ----------- - /// |_!____!__| - /// | ! ! <--------- Separators located in this area are - /// | ! ! | invalidated. - /// | ! ! | - /// |_!____!__| - /// | ! ! | - /// ----------- - /// - /// \endverbatim - /// - /// \ingroup grpalgofilterelt - // + /*! \brief Invalidate vertical separators located close to the image + borders. + + \param[in,out] doc A document structure. + + Warning: it does not remove separators from separator + image. It only invalidate separator components in their + respective component_set. + + \verbatim + + ----------- + |_!____!__| + | ! ! <--------- Separators located in this area are + | ! ! | invalidated. + | ! ! | + |_!____!__| + | ! ! | + ----------- + + \endverbatim + + \ingroup grpalgofilterelt + */ template <typename L> void separators_vert_in_borders(document<L>& doc); diff --git a/scribo/scribo/layout/xy_cut.hh b/scribo/scribo/layout/xy_cut.hh index d3d5227..b55d51c 100644 --- a/scribo/scribo/layout/xy_cut.hh +++ b/scribo/scribo/layout/xy_cut.hh @@ -48,19 +48,21 @@ namespace scribo using namespace mln; /// \brief XY-Cut layout analysis algorithm. - /*! This algorithm is an implementation made from \cite - nagy.1992.computer7 : "A prototype document image analysis - system for technical journals.". + /*! This algorithm is an implementation inspired by + \cite nagy1992computer, \cite kruatrachue2005waset and + \cite meunier2005icdar. It recusively subdivides empty spaces in the document until a minimum division size is reached. The latter is defined with \p min_height and \p min_width. - \input[in] ima A binary image. - \input[in] min_height The minimum height of a subdivision. - \input[in] min_width The minimum width of a subdivision. + \param[in] ima A binary image. + \param[in] min_height The minimum height of a subdivision. + \param[in] min_width The minimum width of a subdivision. \return An array of component group bounding boxes. + + \ingroup grpalgolayout */ template <typename I> mln::util::array<mln_box(I)> diff --git a/scribo/scribo/primitive/extract/components.hh b/scribo/scribo/primitive/extract/components.hh index ef55c09..db13967 100644 --- a/scribo/scribo/primitive/extract/components.hh +++ b/scribo/scribo/primitive/extract/components.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2011, 2013 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2011, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -63,17 +63,19 @@ namespace scribo using namespace mln; - /// \brief Extract components in a binary image. - /// - /// \param[in] input A RGB image. - /// \param[in] binary_input A binary image. Components must be set to 'True'. - /// and background to 'false'. - /// \param[in] nbh A neighborhood to be used for labeling. - /// \param[in,out] ncomponents Will store the numbers of components found. - /// \param[in] type The default component type set to components. - /// - /// \return An image of labeled components. - // + /*! \brief Extract components in a binary image. + + \param[in] input A RGB image. + \param[in] binary_input A binary image. Components must be set to 'True'. + and background to 'false'. + \param[in] nbh A neighborhood to be used for labeling. + \param[in,out] ncomponents Will store the numbers of components found. + \param[in] type The default component type set to components. + + \return An image of labeled components. + + \ingroup extractprimitivecomps + */ template <typename I, typename J, typename N, typename V> inline component_set<mln_ch_value(I,V)> @@ -82,6 +84,18 @@ namespace scribo component::Type type = component::Undefined); + /*! \overload + + \param[in] binary_input A binary image. Components must be set to 'True'. + and background to 'false'. + \param[in] nbh A neighborhood to be used for labeling. + \param[in,out] ncomponents Will store the numbers of components found. + \param[in] type The default component type set to components. + + \return A component_set. + + \ingroup extractprimitivecomps + */ template <typename I, typename N, typename V> inline component_set<mln_ch_value(I,V)> diff --git a/scribo/scribo/primitive/extract/lines_v_single.hh b/scribo/scribo/primitive/extract/lines_v_single.hh index 2d5d88a..c2ab1ca 100644 --- a/scribo/scribo/primitive/extract/lines_v_single.hh +++ b/scribo/scribo/primitive/extract/lines_v_single.hh @@ -57,7 +57,7 @@ namespace scribo * \param[in] input A binary image. * \param[in] nbh The neighborhood used for labeling image * components. - * \param[in,out] nlines Type used for labeling. + * \param[in] nlines Type used for labeling. * \param[in] min_line_length The minimum line length. * \param[in] h_w_ratio The minimum ratio height/width object * bounding boxes to consider an diff --git a/scribo/scribo/subsampling/bilinear.hh b/scribo/scribo/subsampling/bilinear.hh index aba09c8..e992761 100644 --- a/scribo/scribo/subsampling/bilinear.hh +++ b/scribo/scribo/subsampling/bilinear.hh @@ -49,8 +49,8 @@ namespace scribo /// \brief Bilinear subsampling. /*! - \input[in] input An image. - \input[in] sub_ratio The subsampling size ratio. + \param[in] input An image. + \param[in] sub_ratio The subsampling size ratio. */ template <typename I> mln_concrete(I) diff --git a/scribo/scribo/text/merging_hdoc.hh b/scribo/scribo/text/merging_hdoc.hh index 4c6a7c4..5065338 100644 --- a/scribo/scribo/text/merging_hdoc.hh +++ b/scribo/scribo/text/merging_hdoc.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010, 2011, 2012 EPITA Research and Development +// Copyright (C) 2010, 2011, 2012, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -73,15 +73,15 @@ namespace scribo /*! \brief Merge text component in order to reconstruct text lines in old documents. - \param[in] lines A line set. + \param[in] lines A line set. - \return A new line set. Line ids are preserved and merged - lines (not valid anymore) are tagged with line::Merged. The - lines produced with this algorithm (valid lines) are tagged - with line::None. Line type is also set either with line::Text - or line::Punctuation. + \return A new line set. Line ids are preserved and merged + lines (not valid anymore) are tagged with line::Merged. The + lines produced with this algorithm (valid lines) are tagged + with line::None. Line type is also set either with line::Text + or line::Punctuation. - \ingroup grptext + \ingroup grptext */ template <typename L> line_set<L> @@ -505,24 +505,6 @@ namespace scribo const box2d& l_ted_ebbox = l_ted.ebbox(); -// std::cout << "top_row = " << top_row << " - bot_row = " << bot_row << std::endl; -// std::cout << std::abs(bot_row - l_ted.baseline()) -// << " - d " -// << std::abs(bot_row - l_ted.descent()) -// << " - dd " -// << std::abs(bot_row - l_ted.ebbox().pmax().row()) -// << " - " -// << std::abs(top_row - l_ted.meanline()) -// << " - a " -// << std::abs(top_row - l_ted.ascent()) -// << " - aa " -// << std::abs(top_row - l_ted.ebbox().pmin().row()) -// << " - " -// << l_ted.ascent() -// << " - " -// << l_ted.descent() -// << std::endl; - if ((std::abs(bot_row - l_ted.baseline()) < 5 || std::abs(bot_row - l_ted_ebbox.pmax().row()) < 5) && @@ -554,13 +536,13 @@ namespace scribo if already merged continue - /// - /// x-----------x - /// | | - /// x x x - /// | | - /// x-----------x - /// + + x-----------x + | | + x x x + | | + x-----------x + Set labels <- Every labels corresponding to the colliding bounding boxes (uses only the 7 sites detailled above). @@ -764,30 +746,17 @@ namespace scribo l = do_union(lines, l, mc, parent); // } -// std::cout << "weird: inclusion of a txt_line in a txt_line!" << std::endl; - - /// Merge is perform if the current line is a - /// petouille considered as a line. -// if ((std::abs(lines(l).ascent() - lines(mc).ascent()) >= 5) -// || (std::abs(lines(l).descent() - lines(mc).descent()) >= 5)) -// continue; - -// // FIXME: Is it valid? -// // A text line is included in another text line. -// // They are merged. -// // -// l_ = do_union(lines, mc, l, parent); -// draw_box(billboard, lines(l_).ebbox(), l_); - # ifndef SCRIBO_NDEBUG // Log: draw_box(log, b, 126); # endif // ! SCRIBO_NDEBUG } - else // FIXME: Remove! since included in a non-text-line, so not drawn, so inclusion impossible!!!!!!!!!! + else // FIXME: Remove! since included in a + // non-text-line, so not drawn, so inclusion + // impossible!!!!!!!!!! { - std::cout << "error: should NOT happen (a text line included in a NON-text-line (so not drawn!!!)" << std::endl; + std::cerr << "error: should NOT happen (a text line included in a NON-text-line (so not drawn!!!)" << std::endl; ++count_txtline_IN_junk; // a non-text-line (probably a drawing or a frame) includes a text line @@ -976,32 +945,7 @@ namespace scribo } -// std::cout -// << " new txtline = " << count_new_txtline << std::endl -// << " comp IN txtline = " << count_comp_IN_txtline << std::endl -// << " 2 lines merge = " << count_two_lines_merge << std::endl -// << " comp HITS txtline = " << count_comp_HITS_txtline << std::endl -// << " txtline IN junk = " << count_txtline_IN_junk << std::endl -// << " txtline IN txtline = " << count_txtline_IN_txtline << std::endl -// << " WTF! = " << count_WTF << std::endl; - - (void) ith_pass; -// if (ith_pass == 1) -// { -// mln::io::pgm::save(log, "log_1.pgm"); -// mln::io::pgm::save(data::wrap(int_u8(), billboard), "log_1e.pgm"); -// } -// else if (ith_pass == 2) -// { -// mln::io::pgm::save(log, "log_2.pgm"); -// mln::io::pgm::save(data::wrap(int_u8(), billboard), "log_2e.pgm"); -// } -// else if (ith_pass == 3) -// { -// mln::io::pgm::save(log, "log_3.pgm"); -// mln::io::pgm::save(data::wrap(int_u8(), billboard), "log_3e.pgm"); -// } } @@ -1055,9 +999,6 @@ namespace scribo // Sort lines by bbox.nelements() and ids. std::sort(v.begin(), v.end(), func); -// mln::util::timer t; - - // Setting lines as text lines according to specific criterions. for_all_lines(l, lines) if (looks_like_a_text_line(lines(l))) @@ -1065,13 +1006,9 @@ namespace scribo // First pass -// t.start(); one_merge_pass(1, input_domain, v, lines, parent); -// float ts = t.stop(); -// std::cout << "time " << ts << std::endl; - -// lines.force_stats_update(); + //lines.force_stats_update(); // Sort lines by bbox.nelements() and ids again! // line may have grown differently since the first pass. @@ -1079,10 +1016,7 @@ namespace scribo // Second pass -// t.start(); one_merge_pass(2, input_domain, v, lines, parent); // <- last pass -// ts = t.stop(); -// std::cout << "time " << ts << std::endl; lines.force_stats_update(); @@ -1101,15 +1035,9 @@ namespace scribo { using namespace mln; -// mln::util::timer t; -// t.start(); - scribo::line_set<L> output = internal::draw_boxes(lines.components().labeled_image().domain(), lines); -// float ts = t.stop(); -// std::cout << ts << std::endl; - return output; } -- 1.7.2.5
participants (1)
-
Guillaume Lazzara