last-svn-commit-829-g59dd554 scribo/text/extract_lines_wo_merge.hh: New line extraction routine.

--- scribo/ChangeLog | 5 ++ ...{extract_lines.hh => extract_lines_wo_merge.hh} | 65 ++++++++++++++------ 2 files changed, 51 insertions(+), 19 deletions(-) copy scribo/scribo/text/{extract_lines.hh => extract_lines_wo_merge.hh} (66%) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 048a289..e81959d 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,8 @@ +2011-04-05 Guillaume Lazzara <z@lrde.epita.fr> + + * scribo/text/extract_lines_wo_merge.hh: New line extraction + routine. + 2011-03-22 Guillaume Lazzara <z@lrde.epita.fr> * demo/viewer/xml_widget.cc: Fix a warning. diff --git a/scribo/scribo/text/extract_lines.hh b/scribo/scribo/text/extract_lines_wo_merge.hh similarity index 66% copy from scribo/scribo/text/extract_lines.hh copy to scribo/scribo/text/extract_lines_wo_merge.hh index e69a249..0d90600 100644 --- a/scribo/scribo/text/extract_lines.hh +++ b/scribo/scribo/text/extract_lines_wo_merge.hh @@ -1,5 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,8 +23,8 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef SCRIBO_TEXT_EXTRACT_LINES_HH -# define SCRIBO_TEXT_EXTRACT_LINES_HH +#ifndef SCRIBO_TEXT_EXTRACT_LINES_WO_MERGE_HH +# define SCRIBO_TEXT_EXTRACT_LINES_WO_MERGE_HH /// \file /// @@ -36,6 +35,7 @@ # include <scribo/core/def/lbl_type.hh> # include <scribo/core/line_set.hh> +# include <scribo/core/document.hh> # include <scribo/primitive/extract/components.hh> @@ -72,33 +72,63 @@ namespace scribo */ template <typename I, typename N> line_set<mln_ch_value(I,scribo::def::lbl_type)> - extract_lines(const Image<I>& input_, const Neighborhood<N>& nbh_, - const mln_ch_value(I,bool)& separators); + extract_lines_wo_merge(const Image<I>& input_, const Neighborhood<N>& nbh_, + const mln_ch_value(I,bool)& separators); /// \overload template <typename I, typename N> line_set<mln_ch_value(I,scribo::def::lbl_type)> - extract_lines(const Image<I>& input, const Neighborhood<N>& nbh); + extract_lines_wo_merge(const Image<I>& input, const Neighborhood<N>& nbh); + /// \overload + template <typename L, typename N> + line_set<mln_ch_value(L,scribo::def::lbl_type)> + extract_lines_wo_merge(const document<L>& doc, const Neighborhood<N>& nbh); + + /// \overload + template <typename L, typename N> + line_set<mln_ch_value(L,scribo::def::lbl_type)> + extract_lines_wo_merge(const document<L>& doc, const Neighborhood<N>& nbh, + const mln_ch_value(L,bool)& separators); # ifndef MLN_INCLUDE_ONLY + template <typename L, typename N> + line_set<mln_ch_value(L,scribo::def::lbl_type)> + extract_lines_wo_merge(const document<L>& doc, const Neighborhood<N>& nbh) + { + mln_precondition(doc.is_valid()); + mln_ch_value(L,bool) seps; + return extract_lines_wo_merge(doc.binary_image(), nbh, seps); + } + + + template <typename L, typename N> + line_set<mln_ch_value(L,scribo::def::lbl_type)> + extract_lines_wo_merge(const document<L>& doc, const Neighborhood<N>& nbh, + const mln_ch_value(L,bool)& separators) + { + mln_precondition(doc.is_valid()); + return extract_lines_wo_merge(doc.binary_image(), nbh, separators); + } + + template <typename I, typename N> line_set<mln_ch_value(I,scribo::def::lbl_type)> - extract_lines(const Image<I>& input, const Neighborhood<N>& nbh) + extract_lines_wo_merge(const Image<I>& input, const Neighborhood<N>& nbh) { mln_ch_value(I,bool) seps; - return extract_lines(input, nbh, seps); + return extract_lines_wo_merge(input, nbh, seps); } template <typename I, typename N> line_set<mln_ch_value(I,scribo::def::lbl_type)> - extract_lines(const Image<I>& input_, const Neighborhood<N>& nbh_, - const mln_ch_value(I,bool)& separators) + extract_lines_wo_merge(const Image<I>& input_, const Neighborhood<N>& nbh_, + const mln_ch_value(I,bool)& separators) { - trace::entering("scribo::text::extract_lines"); + trace::entering("scribo::text::extract_lines_wo_merge"); const I& input = exact(input_); const N& nbh = exact(nbh_); @@ -123,15 +153,13 @@ namespace scribo object_links<L> left_link = primitive::link::with_single_left_link_dmax_ratio( comps, - primitive::link::internal::dmax_width_and_height(1), -// primitive::link::internal::dmax_default(1), + primitive::link::internal::dmax_default(1), anchor::MassCenter); object_links<L> right_link = primitive::link::with_single_right_link_dmax_ratio( comps, - primitive::link::internal::dmax_width_and_height(1), -// primitive::link::internal::dmax_default(1), + primitive::link::internal::dmax_default(1), anchor::MassCenter); // Validating left and right links. @@ -147,9 +175,8 @@ namespace scribo groups = primitive::group::from_single_link(hratio_filtered_links); line_set<L> lines(groups); - lines = text::merging(lines); - trace::exiting("scribo::text::extract_lines"); + trace::exiting("scribo::text::extract_lines_wo_merge"); return lines; } @@ -159,4 +186,4 @@ namespace scribo } // end of namespace scribo -#endif // ! SCRIBO_TEXT_EXTRACT_LINES_HH +#endif // ! SCRIBO_TEXT_EXTRACT_LINES_WO_MERGE_HH -- 1.5.6.5
participants (1)
-
Guillaume Lazzara