Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
* binarization/sauvola.hh: New routine.
* src/binarization/Makefile.am,
* src/binarization/sauvola.cc,
* src/binarization/sauvola_pgm.cc: New examples.
---
scribo/ChangeLog | 10 +
scribo/binarization/sauvola.hh | 330 ++++++++++++++++++++++++++++++++
scribo/src/binarization/Makefile.am | 4 +
scribo/src/binarization/sauvola.cc | 61 ++++++
scribo/src/binarization/sauvola_pgm.cc | 61 ++++++
5 files changed, 466 insertions(+), 0 deletions(-)
create mode 100644 scribo/binarization/sauvola.hh
create mode 100644 scribo/src/binarization/sauvola.cc
create mode 100644 scribo/src/binarization/sauvola_pgm.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 296bbd2..5dc8c5e 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,13 @@
+2009-08-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Add Sauvola's binarization.
+
+ * binarization/sauvola.hh: New routine.
+
+ * src/binarization/Makefile.am,
+ * src/binarization/sauvola.cc,
+ * src/binarization/sauvola_pgm.cc: New examples.
+
2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
* src/text_in_photo_invert.cc: New example.
diff --git a/scribo/binarization/sauvola.hh b/scribo/binarization/sauvola.hh
new file mode 100644
index 0000000..a726665
--- /dev/null
+++ b/scribo/binarization/sauvola.hh
@@ -0,0 +1,330 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_BINARIZATION_SAUVOLA_HH
+# define SCRIBO_BINARIZATION_SAUVOLA_HH
+
+/// \file
+///
+/// Convert an image into a binary image.
+
+# include <algorithm>
+# include <cmath>
+
+# include <mln/core/image/image2d.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/value/int_u.hh>
+
+# include <mln/data/transform.hh>
+# include <mln/pw/all.hh>
+# include <mln/core/routine/duplicate.hh>
+
+
+
+
+namespace scribo
+{
+
+ namespace binarization
+ {
+
+ using namespace mln;
+
+ /*! \brief Convert an image into a binary image.
+
+ \input[in] An image.
+
+ \return A binary image.
+
+ */
+ template <typename I>
+ mln_ch_value(I,bool)
+ sauvola(const Image<I>& input);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+ template <typename T>
+ class integral_image
+ {
+ public:
+
+ template<class F>
+ integral_image(const image2d<T>& i, F func)
+ : img_(0),
+ nrows_(i.nrows()),
+ ncols_(i.ncols())
+ {
+ img_ = (unsigned long long**)malloc(sizeof(unsigned long long*) * nrows_);
+ for (int n = 0; n < nrows_; ++n)
+ img_[n] = (unsigned long long*)malloc(sizeof(unsigned long long) * ncols_);
+
+ img_[0][0] = func(i.at_(0, 0));
+
+ for (int row = 1; row < nrows_; ++row)
+ img_[row][0] = (*this)(row - 1, 0) + func(i.at_(row, 0));
+
+ for (int col = 1; col < ncols_; ++col)
+ img_[0][col] = (*this)(0, col - 1)
+ + func(i.at_(0, col));
+
+ for (int row = 1; row < nrows_; ++row)
+ for (int col = 1; col < ncols_; ++col)
+ img_[row][col] = (*this)(row - 1, col)
+ + (*this)(row, col - 1)
+ - (*this)(row - 1, col - 1)
+ + func(i.at_(row, col));
+ }
+
+ ~integral_image()
+ {
+ for (int n = 0; n < nrows_; ++n)
+ free(img_[n]);
+ free(img_);
+ }
+
+ unsigned long long operator()(int row, int col) const
+ {
+ return img_[row][col];
+ }
+
+ private:
+ unsigned long long** img_;
+ int nrows_;
+ int ncols_;
+ };
+
+
+ struct rgb8_to_int_u8 : Function_v2v< rgb8_to_int_u8 >
+ {
+ typedef value::int_u8 result;
+ result operator()(const value::rgb8& c) const
+ {
+ return (c.red() + c.green() + c.blue()) / 3;
+ }
+ };
+
+
+ unsigned long long square_(const value::int_u8& val)
+ {
+ unsigned long long v = static_cast<unsigned long long>(val);
+ return v * v;
+ }
+
+ unsigned long long identity_(const value::int_u8& val)
+ {
+ return static_cast<unsigned long long>(val);
+ }
+
+ } // end of namespace scribo::binarization::internal
+
+
+
+
+ // Implementation
+
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+
+ template <typename I>
+ inline
+ mln_ch_value(I, bool)
+ sauvola(const I& input)
+ {
+ trace::entering("scribo::binarization::impl::generic::sauvola");
+
+ typedef mln_value(I) V;
+
+ // Value of the window size
+ const unsigned int w = 11;
+
+ // Control the threshold value in the local window
+ // The higher, the lower the threshold form the local
+ // mean m(x, y). Badekas et al. said 0.34 was best.
+ const double k = 0.34;
+
+ // Maximum value of the standard deviation (128 for
+ // grayscale documents).
+ const double R = 128;
+
+ // Compute the sum of all intensities of input
+ internal::integral_image<V> simple(input, internal::identity_);
+
+ // Compute the sum of all squared intensities of input
+ internal::integral_image<V> squared(input, internal::square_);
+
+ int w_2 = w >> 1;
+
+ // Savaula Algorithm with I.I.
+
+ image2d<bool> output;
+ initialize(output, input);
+
+ const def::coord nrows = static_cast<def::coord>(input.nrows());
+ const def::coord ncols = static_cast<def::coord>(input.ncols());
+
+ for(def::coord row = 0; row < nrows; ++row)
+ for(def::coord col = 0; col < ncols; ++col)
+ {
+ int row_min = std::max(0, row - w_2);
+ int col_min = std::max(0, col - w_2);
+ int row_max = std::min(nrows - 1, row + w_2);
+ int col_max = std::min(ncols - 1, col + w_2);
+
+ double wh = (row_max - row_min + 1) * (col_max - col_min + 1);
+
+ // Mean.
+ double m_x_y_tmp = (simple(row_max, col_max)
+ + simple(row_min, col_min)
+ - simple(row_max, col_min)
+ - simple(row_min, col_max));
+
+ double m_x_y = m_x_y_tmp / wh;
+
+ // Standard deviation.
+ double s_x_y_tmp = (squared(row_max, col_max)
+ + squared(row_min, col_min)
+ - squared(row_max, col_min)
+ - squared(row_min, col_max));
+
+ double s_x_y = std::sqrt((s_x_y_tmp - (m_x_y_tmp * m_x_y_tmp) / wh) / (wh - 1.f));
+
+ // Thresholding.
+ double t_x_y = m_x_y * (1.0 + k * ((s_x_y / R) - 1.0));
+
+ output.at_(row, col) = (input.at_(row, col) < t_x_y);
+ }
+
+ trace::exiting("scribo::binarization::impl::generic::sauvola");
+ return output;
+ }
+
+ } // end of namespace scribo::binarization::impl::generic
+
+
+ template <typename I>
+ inline
+ mln_ch_value(I, bool)
+ sauvola_gl(const I& input)
+ {
+ return impl::generic::sauvola(input);
+ }
+
+
+ template <typename I>
+ inline
+ mln_ch_value(I, bool)
+ sauvola_rgb8(const I& input)
+ {
+ trace::entering("scribo::binarization::impl::sauvola_rgb8");
+
+ mln_ch_value(I, value::int_u8) gima;
+ gima = data::transform(input,
+ internal::rgb8_to_int_u8());
+
+ mln_ch_value(I, bool) output = impl::generic::sauvola(gima);
+
+ trace::exiting("scribo::binarization::impl::sauvola_rgb8");
+ return output;
+ }
+
+
+ } // end of namespace scribo::binarization::impl
+
+
+
+
+ // Dispatch
+
+ namespace internal
+ {
+
+ template <typename I, unsigned n>
+ inline
+ mln_ch_value(I, bool)
+ sauvola_dispatch(const value::int_u<n>&, const I& input)
+ {
+ return impl::sauvola_gl(input);
+ }
+
+ template <typename I>
+ inline
+ mln_ch_value(I, bool)
+ sauvola_dispatch(const value::rgb8&, const I& input)
+ {
+ return impl::sauvola_rgb8(input);
+ }
+
+ template <typename I>
+ inline
+ mln_ch_value(I, bool)
+ sauvola_dispatch(const mln_value(I)&, const I& input)
+ {
+ // No dispatch for this kind of value type.
+ mlc_abort(I)::check();
+
+ typedef mln_ch_value(I,bool) output_t;
+ return output_t();
+ }
+
+
+ } // end of namespace scribo::binarization::internal
+
+
+ template <typename I>
+ inline
+ mln_ch_value(I, bool)
+ sauvola(const Image<I>& input)
+ {
+ trace::entering("scribo::binarization::sauvola");
+
+ mln_precondition(I::dim == 2);
+ mln_precondition(exact(input).is_valid());
+
+ typedef mln_value(I) value_t;
+ mln_ch_value(I, bool)
+ output = internal::sauvola_dispatch(value_t(), exact(input));
+
+ trace::exiting("scribo::text::ppm2pbm");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::binarization
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_TEXT_PPM2PBM_HH
diff --git a/scribo/src/binarization/Makefile.am b/scribo/src/binarization/Makefile.am
index 5ba07fc..ab982dc 100644
--- a/scribo/src/binarization/Makefile.am
+++ b/scribo/src/binarization/Makefile.am
@@ -20,7 +20,11 @@
include $(top_srcdir)/scribo/scribo.mk
bin_PROGRAMS = \
+ sauvola \
+ sauvola_pgm \
simple
+sauvola_SOURCES = sauvola.cc
+sauvola_pgm_SOURCES = sauvola_pgm.cc
simple_SOURCES = simple.cc
diff --git a/scribo/src/binarization/sauvola.cc b/scribo/src/binarization/sauvola.cc
new file mode 100644
index 0000000..9b34597
--- /dev/null
+++ b/scribo/src/binarization/sauvola.cc
@@ -0,0 +1,61 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <scribo/binarization/sauvola.hh>
+#include <scribo/debug/usage.hh>
+
+const char *args_desc[][2] =
+{
+ { "input.ppm", "A color image." },
+ {0, 0}
+};
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+ using value::rgb8;
+
+ if (argc != 3)
+ return scribo::debug::usage(argv,
+ "Binarization of a color image based on Sauvola's algorithm.",
+ "input.ppm output.pbm",
+ args_desc, "A binary image.");
+
+ trace::entering("main");
+
+ image2d<rgb8> input;
+ io::ppm::load(input, argv[1]);
+
+
+ io::pbm::save(scribo::binarization::sauvola(input),
+ argv[2]);
+
+
+ trace::exiting("main");
+}
diff --git a/scribo/src/binarization/sauvola_pgm.cc b/scribo/src/binarization/sauvola_pgm.cc
new file mode 100644
index 0000000..cac71e1
--- /dev/null
+++ b/scribo/src/binarization/sauvola_pgm.cc
@@ -0,0 +1,61 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <scribo/binarization/sauvola.hh>
+#include <scribo/debug/usage.hh>
+
+const char *args_desc[][2] =
+{
+ { "input.pgm", "A gray level image." },
+ {0, 0}
+};
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+
+ if (argc != 3)
+ return scribo::debug::usage(argv,
+ "Binarization of a gray level image based on Sauvola's algorithm.",
+ "input.pgm output.pbm",
+ args_desc, "A binary image.");
+
+ trace::entering("main");
+
+ image2d<int_u8> input;
+ io::pgm::load(input, argv[1]);
+
+
+ io::pbm::save(scribo::binarization::sauvola(input),
+ argv[2]);
+
+
+ trace::exiting("main");
+}
--
1.5.6.5
1
0
* mln/core/image/graph_window_piter.hh: Remove exact() member.
* mln/core/image/imorph/labeled_image.hh: Reindent.
* mln/fun/i2v/array.hh: Fix invalid call to nelements().
* mln/make/relabelfun.hh: Fix invalid results.
* mln/trait/op/ord.hh: Revamp header.
* tests/core/image/imorph/labeled_image.cc: Fix invalid use of
labeled_image.
---
milena/ChangeLog | 17 +++++++
milena/mln/core/image/graph_window_piter.hh | 17 ++-----
milena/mln/core/image/imorph/labeled_image.hh | 9 ++--
milena/mln/fun/i2v/array.hh | 4 +-
milena/mln/make/relabelfun.hh | 16 +++++--
milena/mln/trait/op/ord.hh | 3 +-
milena/tests/core/image/imorph/labeled_image.cc | 54 ++++++++++++++--------
7 files changed, 76 insertions(+), 44 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 789fd82..f40e949 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,20 @@
+2009-08-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Small fixes.
+
+ * mln/core/image/graph_window_piter.hh: Remove exact() member.
+
+ * mln/core/image/imorph/labeled_image.hh: Reindent.
+
+ * mln/fun/i2v/array.hh: Fix invalid call to nelements().
+
+ * mln/make/relabelfun.hh: Fix invalid results.
+
+ * mln/trait/op/ord.hh: Revamp header.
+
+ * tests/core/image/imorph/labeled_image.cc: Fix invalid use of
+ labeled_image.
+
2009-08-26 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Small fixes.
diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh
index 1b4ab7a..1891925 100644
--- a/milena/mln/core/image/graph_window_piter.hh
+++ b/milena/mln/core/image/graph_window_piter.hh
@@ -54,14 +54,9 @@ namespace mln
template <typename C, typename P, typename E>
struct impl_selector
{
- E& exact()
- {
- return internal::force_exact<E>(*this);
- }
-
void do_start_()
{
- exact().iter_.start();
+ internal::force_exact<E>(*this).iter_.start();
// Nothing else to do. A pointer to the window element's site
// set has been already stored in the constructor.
}
@@ -73,14 +68,10 @@ namespace mln
template <typename C, typename E>
struct impl_selector<C,C,E>
{
- E& exact()
- {
- return internal::force_exact<E>(*this);
- }
-
void do_start_()
{
- exact().iter_.start();
+ E& this_ = internal::force_exact<E>(*this);
+ this_.iter_.start();
// We need to store a pointer on the site set of the window
// center.
@@ -90,7 +81,7 @@ namespace mln
// potential iterator used as center has been started just
// before calling this method.
//
- exact().change_target_site_set(exact().center().site_set());
+ this_.change_target_site_set(this_.center().site_set());
}
};
diff --git a/milena/mln/core/image/imorph/labeled_image.hh b/milena/mln/core/image/imorph/labeled_image.hh
index 8e27163..b0e5ffb 100644
--- a/milena/mln/core/image/imorph/labeled_image.hh
+++ b/milena/mln/core/image/imorph/labeled_image.hh
@@ -191,10 +191,10 @@ namespace mln
/// Return the component bounding boxes.
const util::array<bbox_t>& bboxes() const;
- /// Return the domain of the component with label \p label.
- p_if<mln_box(I),
- fun::eq_v2b_expr_<pw::value_<I>, pw::cst_<mln_value(I)> > >
- subdomain(const mln_value(I)& label) const;
+ /// Return the domain of the component with label \p label.
+ p_if<mln_box(I),
+ fun::eq_v2b_expr_<pw::value_<I>, pw::cst_<mln_value(I)> > >
+ subdomain(const mln_value(I)& label) const;
};
@@ -309,6 +309,7 @@ namespace mln
packed_relabel_fun = make::relabelfun(f,
this->data_->nlabels_,
new_nlabels);
+
labeling::relabel_inplace(this->data_->ima_, this->data_->nlabels_,
packed_relabel_fun);
diff --git a/milena/mln/fun/i2v/array.hh b/milena/mln/fun/i2v/array.hh
index b7175c9..21ddbac 100644
--- a/milena/mln/fun/i2v/array.hh
+++ b/milena/mln/fun/i2v/array.hh
@@ -354,10 +354,10 @@ namespace mln
const array<T>& a)
{
ostr << '(';
- const unsigned n = a.nelements();
+ const unsigned n = a.size();
for (unsigned i = 0; i < n; ++i)
{
- ostr << a[i];
+ ostr << a(i);
if (i != n - 1)
ostr << ", ";
}
diff --git a/milena/mln/make/relabelfun.hh b/milena/mln/make/relabelfun.hh
index b9482b0..0a841f2 100644
--- a/milena/mln/make/relabelfun.hh
+++ b/milena/mln/make/relabelfun.hh
@@ -111,16 +111,24 @@ namespace mln
const F& fv2v = exact(fv2v_);
unsigned nlabels_i = static_cast<unsigned>(nlabels) + 1;
+
+ util::array<V> new_labels(nlabels_i, mln_max(V));
+ new_labels(0) = literal::zero;
V tmp_nlabels = literal::zero;
- fun::i2v::array<V> fi2v(nlabels_i, literal::zero);
+ fun::i2v::array<V> fi2v(nlabels_i, mln_max(V));
+ fi2v(0) = literal::zero;
+
for (V i = 1; i < nlabels_i; ++i)
- if (fi2v(fv2v(i)) == literal::zero)
+ {
+ mln_assertion(fv2v(i) <= nlabels);
+ if (new_labels(fv2v(i)) == mln_max(V))
{
- fi2v(fv2v(i)) = ++tmp_nlabels;
+ new_labels(fv2v(i)) = ++tmp_nlabels;
fi2v(i) = tmp_nlabels;
}
else
- fi2v(i) = fi2v(fv2v(i));
+ fi2v(i) = new_labels(fv2v(i));
+ }
new_nlabels = tmp_nlabels;
trace::exiting("make::relabelfun");
return fi2v;
diff --git a/milena/mln/trait/op/ord.hh b/milena/mln/trait/op/ord.hh
index ca02815..5e9a370 100644
--- a/milena/mln/trait/op/ord.hh
+++ b/milena/mln/trait/op/ord.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
diff --git a/milena/tests/core/image/imorph/labeled_image.cc b/milena/tests/core/image/imorph/labeled_image.cc
index d4e78b0..627c38a 100644
--- a/milena/tests/core/image/imorph/labeled_image.cc
+++ b/milena/tests/core/image/imorph/labeled_image.cc
@@ -34,11 +34,17 @@
#include <mln/accu/shape/bbox.hh>
-
-static const unsigned bboxes_1[][4] = { { 1,1, 1,1 },
- { 2,0, 2,1 },
- { 0,0, 0,1 },
- { 2,2, 2,2 } };
+# include <mln/debug/println.hh>
+
+static const unsigned bboxes_1[][9] = { { 1,1, 1,1 }, // 1
+ { 2,2, 2,2 }, // 2
+ { 0,0, 0,0 },
+ { 0,0, 0,0 },
+ { 2,0, 2,1 }, // 5
+ { 0,0, 0,0 },
+ { 0,0, 0,0 },
+ { 0,0, 0,0 },
+ { 0,0, 0,1 } };
static const unsigned bboxes_2[][4] = { { 1,1, 1,1 },
@@ -51,14 +57,22 @@ static const unsigned bboxes_2[][4] = { { 1,1, 1,1 },
namespace mln
{
- template <typename I>
+ template <typename I, unsigned n>
void test_image(const labeled_image<I>& lbl_i,
- const unsigned bboxes[][4])
+ const unsigned bboxes[][n])
{
- unsigned j = 0;
- for (unsigned i = 1; i < 5; ++i, ++j)
- mln_assertion(lbl_i.bbox(i) == make::box2d(bboxes[j][0], bboxes[j][1],
- bboxes[j][2], bboxes[j][3]));
+ unsigned
+ j = 0,
+ k = 0;
+ for (unsigned i = 1; i <= lbl_i.nlabels(); ++i, ++j)
+ if (lbl_i.bbox(i).is_valid())
+ {
+ mln_assertion(lbl_i.bbox(i) == make::box2d(bboxes[j][0], bboxes[j][1],
+ bboxes[j][2], bboxes[j][3]));
+ ++k;
+ }
+
+ mln_assertion(k == 4);
}
} // end of namespace mln
@@ -72,26 +86,26 @@ int main()
using value::label_8;
- label_8 lbl_values[][3] = { { 3, 3, 0 },
+ label_8 lbl_values[][3] = { { 9, 9, 0 },
{ 0, 1, 0 },
- { 2, 2, 4 } };
+ { 5, 5, 2 } };
typedef image2d<label_8> lbl_t;
lbl_t lbl = make::image(lbl_values);
- labeled_image<lbl_t> lbl_i(lbl, 4);
-
-
+ labeled_image<lbl_t> lbl_i(lbl, 9);
+ mln_assertion(lbl_i.nlabels() == 9);
test_image(lbl_i, bboxes_1);
- fun::i2v::array<label_8> f(5);
+ fun::i2v::array<label_8> f(10, 0);
f(0) = 0;
f(1) = 1;
- f(2) = 5;
- f(3) = 9;
- f(4) = 2;
+ f(5) = 2;
+ f(9) = 5;
+ f(2) = 4;
lbl_i.relabel(f);
+ mln_assertion(lbl_i.nlabels() == 4);
test_image(lbl_i, bboxes_2);
}
--
1.5.6.5
1
0
* mln/core/dpsites_piter.hh,
* mln/core/image/graph_window_if_piter.hh,
* mln/win/multiple_size.hh: Add missing init_ member.
* mln/core/mixed_neighb.hh: Fix invalid constructor declarations.
* mln/core/image/graph_window_piter.hh: Add comments.
* mln/core/internal/neighb_niter_base.hh: Add missing includes.
* mln/fun/i2v/array.hh: Add operator<<.
---
milena/ChangeLog | 16 ++++++++++++++
milena/mln/core/dpsites_piter.hh | 14 ++++++++++++
milena/mln/core/image/graph_window_if_piter.hh | 16 +++++++++++++-
milena/mln/core/image/graph_window_piter.hh | 6 +++++
milena/mln/core/internal/neighb_niter_base.hh | 3 ++
milena/mln/core/mixed_neighb.hh | 9 ++++++-
milena/mln/fun/i2v/array.hh | 26 ++++++++++++++++++++++++
milena/mln/win/multiple_size.hh | 13 ++++++++++++
8 files changed, 100 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4a7d67e..789fd82 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,19 @@
+2009-08-26 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Small fixes.
+
+ * mln/core/dpsites_piter.hh,
+ * mln/core/image/graph_window_if_piter.hh,
+ * mln/win/multiple_size.hh: Add missing init_ member.
+
+ * mln/core/mixed_neighb.hh: Fix invalid constructor declarations.
+
+ * mln/core/image/graph_window_piter.hh: Add comments.
+
+ * mln/core/internal/neighb_niter_base.hh: Add missing includes.
+
+ * mln/fun/i2v/array.hh: Add operator<<.
+
2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Regen mk files.
diff --git a/milena/mln/core/dpsites_piter.hh b/milena/mln/core/dpsites_piter.hh
index 970fe0e..0bbb0f5 100644
--- a/milena/mln/core/dpsites_piter.hh
+++ b/milena/mln/core/dpsites_piter.hh
@@ -106,6 +106,10 @@ namespace mln
/// Constructor without argument.
dpsites_bkd_piter();
+ /// Delayed initialization.
+ template <typename P>
+ void init_(const V& v, const P& c);
+
/// Test the iterator validity.
bool is_valid_() const;
@@ -212,10 +216,20 @@ namespace mln
inline
dpsites_bkd_piter<V>::dpsites_bkd_piter(const V& v, const P& c)
{
+ init_(v, c);
+ }
+
+ template <typename V>
+ template <typename P>
+ inline
+ void
+ dpsites_bkd_piter<V>::init_(const V& v, const P& c)
+ {
this->change_target(v);
this->center_at(c);
}
+
template <typename V>
inline
bool
diff --git a/milena/mln/core/image/graph_window_if_piter.hh b/milena/mln/core/image/graph_window_if_piter.hh
index 070bccc..d872853 100644
--- a/milena/mln/core/image/graph_window_if_piter.hh
+++ b/milena/mln/core/image/graph_window_if_piter.hh
@@ -65,9 +65,13 @@ namespace mln
graph_window_if_piter();
template <typename Pref>
graph_window_if_piter(const Window<W>& win,
- const Pref& p_ref);
+ const Pref& p_ref);
/// \}
+ /// Delayed initialization.
+ template <typename Pref>
+ void init_(const Window<W>& win, const Pref& p_ref);
+
/// Manipulation.
/// \{
/// Test if the iterator is valid.
@@ -125,6 +129,16 @@ namespace mln
graph_window_if_piter<S,W,I>::graph_window_if_piter(const Window<W>& win,
const Pref& p_ref)
{
+ init_(win, p_ref);
+ }
+
+ template <typename S, typename W, typename I>
+ template <typename Pref>
+ inline
+ void
+ graph_window_if_piter<S,W,I>::init_(const Window<W>& win,
+ const Pref& p_ref)
+ {
this->center_at(p_ref);
this->change_target(exact(win));
diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh
index 8ea77db..1b4ab7a 100644
--- a/milena/mln/core/image/graph_window_piter.hh
+++ b/milena/mln/core/image/graph_window_piter.hh
@@ -207,7 +207,13 @@ namespace mln
unsigned id() const;
/// \}
+ /// Change the target site set.
+ /// Window elements different from the center come from the target
+ /// site set.
void change_target_site_set(const S& s);
+ /// Return the target site set.
+ /// Window elements different from the center come from the target
+ /// site set.
const S& target_site_set() const;
using super_impl_::do_start_;
diff --git a/milena/mln/core/internal/neighb_niter_base.hh b/milena/mln/core/internal/neighb_niter_base.hh
index 6aba054..27459b6 100644
--- a/milena/mln/core/internal/neighb_niter_base.hh
+++ b/milena/mln/core/internal/neighb_niter_base.hh
@@ -30,6 +30,9 @@
///
/// Base implementation for neighborhood iterators.
+# include <mln/core/internal/site_relative_iterator_base.hh>
+# include <mln/core/internal/neighb_niter_impl.hh>
+
namespace mln
{
diff --git a/milena/mln/core/mixed_neighb.hh b/milena/mln/core/mixed_neighb.hh
index 377bab1..7789aba 100644
--- a/milena/mln/core/mixed_neighb.hh
+++ b/milena/mln/core/mixed_neighb.hh
@@ -37,6 +37,7 @@
/// \todo See if the impl of from_to is fine. What about removing the
/// origin? etc.
+# include <mln/core/neighb.hh>
# include <mln/core/internal/neighb_base.hh>
# include <mln/core/internal/neighb_niter_base.hh>
# include <mln/core/internal/site_relative_iterator_base.hh>
@@ -117,7 +118,9 @@ namespace mln
mixed_neighb_fwd_niter();
template <typename P>
- mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh, const P& c);
+ mixed_neighb_fwd_niter(const mixed_neighb<W>& nbh,
+ const mln_target(W)& nbh_site_set,
+ const P& c);
};
@@ -138,7 +141,9 @@ namespace mln
mixed_neighb_bkd_niter();
template <typename P>
- mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh, const P& c);
+ mixed_neighb_bkd_niter(const mixed_neighb<W>& nbh,
+ const mln_target(W)& nbh_site_set,
+ const P& c);
};
diff --git a/milena/mln/fun/i2v/array.hh b/milena/mln/fun/i2v/array.hh
index ed4a379..b7175c9 100644
--- a/milena/mln/fun/i2v/array.hh
+++ b/milena/mln/fun/i2v/array.hh
@@ -151,6 +151,13 @@ namespace mln
};
+
+ /// Operator<<.
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr,
+ const array<T>& a);
+
+
} // end of namespace mln::fun::i2v
} // end of namespace mln::fun
@@ -340,6 +347,25 @@ namespace mln
}
+ // Operator <<.
+
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr,
+ const array<T>& a)
+ {
+ ostr << '(';
+ const unsigned n = a.nelements();
+ for (unsigned i = 0; i < n; ++i)
+ {
+ ostr << a[i];
+ if (i != n - 1)
+ ostr << ", ";
+ }
+ ostr << ')';
+ return ostr;
+ }
+
+
} // end of namespace mln::fun::i2v
} // end of namespace mln::fun
diff --git a/milena/mln/win/multiple_size.hh b/milena/mln/win/multiple_size.hh
index 7d4390e..1edb325 100644
--- a/milena/mln/win/multiple_size.hh
+++ b/milena/mln/win/multiple_size.hh
@@ -145,6 +145,9 @@ namespace mln
template <typename P>
multiple_size_qiter(const multiple_size<n,W,F>& w, const P& c);
+ template <typename P>
+ void init_(const multiple_size<n,W,F>& w, const P& c);
+
/// Test the iterator validity.
bool is_valid_() const;
@@ -312,12 +315,22 @@ namespace mln
inline
multiple_size_qiter<n,W,F>::multiple_size_qiter(const multiple_size<n,W,F>& w, const P& c)
{
+ init_(w, c);
+ }
+
+ template <unsigned n, typename W, typename F>
+ template <typename P>
+ inline
+ void
+ multiple_size_qiter<n,W,F>::init_(const multiple_size<n,W,F>& w, const P& c)
+ {
this->center_at(c);
// We have to first change the center so that 'invalidate' can
// work when changing the target.
this->change_target(w);
}
+
template <unsigned n, typename W, typename F>
inline
bool
--
1.5.6.5
1
0
---
scribo/ChangeLog | 4 +
scribo/src/text_in_photo_invert.cc | 249 ++++++++++++++++++++++++++++++++++++
2 files changed, 253 insertions(+), 0 deletions(-)
create mode 100644 scribo/src/text_in_photo_invert.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 69af059..296bbd2 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,9 @@
2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * src/text_in_photo_invert.cc: New example.
+
+2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Add new filters.
* filter/all.hh: Add new includes.
diff --git a/scribo/src/text_in_photo_invert.cc b/scribo/src/text_in_photo_invert.cc
new file mode 100644
index 0000000..81a0e91
--- /dev/null
+++ b/scribo/src/text_in_photo_invert.cc
@@ -0,0 +1,249 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <libgen.h>
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/labeling/colorize.hh>
+
+#include <mln/io/pbm/all.hh>
+#include <mln/io/pgm/all.hh>
+#include <mln/io/ppm/all.hh>
+
+#include <mln/math/min.hh>
+
+#include <mln/literal/colors.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/value/label_16.hh>
+
+#include <mln/draw/box.hh>
+
+#include <mln/logical/not.hh>
+
+#include <mln/labeling/superpose.hh>
+
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/link/with_single_right_link.hh>
+#include <scribo/primitive/group/from_double_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/filter/objects_small.hh>
+#include <scribo/filter/objects_thin.hh>
+#include <scribo/filter/objects_thick.hh>
+#include <scribo/filter/object_groups_small.hh>
+
+#include <scribo/make/debug_filename.hh>
+#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/save_linked_bboxes_image.hh>
+
+#include <scribo/debug/usage.hh>
+
+const char *args_desc[][2] =
+{
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "input_i.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ {0, 0}
+};
+
+
+
+namespace mln
+{
+
+ template <typename V>
+ object_image(image2d<value::label_16>)
+ run(const image2d<V>& input)
+ {
+ using namespace scribo;
+
+ typedef image2d<value::label_16> L;
+
+ /// Finding objects.
+ value::label_16 nobjects;
+ object_image(L)
+ objects = scribo::primitive::extract::objects(input, c8(), nobjects);
+
+
+ /// First filtering.
+ object_image(L) filtered_objects
+ = scribo::filter::objects_small(objects, 6);
+
+ filtered_objects
+ = scribo::filter::objects_thin(filtered_objects, 1);
+
+ filtered_objects
+ = scribo::filter::objects_thick(filtered_objects,
+ math::min(input.ncols(), input.nrows()) / 6);
+
+
+ /// Finding links between potential objects
+ object_links<L> left_link
+ = primitive::link::with_single_left_link(filtered_objects, 30);
+ object_links<L> right_link
+ = primitive::link::with_single_right_link(filtered_objects, 30);
+
+
+
+ std::cout << "BEFORE - nobjects = " << nobjects << std::endl;
+ scribo::debug::save_linked_bboxes_image(input,
+ filtered_objects,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ scribo::make::debug_filename("links.ppm"));
+
+
+
+
+ // Trying to group objects
+ object_groups<L>
+ groups = primitive::group::from_double_link(filtered_objects,
+ left_link, right_link);
+
+ // Remove objects part of groups with less than 3 objects.
+ util::array<bool>
+ to_be_kept = filter::object_groups_small(groups, 3);
+
+
+
+ // FOR DEBUGGING PURPOSE.
+#ifndef NOUT
+ image2d<value::rgb8> decision_image = data::convert(value::rgb8(), input);
+
+
+ for (unsigned i = 1; i < to_be_kept.size(); ++i)
+ {
+ if (!to_be_kept(i))
+ mln::draw::box(decision_image, filtered_objects.bbox(i), literal::red);
+ else
+ mln::draw::box(decision_image, filtered_objects.bbox(i), literal::green);
+ }
+#endif // ! NOUT
+
+
+ filtered_objects.relabel(to_be_kept);
+
+
+ // Objects have been removed we need to update object links again.
+ // This time a single link is enough since non-wanted objects have
+ // been removed.
+ left_link
+ = primitive::link::with_single_left_link(filtered_objects, 30);
+
+
+
+ // Grouping objects again.
+ groups = primitive::group::from_single_link(filtered_objects, left_link);
+
+ object_image(L)
+ grouped_objects = primitive::group::apply(filtered_objects, groups);
+
+#ifndef NOUT
+ for (unsigned i = 1; i <= grouped_objects.nlabels(); ++i)
+ mln::draw::box(decision_image, grouped_objects.bbox(i), literal::blue);
+
+ io::ppm::save(decision_image, scribo::make::debug_filename("decision_image.ppm"));
+#endif // ! NOUT
+
+
+ std::cout << "AFTER - nobjects = " << grouped_objects.nlabels() << std::endl;
+//
+
+ return grouped_objects;
+ }
+
+
+}
+
+
+
+int main(int argc, char* argv[])
+{
+ using namespace scribo;
+ using namespace mln;
+
+ if (argc != 4)
+ return scribo::debug::usage(argv,
+ "Find text in a binarized photo.",
+ "input.pbm input_i.pbm output_dir",
+ args_desc,
+ "Several color images");
+
+
+ scribo::make::internal::debug_filename_prefix = argv[3];
+
+
+ trace::entering("main");
+
+ image2d<bool> input;
+ io::pbm::load(input, argv[1]);
+
+ typedef image2d<value::label_16> L;
+
+ value::label_16 new_nlabels;
+
+ object_image(L) out_1 = run(input);
+
+#ifndef NOUT
+ io::ppm::save(mln::labeling::colorize(value::rgb8(),
+ out_1,
+ new_nlabels),
+ scribo::make::debug_filename("out_normal.ppm"));
+#endif // ! NOUT
+
+
+ image2d<bool> input_i;
+ io::pbm::load(input_i, argv[2]);
+
+ object_image(L) out_2 = run(input_i);
+
+#ifndef NOUT
+ io::ppm::save(mln::labeling::colorize(value::rgb8(),
+ out_2,
+ new_nlabels),
+ scribo::make::debug_filename("out_inverted.ppm"));
+#endif // ! NOUT
+
+
+ L out = labeling::superpose(out_1, out_1.nlabels(),
+ out_2, out_2.nlabels(),
+ new_nlabels);
+
+
+ io::ppm::save(mln::labeling::colorize(value::rgb8(),
+ out,
+ new_nlabels),
+ scribo::make::debug_filename("out_combined.ppm"));
+
+
+ trace::exiting("main");
+}
--
1.5.6.5
1
0
* filter/all.hh: Add new includes.
* filter/object_links_non_aligned.hh,
* filter/object_links_non_h_aligned.hh,
* filter/object_links_non_v_aligned.hh: New filters.
* src/text/grouping/group_from_double_link_filter_non_aligned.cc:
New example.
* headers.mk,
* tests/unit_test/unit-tests.mk: Regen.
---
scribo/ChangeLog | 16 ++
scribo/filter/all.hh | 3 +
scribo/filter/object_links_non_aligned.hh | 136 ++++++++++++++++
scribo/filter/object_links_non_h_aligned.hh | 109 +++++++++++++
scribo/filter/object_links_non_v_aligned.hh | 122 +++++++++++++++
scribo/headers.mk | 18 +-
.../group_from_double_link_filter_non_aligned.cc | 165 ++++++++++++++++++++
scribo/tests/unit_test/unit-tests.mk | 36 ++--
8 files changed, 578 insertions(+), 27 deletions(-)
create mode 100644 scribo/filter/object_links_non_aligned.hh
create mode 100644 scribo/filter/object_links_non_h_aligned.hh
create mode 100644 scribo/filter/object_links_non_v_aligned.hh
create mode 100644 scribo/src/text/grouping/group_from_double_link_filter_non_aligned.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index a7cd378..69af059 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,21 @@
2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Add new filters.
+
+ * filter/all.hh: Add new includes.
+
+ * filter/object_links_non_aligned.hh,
+ * filter/object_links_non_h_aligned.hh,
+ * filter/object_links_non_v_aligned.hh: New filters.
+
+ * src/text/grouping/group_from_double_link_filter_non_aligned.cc:
+ New example.
+
+ * headers.mk,
+ * tests/unit_test/unit-tests.mk: Regen.
+
+2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Rename filters.
* filter/all.hh: Update includes.
diff --git a/scribo/filter/all.hh b/scribo/filter/all.hh
index 0b5bc11..f9ef9ce 100644
--- a/scribo/filter/all.hh
+++ b/scribo/filter/all.hh
@@ -42,6 +42,9 @@ namespace scribo
} // end of namespace scribo
# include <scribo/filter/object_groups_small.hh>
+# include <scribo/filter/object_links_non_aligned.hh>
+# include <scribo/filter/object_links_non_h_aligned.hh>
+# include <scribo/filter/object_links_non_v_aligned.hh>
# include <scribo/filter/objects_large.hh>
# include <scribo/filter/objects_small.hh>
# include <scribo/filter/objects_thick.hh>
diff --git a/scribo/filter/object_links_non_aligned.hh b/scribo/filter/object_links_non_aligned.hh
new file mode 100644
index 0000000..46a425e
--- /dev/null
+++ b/scribo/filter/object_links_non_aligned.hh
@@ -0,0 +1,136 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_FILTER_OBJECT_LINKS_NON_ALIGNED_HH
+# define SCRIBO_FILTER_OBJECT_LINKS_NON_ALIGNED_HH
+
+/// \file
+///
+/// Invalidate links between two non aligned objects.
+
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/macros.hh>
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_image.hh>
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+ /*! \brief Invalidate links between two non aligned objects.
+ Alignment is based on object bounding boxes.
+
+ \param[in] objects An object image.
+ \param[in] links Object links information.
+ \param[in] dim Choose the dimension on which applying the
+ filter.
+ \param[in] max_delta Maximum delta.
+
+
+ Exemple with dim == 1 (horizontal filter):
+
+ \verbatim
+ v
+ ------ ~ ~ ~
+ | | |\
+ ------ ~ ~ ~ |~ ~ | ~ ~ ~ \
+ | | | | ^ \
+ | x------------x | => delta, must be < to max_delta
+ | | | | v /
+ ------ ~ ~ ~ |~ ~ | ~ ~ ~ /
+ object1 | | |/
+ ------ ~ ~ ~
+ object2 ^
+
+ \endverbatim
+
+ */
+ template <typename L>
+ object_links<L>
+ object_links_non_aligned(const object_image(L)& objects,
+ const object_links<L>& links,
+ unsigned dim,
+ unsigned max_delta);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ object_links<L>
+ object_links_non_aligned(const object_image(L)& objects,
+ const object_links<L>& links,
+ unsigned dim,
+ unsigned max_delta)
+ {
+ trace::entering("scribo::filter::object_links_non_aligned");
+
+ mln_precondition(objects.is_valid());
+
+
+ typedef typename object_image(L)::bbox_t bbox_t;
+ const mln::util::array<bbox_t>& bboxes = objects.bboxes();
+ object_links<L> output(links);
+
+ for_all_components(i, objects.bboxes())
+ {
+
+ unsigned
+ lnbh = bboxes(links[i]).pmax()[dim] - bboxes(links[i]).pmin()[dim],
+ lcurrent = bboxes(i).pmax()[dim] - bboxes(i).pmin()[dim],
+ hmin = i,
+ hmax = links[i];
+
+ if (lnbh < lcurrent)
+ {
+ hmin = links[i];
+ hmax = i;
+ }
+
+ if ((bboxes[hmin].pmin()[dim] - (float)bboxes[hmax].pmin()[dim]) > max_delta
+ || (bboxes[hmin].pmax()[dim] - (float) bboxes[hmax].pmax()[dim]) > max_delta)
+ output[i] = i;
+ }
+
+ trace::exiting("scribo::filter::object_links_non_aligned");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_OBJECT_LINKS_NON_ALIGNED_HH
diff --git a/scribo/filter/object_links_non_h_aligned.hh b/scribo/filter/object_links_non_h_aligned.hh
new file mode 100644
index 0000000..cae84a9
--- /dev/null
+++ b/scribo/filter/object_links_non_h_aligned.hh
@@ -0,0 +1,109 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_FILTER_OBJECT_LINKS_NON_H_ALIGNED_HH
+# define SCRIBO_FILTER_OBJECT_LINKS_NON_H_ALIGNED_HH
+
+/// \file
+///
+/// Invalidate links between two non horizontaly aligned objects.
+
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_image.hh>
+# include <scribo/filter/object_links_non_aligned.hh>
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+
+ /*! \brief Invalidate links between two non horizontaly aligned objects.
+ Alignment is based on object bounding boxes.
+
+ \param[in] objects An object image.
+ \param[in] links Object links information.
+ \param[in] max_delta Maximum delta.
+
+ \result Filtered object links data.
+
+ \verbatim
+ v
+ ------ ~ ~ ~
+ | | |\
+ ------ ~ ~ ~ |~ ~ | ~ ~ ~ \
+ | | | | ^ \
+ | x- - - - - --x | => delta, must be < to max_delta
+ | | | | v /
+ ------ ~ ~ ~ |~ ~ | ~ ~ ~ /
+ object1 | | |/
+ ------ ~ ~ ~
+ object2 ^
+
+ \endverbatim
+
+
+ */
+ template <typename L>
+ object_links<L>
+ object_links_non_h_aligned(const object_image(L)& objects,
+ const object_links<L>& links,
+ float ratio);
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ object_links<L>
+ object_links_non_h_aligned(const object_image(L)& objects,
+ const object_links<L>& links,
+ float ratio)
+ {
+ trace::entering("scribo::filter::object_links_non_h_aligned");
+
+ mln_precondition(objects.is_valid());
+
+ object_links<L>
+ output = object_links_non_aligned(objects, links, 1, ratio);
+
+ trace::exiting("scribo::filter::object_links_non_h_aligned");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_OBJECT_LINKS_NON_H_ALIGNED_HH
diff --git a/scribo/filter/object_links_non_v_aligned.hh b/scribo/filter/object_links_non_v_aligned.hh
new file mode 100644
index 0000000..bd2aeee
--- /dev/null
+++ b/scribo/filter/object_links_non_v_aligned.hh
@@ -0,0 +1,122 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_FILTER_OBJECT_LINKS_NON_V_ALIGNED_HH
+# define SCRIBO_FILTER_OBJECT_LINKS_NON_V_ALIGNED_HH
+
+/// \file
+///
+/// Invalidate links between two non verticaly aligned objects.
+
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_image.hh>
+# include <scribo/filter/object_links_non_aligned.hh>
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+ /*! \brief Invalidate links between two non verticaly aligned objects.
+ Alignment is based on object bounding boxes.
+
+ \param[in] objects An object image.
+ \param[in] links Object links information.
+ \param[in] max_delta Maximum delta.
+
+
+ \verbatim
+
+ delta (must be < to max_delta)
+ /\
+ / \
+ / \
+ >:-:<>:-:<
+ : :
+ : :
+ : ---:--
+ | |
+ : | x: | object1
+ | | |
+ : --|:--
+
+ : |:
+
+ : |:
+ -- ---
+ | ||
+ | |
+ | ||
+ | x| object2
+ | |
+ | |
+ | |
+ ------
+
+ \endverbatim
+
+ */
+ template <typename L>
+ object_links<L>
+ object_links_non_v_aligned(const object_image(L)& objects,
+ const object_links<L>& links,
+ float ratio);
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ object_links<L>
+ object_links_non_v_aligned(const object_image(L)& objects,
+ const object_links<L>& links,
+ float ratio)
+ {
+ trace::entering("scribo::object_links::object_links_non_v_aligned");
+
+ mln_precondition(objects.is_valid());
+
+ object_links<L>
+ output = object_links_non_aligned(objects, links, 0, ratio);
+
+ trace::exiting("scribo::filter::object_links_non_v_aligned");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_OBJECT_LINKS_NON_V_ALIGNED_HH
diff --git a/scribo/headers.mk b/scribo/headers.mk
index c266c78..8ca14cf 100644
--- a/scribo/headers.mk
+++ b/scribo/headers.mk
@@ -21,12 +21,15 @@ nobase_scribo_HEADERS = \
./draw/bounding_box_links.hh \
./draw/bounding_boxes.hh \
./filter/all.hh \
-./filter/large_objects.hh \
-./filter/small_object_groups.hh \
-./filter/small_objects.hh \
-./filter/thick_objects.hh \
-./filter/thin_objects.hh \
-./fun/v2b/small_objects_filter.hh \
+./filter/object_groups_small.hh \
+./filter/object_links_non_aligned.hh \
+./filter/object_links_non_h_aligned.hh \
+./filter/object_links_non_v_aligned.hh \
+./filter/objects_large.hh \
+./filter/objects_small.hh \
+./filter/objects_thick.hh \
+./filter/objects_thin.hh \
+./fun/v2b/objects_small_filter.hh \
./make/all.hh \
./make/debug_filename.hh \
./make/influence_zone_graph.hh \
@@ -51,9 +54,6 @@ nobase_scribo_HEADERS = \
./primitive/extract/objects.hh \
./primitive/group/all.hh \
./primitive/group/apply.hh \
-./primitive/group/filter_non_aligned.hh \
-./primitive/group/filter_non_h_aligned.hh \
-./primitive/group/filter_non_v_aligned.hh \
./primitive/group/from_double_link.hh \
./primitive/group/from_graph.hh \
./primitive/group/from_single_link.hh \
diff --git a/scribo/src/text/grouping/group_from_double_link_filter_non_aligned.cc b/scribo/src/text/grouping/group_from_double_link_filter_non_aligned.cc
new file mode 100644
index 0000000..fce389e
--- /dev/null
+++ b/scribo/src/text/grouping/group_from_double_link_filter_non_aligned.cc
@@ -0,0 +1,165 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/labeling/colorize.hh>
+#include <mln/debug/println.hh>
+#include <mln/util/array.hh>
+#include <mln/literal/colors.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/label_16.hh>
+
+#include <scribo/core/object_image.hh>
+
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/link/with_single_right_link.hh>
+#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/primitive/group/from_double_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/primitive/link/merge_double_link.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/filter/objects_small.hh>
+
+#include <scribo/filter/object_links_non_h_aligned.hh>
+
+#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/make/debug_filename.hh>
+
+
+#include <scribo/debug/usage.hh>
+
+const char *args_desc[][2] =
+{
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "hlmax", "Maximum distance between two grouped objects while browsing on the left." },
+ { "hrmax", "Maximum distance between two grouped objects while browsing on the right." },
+ { "hdelta_max", "Maximum horizontal distance between top/bottom corner of two grouped bboxes." },
+ { "prefix", "Output names prefix" },
+ {0, 0}
+};
+
+int main(int argc, char *argv[])
+{
+ using namespace scribo;
+ using namespace mln;
+
+ if (argc != 6)
+ return scribo::debug::usage(argv,
+ "Group potential text objects using a double validation link.",
+ "input.pbm hlmax hrmax hdelta_max prefix",
+ args_desc,
+ "Several images showing the process.");
+
+
+ scribo::make::internal::debug_filename_prefix = argv[5];
+
+ image2d<bool> input;
+ io::pbm::load(input, argv[1]);
+
+ value::label_16 nbboxes;
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+
+ text_t text = primitive::extract::objects(input, c8(), nbboxes);
+
+ text = filter::objects_small(text, 4);
+
+ object_links<L> left_link
+ = primitive::link::with_single_left_link(text, atoi(argv[2]));
+ object_links<L> right_link
+ = primitive::link::with_single_right_link(text, atoi(argv[3]));
+
+ std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
+
+// scribo::debug::save_linked_textbboxes_image(input,
+// text, left_link,
+// literal::red, literal::cyan,
+// scribo::make::debug_filename("left_linked.ppm"));
+// scribo::debug::save_linked_textbboxes_image(input,
+// text, right_link,
+// literal::red, literal::cyan,
+// scribo::make::debug_filename("right_linked.ppm"));
+
+ scribo::debug::save_linked_bboxes_image(input,
+ text, left_link, right_link,
+ literal::red, literal::cyan, literal::yellow,
+ literal::green,
+ scribo::make::debug_filename("links.ppm"));
+
+ // With validation.
+ object_links<L> double_link
+ = primitive::link::merge_double_link(text,
+ left_link,
+ right_link);
+
+
+ text_t
+ grouped_text = primitive::group::apply(text, double_link);
+ std::cout << "AFTER double grouping - nbboxes = "
+ << grouped_text.bboxes().nelements() << std::endl;
+
+
+ io::ppm::save(mln::labeling::colorize(value::rgb8(),
+ grouped_text,
+ grouped_text.nlabels()),
+ scribo::make::debug_filename("label_color.ppm"));
+
+
+ scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
+ literal::red,
+ scribo::make::debug_filename("bboxes.ppm"));
+
+
+
+ // Filter non-correctly aligned grouped objects.
+
+ object_links<L> filtered_links
+ = filter::object_links_non_h_aligned(text, double_link, atoi(argv[4]));
+
+
+ text_t aligned_grouped_text
+ = primitive::group::apply(text, filtered_links);
+
+
+ std::cout << "AFTER filtering - Links may have been canceled - nbboxes = "
+ << aligned_grouped_text.bboxes().nelements() << std::endl;
+
+
+ io::ppm::save(mln::labeling::colorize(value::rgb8(),
+ aligned_grouped_text,
+ aligned_grouped_text.nlabels()),
+ scribo::make::debug_filename("label_color-filtered.ppm"));
+
+
+ scribo::debug::save_bboxes_image(input, aligned_grouped_text.bboxes(),
+ literal::red,
+ scribo::make::debug_filename("bboxes-filtered.ppm"));
+
+}
diff --git a/scribo/tests/unit_test/unit-tests.mk b/scribo/tests/unit_test/unit-tests.mk
index 237581f..89c72d9 100644
--- a/scribo/tests/unit_test/unit-tests.mk
+++ b/scribo/tests/unit_test/unit-tests.mk
@@ -20,12 +20,15 @@ scribo_draw_all \
scribo_draw_bounding_box_links \
scribo_draw_bounding_boxes \
scribo_filter_all \
-scribo_filter_large_objects \
-scribo_filter_small_object_groups \
-scribo_filter_small_objects \
-scribo_filter_thick_objects \
-scribo_filter_thin_objects \
-scribo_fun_v2b_small_objects_filter \
+scribo_filter_object_groups_small \
+scribo_filter_object_links_non_aligned \
+scribo_filter_object_links_non_h_aligned \
+scribo_filter_object_links_non_v_aligned \
+scribo_filter_objects_large \
+scribo_filter_objects_small \
+scribo_filter_objects_thick \
+scribo_filter_objects_thin \
+scribo_fun_v2b_objects_small_filter \
scribo_make_all \
scribo_make_debug_filename \
scribo_make_influence_zone_graph \
@@ -50,9 +53,6 @@ scribo_primitive_extract_lines_v_thick \
scribo_primitive_extract_objects \
scribo_primitive_group_all \
scribo_primitive_group_apply \
-scribo_primitive_group_filter_non_aligned \
-scribo_primitive_group_filter_non_h_aligned \
-scribo_primitive_group_filter_non_v_aligned \
scribo_primitive_group_from_double_link \
scribo_primitive_group_from_graph \
scribo_primitive_group_from_single_link \
@@ -114,12 +114,15 @@ scribo_draw_all_SOURCES = scribo_draw_all.cc
scribo_draw_bounding_box_links_SOURCES = scribo_draw_bounding_box_links.cc
scribo_draw_bounding_boxes_SOURCES = scribo_draw_bounding_boxes.cc
scribo_filter_all_SOURCES = scribo_filter_all.cc
-scribo_filter_large_objects_SOURCES = scribo_filter_large_objects.cc
-scribo_filter_small_object_groups_SOURCES = scribo_filter_small_object_groups.cc
-scribo_filter_small_objects_SOURCES = scribo_filter_small_objects.cc
-scribo_filter_thick_objects_SOURCES = scribo_filter_thick_objects.cc
-scribo_filter_thin_objects_SOURCES = scribo_filter_thin_objects.cc
-scribo_fun_v2b_small_objects_filter_SOURCES = scribo_fun_v2b_small_objects_filter.cc
+scribo_filter_object_groups_small_SOURCES = scribo_filter_object_groups_small.cc
+scribo_filter_object_links_non_aligned_SOURCES = scribo_filter_object_links_non_aligned.cc
+scribo_filter_object_links_non_h_aligned_SOURCES = scribo_filter_object_links_non_h_aligned.cc
+scribo_filter_object_links_non_v_aligned_SOURCES = scribo_filter_object_links_non_v_aligned.cc
+scribo_filter_objects_large_SOURCES = scribo_filter_objects_large.cc
+scribo_filter_objects_small_SOURCES = scribo_filter_objects_small.cc
+scribo_filter_objects_thick_SOURCES = scribo_filter_objects_thick.cc
+scribo_filter_objects_thin_SOURCES = scribo_filter_objects_thin.cc
+scribo_fun_v2b_objects_small_filter_SOURCES = scribo_fun_v2b_objects_small_filter.cc
scribo_make_all_SOURCES = scribo_make_all.cc
scribo_make_debug_filename_SOURCES = scribo_make_debug_filename.cc
scribo_make_influence_zone_graph_SOURCES = scribo_make_influence_zone_graph.cc
@@ -144,9 +147,6 @@ scribo_primitive_extract_lines_v_thick_SOURCES = scribo_primitive_extract_lines_
scribo_primitive_extract_objects_SOURCES = scribo_primitive_extract_objects.cc
scribo_primitive_group_all_SOURCES = scribo_primitive_group_all.cc
scribo_primitive_group_apply_SOURCES = scribo_primitive_group_apply.cc
-scribo_primitive_group_filter_non_aligned_SOURCES = scribo_primitive_group_filter_non_aligned.cc
-scribo_primitive_group_filter_non_h_aligned_SOURCES = scribo_primitive_group_filter_non_h_aligned.cc
-scribo_primitive_group_filter_non_v_aligned_SOURCES = scribo_primitive_group_filter_non_v_aligned.cc
scribo_primitive_group_from_double_link_SOURCES = scribo_primitive_group_from_double_link.cc
scribo_primitive_group_from_graph_SOURCES = scribo_primitive_group_from_graph.cc
scribo_primitive_group_from_single_link_SOURCES = scribo_primitive_group_from_single_link.cc
--
1.5.6.5
1
0
* filter/all.hh: Update includes.
* filter/large_objects.hh,
* filter/small_object_groups.hh,
* filter/small_objects.hh,
* filter/thick_objects.hh,
* filter/thin_objects.hh
* fun/v2b/small_objects_filter.hh: Move ...
* filter/object_groups_small.hh,
* filter/objects_large.hh,
* filter/objects_small.hh,
* filter/objects_thick.hh,
* filter/objects_thin.hh,
* fun/v2b/objects_small_filter.hh: ... here.
* src/filter/large_objects.cc,
* src/filter/small_objects.cc,
* src/filter/thick_objects.cc,
* src/filter/thin_objects.cc,
* src/preprocess.cc,
* src/recognition.cc,
* src/text/grouping/group_from_double_link.cc,
* src/text/grouping/group_from_double_several_links.cc,
* src/text/grouping/group_from_rag.cc,
* src/text_in_photo.cc,
* src/thin_bboxes.cc,
* tests/filter/small_and_large_bboxes.cc: Update function calls
and includes.
---
scribo/ChangeLog | 34 ++++++++++++++++++++
scribo/filter/all.hh | 9 +++--
...all_object_groups.hh => object_groups_small.hh} | 10 +++---
.../filter/{large_objects.hh => objects_large.hh} | 32 +++++++++---------
.../filter/{small_objects.hh => objects_small.hh} | 28 ++++++++--------
.../filter/{thick_objects.hh => objects_thick.hh} | 22 ++++++------
scribo/filter/{thin_objects.hh => objects_thin.hh} | 32 +++++++++---------
...l_objects_filter.hh => objects_small_filter.hh} | 16 +++++-----
scribo/src/filter/large_objects.cc | 4 +-
scribo/src/filter/small_objects.cc | 4 +-
scribo/src/filter/thick_objects.cc | 4 +-
scribo/src/filter/thin_objects.cc | 4 +-
scribo/src/preprocess.cc | 8 ++--
scribo/src/recognition.cc | 8 ++--
scribo/src/text/grouping/group_from_double_link.cc | 4 +-
.../grouping/group_from_double_several_links.cc | 4 +-
scribo/src/text/grouping/group_from_rag.cc | 14 ++++----
scribo/src/text_in_photo.cc | 16 +++++-----
scribo/src/thin_bboxes.cc | 6 ++--
scribo/tests/filter/small_and_large_bboxes.cc | 4 +-
20 files changed, 149 insertions(+), 114 deletions(-)
rename scribo/filter/{small_object_groups.hh => object_groups_small.hh} (90%)
rename scribo/filter/{large_objects.hh => objects_large.hh} (85%)
rename scribo/filter/{small_objects.hh => objects_small.hh} (84%)
rename scribo/filter/{thick_objects.hh => objects_thick.hh} (89%)
rename scribo/filter/{thin_objects.hh => objects_thin.hh} (85%)
rename scribo/fun/v2b/{small_objects_filter.hh => objects_small_filter.hh} (87%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 03925b6..a7cd378 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,39 @@
2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Rename filters.
+
+ * filter/all.hh: Update includes.
+
+ * filter/large_objects.hh,
+ * filter/small_object_groups.hh,
+ * filter/small_objects.hh,
+ * filter/thick_objects.hh,
+ * filter/thin_objects.hh
+ * fun/v2b/small_objects_filter.hh: Move ...
+
+ * filter/object_groups_small.hh,
+ * filter/objects_large.hh,
+ * filter/objects_small.hh,
+ * filter/objects_thick.hh,
+ * filter/objects_thin.hh,
+ * fun/v2b/objects_small_filter.hh: ... here.
+
+ * src/filter/large_objects.cc,
+ * src/filter/small_objects.cc,
+ * src/filter/thick_objects.cc,
+ * src/filter/thin_objects.cc,
+ * src/preprocess.cc,
+ * src/recognition.cc,
+ * src/text/grouping/group_from_double_link.cc,
+ * src/text/grouping/group_from_double_several_links.cc,
+ * src/text/grouping/group_from_rag.cc,
+ * src/text_in_photo.cc,
+ * src/thin_bboxes.cc,
+ * tests/filter/small_and_large_bboxes.cc: Update function calls
+ and includes.
+
+2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Mass renaming/cleanup in Scribo.
* extract/primitive/canvas.hh,
diff --git a/scribo/filter/all.hh b/scribo/filter/all.hh
index 9a1eed5..0b5bc11 100644
--- a/scribo/filter/all.hh
+++ b/scribo/filter/all.hh
@@ -41,9 +41,10 @@ namespace scribo
} // end of namespace scribo
-# include <scribo/filter/large_objects.hh>
-# include <scribo/filter/small_objects.hh>
-# include <scribo/filter/thick_objects.hh>
-# include <scribo/filter/thin_objects.hh>
+# include <scribo/filter/object_groups_small.hh>
+# include <scribo/filter/objects_large.hh>
+# include <scribo/filter/objects_small.hh>
+# include <scribo/filter/objects_thick.hh>
+# include <scribo/filter/objects_thin.hh>
#endif // ! SCRIBO_FILTER_ALL_HH
diff --git a/scribo/filter/small_object_groups.hh b/scribo/filter/object_groups_small.hh
similarity index 90%
rename from scribo/filter/small_object_groups.hh
rename to scribo/filter/object_groups_small.hh
index 5fa5ee3..fdfec6a 100644
--- a/scribo/filter/small_object_groups.hh
+++ b/scribo/filter/object_groups_small.hh
@@ -23,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_FILTER_SMALL_OBJECT_GROUPS_HH
-# define SCRIBO_FILTER_SMALL_OBJECT_GROUPS_HH
+#ifndef SCRIBO_FILTER_OBJECT_GROUPS_SMALL_HH
+# define SCRIBO_FILTER_OBJECT_GROUPS_SMALL_HH
/// \file
///
@@ -56,7 +56,7 @@ namespace scribo
*/
template <typename L>
mln::util::array<bool>
- small_object_groups(const object_groups<L>& groups,
+ object_groups_small(const object_groups<L>& groups,
unsigned n_links);
@@ -66,7 +66,7 @@ namespace scribo
template <typename L>
inline
mln::util::array<bool>
- small_object_groups(const object_groups<L>& parent_link,
+ object_groups_small(const object_groups<L>& parent_link,
unsigned n_links)
{
// Counting the number of objects per group.
@@ -89,5 +89,5 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_FILTER_SMALL_OBJECT_GROUPS_HH
+#endif // ! SCRIBO_FILTER_OBJECT_GROUPS_SMALL_HH
diff --git a/scribo/filter/large_objects.hh b/scribo/filter/objects_large.hh
similarity index 85%
rename from scribo/filter/large_objects.hh
rename to scribo/filter/objects_large.hh
index 4494965..dfef95c 100644
--- a/scribo/filter/large_objects.hh
+++ b/scribo/filter/objects_large.hh
@@ -23,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_FILTER_LARGE_OBJECTS_HH
-# define SCRIBO_FILTER_LARGE_OBJECTS_HH
+#ifndef SCRIBO_FILTER_OBJECTS_LARGE_HH
+# define SCRIBO_FILTER_OBJECTS_LARGE_HH
/// \file
///
@@ -65,7 +65,7 @@ namespace scribo
/// \return A binary image without large objects.
template <typename I, typename N, typename V>
mln_concrete(I)
- large_objects(const Image<I>& input_,
+ objects_large(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned max_size);
@@ -78,7 +78,7 @@ namespace scribo
/// \return updated text data.
template <typename L>
object_image(L)
- large_objects(const object_image(L)& objects,
+ objects_large(const object_image(L)& objects,
unsigned max_size);
@@ -93,8 +93,8 @@ namespace scribo
/// Filter Functor.
/// Return false for all objects which are too large.
template <typename L>
- struct large_objects_filter
- : Function_v2b< large_objects_filter<L> >
+ struct objects_large_filter
+ : Function_v2b< objects_large_filter<L> >
{
typedef accu::math::count<mln_psite(L)> card_t;
@@ -103,7 +103,7 @@ namespace scribo
///
/// \param[in] compbboxes Component bounding boxes.
/// \param[in] max_size Maximum object size.
- large_objects_filter(const object_image(L)& objects,
+ objects_large_filter(const object_image(L)& objects,
unsigned max_size)
{
card_ = labeling::compute(card_t(), objects, objects.nlabels());
@@ -139,12 +139,12 @@ namespace scribo
template <typename I, typename N, typename V>
inline
mln_concrete(I)
- large_objects(const Image<I>& input_,
+ objects_large(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned max_size)
{
- trace::entering("scribo::filter::large_objects");
+ trace::entering("scribo::filter::objects_large");
const I& input = exact(input_);
const N& nbh = exact(nbh_);
@@ -156,14 +156,14 @@ namespace scribo
typedef object_image(mln_ch_value(I,V)) lbl_t;
lbl_t lbl = primitive::extract::objects(input, nbh, nlabels);
- typedef internal::large_objects_filter<lbl_t> func_t;
+ typedef internal::objects_large_filter<lbl_t> func_t;
func_t fv2b(lbl, max_size);
labeling::relabel_inplace(lbl, nlabels, fv2b);
mln_concrete(I) output = duplicate(input);
data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
- trace::exiting("scribo::filter::large_objects");
+ trace::exiting("scribo::filter::objects_large");
return output;
}
@@ -171,20 +171,20 @@ namespace scribo
template <typename L>
inline
object_image(L)
- large_objects(const object_image(L)& objects,
+ objects_large(const object_image(L)& objects,
unsigned max_size)
{
- trace::entering("scribo::filter::large_objects");
+ trace::entering("scribo::filter::objects_large");
mln_precondition(objects.is_valid());
- internal::large_objects_filter<L> f(objects, max_size);
+ internal::objects_large_filter<L> f(objects, max_size);
object_image(L) output;
output.init_from_(objects);
output.relabel(f);
- trace::exiting("scribo::filter::large_objects");
+ trace::exiting("scribo::filter::objects_large");
return output;
}
@@ -195,4 +195,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_FILTER_LARGE_OBJECTS_HH
+#endif // ! SCRIBO_FILTER_OBJECTS_LARGE_HH
diff --git a/scribo/filter/small_objects.hh b/scribo/filter/objects_small.hh
similarity index 84%
rename from scribo/filter/small_objects.hh
rename to scribo/filter/objects_small.hh
index d6d7113..cb65136 100644
--- a/scribo/filter/small_objects.hh
+++ b/scribo/filter/objects_small.hh
@@ -23,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_FILTER_SMALL_OBJECTS_HH
-# define SCRIBO_FILTER_SMALL_OBJECTS_HH
+#ifndef SCRIBO_FILTER_OBJECTS_SMALL_HH
+# define SCRIBO_FILTER_OBJECTS_SMALL_HH
/// \file
///
@@ -50,7 +50,7 @@
# include <scribo/core/object_image.hh>
-# include <scribo/fun/v2b/small_objects_filter.hh>
+# include <scribo/fun/v2b/objects_small_filter.hh>
# include <scribo/primitive/extract/objects.hh>
@@ -74,7 +74,7 @@ namespace scribo
/// \return A binary image without small objects.
template <typename I, typename N, typename V>
mln_concrete(I)
- small_objects(const Image<I>& input_,
+ objects_small(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned min_size);
@@ -88,7 +88,7 @@ namespace scribo
/// \return An object image without small objects.
template <typename L>
object_image(L)
- small_objects(const object_image(L)& objects,
+ objects_small(const object_image(L)& objects,
unsigned min_size);
@@ -98,12 +98,12 @@ namespace scribo
template <typename I, typename N, typename V>
inline
mln_concrete(I)
- small_objects(const Image<I>& input_,
+ objects_small(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned min_size)
{
- trace::entering("scribo::filter::small_objects");
+ trace::entering("scribo::filter::objects_small");
const I& input = exact(input_);
const N& nbh = exact(nbh_);
@@ -115,7 +115,7 @@ namespace scribo
typedef mln_ch_value(I,V) lbl_t;
object_image(lbl_t) lbl = primitive::extract::objects(input, nbh, nlabels);
- typedef fun::v2b::small_objects_filter<mln_ch_value(I,V)> func_t;
+ typedef fun::v2b::objects_small_filter<mln_ch_value(I,V)> func_t;
func_t fv2b(lbl, min_size);
lbl.relabel(fv2b);
@@ -123,7 +123,7 @@ namespace scribo
data::fill((output | pw::value(lbl) == pw::cst(literal::zero)).rw(),
false);
- trace::exiting("scribo::filter::small_objects");
+ trace::exiting("scribo::filter::objects_small");
return output;
}
@@ -131,20 +131,20 @@ namespace scribo
template <typename L>
inline
object_image(L)
- small_objects(const object_image(L)& objects,
+ objects_small(const object_image(L)& objects,
unsigned min_size)
{
- trace::entering("scribo::filter::small_objects");
+ trace::entering("scribo::filter::objects_small");
mln_precondition(objects.is_valid());
- fun::v2b::small_objects_filter<L> f(objects, min_size);
+ fun::v2b::objects_small_filter<L> f(objects, min_size);
object_image(L) output;
output.init_from_(objects);
output.relabel(f);
- trace::exiting("scribo::filter::small_objects");
+ trace::exiting("scribo::filter::objects_small");
return output;
}
@@ -155,4 +155,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_FILTER_SMALL_OBJECTS_HH
+#endif // ! SCRIBO_FILTER_OBJECTS_SMALL_HH
diff --git a/scribo/filter/thick_objects.hh b/scribo/filter/objects_thick.hh
similarity index 89%
rename from scribo/filter/thick_objects.hh
rename to scribo/filter/objects_thick.hh
index 2cb1f30..519bd8c 100644
--- a/scribo/filter/thick_objects.hh
+++ b/scribo/filter/objects_thick.hh
@@ -23,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_FILTER_THICK_OBJECTS_HH
-# define SCRIBO_FILTER_THICK_OBJECTS_HH
+#ifndef SCRIBO_FILTER_OBJECTS_THICK_HH
+# define SCRIBO_FILTER_OBJECTS_THICK_HH
/// \file
///
@@ -60,7 +60,7 @@ namespace scribo
template <typename I, typename N, typename V>
inline
mln_concrete(I)
- thick_objects(const Image<I>& input_,
+ objects_thick(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned max_thickness);
@@ -76,7 +76,7 @@ namespace scribo
template <typename L>
inline
object_image(L)
- thick_objects(const object_image(L)& objects,
+ objects_thick(const object_image(L)& objects,
unsigned max_thickness);
@@ -130,12 +130,12 @@ namespace scribo
template <typename I, typename N, typename V>
inline
mln_concrete(I)
- thick_objects(const Image<I>& input_,
+ objects_thick(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned max_thickness)
{
- trace::entering("scribo::filter::thick_objects");
+ trace::entering("scribo::filter::objects_thick");
const I& input = exact(input_);
const N& nbh = exact(nbh_);
@@ -155,7 +155,7 @@ namespace scribo
mln_concrete(I) output = duplicate(input);
data::fill((output | pw::value(objects) == literal::zero).rw(), false);
- trace::exiting("scribo::filter::thick_objects");
+ trace::exiting("scribo::filter::objects_thick");
return output;
}
@@ -163,10 +163,10 @@ namespace scribo
template <typename L>
inline
object_image(L)
- thick_objects(const object_image(L)& objects,
+ objects_thick(const object_image(L)& objects,
unsigned max_thickness)
{
- trace::entering("scribo::filter::thick_objects");
+ trace::entering("scribo::filter::objects_thick");
mln_precondition(objects.is_valid());
@@ -177,7 +177,7 @@ namespace scribo
output.init_from_(objects);
output.relabel(is_not_too_thick);
- trace::exiting("scribo::filter::thick_objects");
+ trace::exiting("scribo::filter::objects_thick");
return output;
}
@@ -188,4 +188,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_FILTER_THICK_OBJECTS_HH
+#endif // ! SCRIBO_FILTER_OBJECTS_THICK_HH
diff --git a/scribo/filter/thin_objects.hh b/scribo/filter/objects_thin.hh
similarity index 85%
rename from scribo/filter/thin_objects.hh
rename to scribo/filter/objects_thin.hh
index 2149a38..510a64f 100644
--- a/scribo/filter/thin_objects.hh
+++ b/scribo/filter/objects_thin.hh
@@ -23,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_FILTER_THIN_OBJECTS_HH
-# define SCRIBO_FILTER_THIN_OBJECTS_HH
+#ifndef SCRIBO_FILTER_OBJECTS_THIN_HH
+# define SCRIBO_FILTER_OBJECTS_THIN_HH
/// \file
///
@@ -58,7 +58,7 @@ namespace scribo
template <typename I, typename N, typename V>
inline
mln_concrete(I)
- thin_objects(const Image<I>& input_,
+ objects_thin(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned min_thickness);
@@ -73,7 +73,7 @@ namespace scribo
template <typename L>
inline
object_image(L)
- thin_objects(const object_image(L)& text,
+ objects_thin(const object_image(L)& text,
unsigned min_thickness);
@@ -86,8 +86,8 @@ namespace scribo
/// Filter Functor.
/// Return false for all objects which are too large.
template <typename L>
- struct thin_objects_filter
- : Function_v2b< thin_objects_filter<L> >
+ struct objects_thin_filter
+ : Function_v2b< objects_thin_filter<L> >
{
typedef accu::shape::bbox<mln_psite(L)> box_accu_t;
@@ -95,7 +95,7 @@ namespace scribo
///
/// \param[in] objects object bounding boxes.
/// \param[in] min_thickness the minimum thickness allowed.
- thin_objects_filter(const object_image(L)& objects,
+ objects_thin_filter(const object_image(L)& objects,
unsigned min_thickness)
: objects_(objects), min_thickness_(min_thickness)
{
@@ -128,12 +128,12 @@ namespace scribo
template <typename I, typename N, typename V>
inline
mln_concrete(I)
- thin_objects(const Image<I>& input_,
+ objects_thin(const Image<I>& input_,
const Neighborhood<N>& nbh_,
const V& label_type,
unsigned min_thickness)
{
- trace::entering("scribo::filter::thin_objects");
+ trace::entering("scribo::filter::objects_thin");
const I& input = exact(input_);
const N& nbh = exact(nbh_);
@@ -146,7 +146,7 @@ namespace scribo
object_image(lbl_t) objects
= primitive::extract::objects(input, nbh, nlabels);
- typedef internal::thin_objects_filter<lbl_t> func_t;
+ typedef internal::objects_thin_filter<lbl_t> func_t;
func_t fv2b(objects, min_thickness);
objects.relabel(fv2b);
@@ -154,7 +154,7 @@ namespace scribo
data::fill((output | pw::value(objects) == pw::cst(literal::zero)).rw(),
false);
- trace::exiting("scribo::filter::thin_objects");
+ trace::exiting("scribo::filter::objects_thin");
return output;
}
@@ -162,21 +162,21 @@ namespace scribo
template <typename L>
inline
object_image(L)
- thin_objects(const object_image(L)& objects,
+ objects_thin(const object_image(L)& objects,
unsigned min_thickness)
{
- trace::entering("scribo::filter::thin_objects");
+ trace::entering("scribo::filter::objects_thin");
mln_precondition(objects.is_valid());
- typedef internal::thin_objects_filter<L> func_t;
+ typedef internal::objects_thin_filter<L> func_t;
func_t is_not_too_thin(objects, min_thickness);
object_image(L) output;
output.init_from_(objects);
output.relabel(is_not_too_thin);
- trace::exiting("scribo::filter::thin_objects");
+ trace::exiting("scribo::filter::objects_thin");
return output;
}
@@ -187,4 +187,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_FILTER_THIN_OBJECTS_HH
+#endif // ! SCRIBO_FILTER_OBJECTS_THIN_HH
diff --git a/scribo/fun/v2b/small_objects_filter.hh b/scribo/fun/v2b/objects_small_filter.hh
similarity index 87%
rename from scribo/fun/v2b/small_objects_filter.hh
rename to scribo/fun/v2b/objects_small_filter.hh
index 477bd47..1ccac12 100644
--- a/scribo/fun/v2b/small_objects_filter.hh
+++ b/scribo/fun/v2b/objects_small_filter.hh
@@ -23,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_FUN_V2B_SMALL_OBJECTS_FILTER_HH
-# define SCRIBO_FUN_V2B_SMALL_OBJECTS_FILTER_HH
+#ifndef SCRIBO_FUN_V2B_OBJECTS_SMALL_FILTER_HH
+# define SCRIBO_FUN_V2B_OBJECTS_SMALL_FILTER_HH
/// \file
///
@@ -58,8 +58,8 @@ namespace scribo
/// Filter Functor.
/// Return false for all objects which are too small.
template <typename L>
- struct small_objects_filter
- : Function_v2b< small_objects_filter<L> >
+ struct objects_small_filter
+ : Function_v2b< objects_small_filter<L> >
{
typedef accu::math::count<mln_psite(L)> card_t;
@@ -68,7 +68,7 @@ namespace scribo
/// \param[in] objects Component bounding boxes.
/// \param[in] min_size Minimum component size.
//
- small_objects_filter(const object_image(L)& objects,
+ objects_small_filter(const object_image(L)& objects,
unsigned min_size);
@@ -96,7 +96,7 @@ namespace scribo
template <typename L>
inline
- small_objects_filter<L>::small_objects_filter(
+ objects_small_filter<L>::objects_small_filter(
const object_image(L)& objects,
unsigned min_size)
{
@@ -109,7 +109,7 @@ namespace scribo
template <typename L>
inline
bool
- small_objects_filter<L>::operator()(const mln_value(L)& l) const
+ objects_small_filter<L>::operator()(const mln_value(L)& l) const
{
if (l == literal::zero)
return true;
@@ -126,4 +126,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_FILTER_SMALL_OBJECTS_HH
+#endif // ! SCRIBO_FUN_V2B_OBJECTS_SMALL_FILTER_HH
diff --git a/scribo/src/filter/large_objects.cc b/scribo/src/filter/large_objects.cc
index d2e91c5..a665032 100644
--- a/scribo/src/filter/large_objects.cc
+++ b/scribo/src/filter/large_objects.cc
@@ -30,7 +30,7 @@
#include <mln/value/label_16.hh>
-#include <scribo/filter/large_objects.hh>
+#include <scribo/filter/objects_large.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
obj_ima_t objects
= scribo::primitive::extract::objects(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::large_objects(objects, atoi(argv[2]));
+ obj_ima_t filtered = scribo::filter::objects_large(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/small_objects.cc b/scribo/src/filter/small_objects.cc
index f9a318e..ce57f00 100644
--- a/scribo/src/filter/small_objects.cc
+++ b/scribo/src/filter/small_objects.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
-#include <scribo/filter/small_objects.hh>
+#include <scribo/filter/objects_small.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
obj_ima_t objects
= scribo::primitive::extract::objects(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::small_objects(objects, atoi(argv[2]));
+ obj_ima_t filtered = scribo::filter::objects_small(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/thick_objects.cc b/scribo/src/filter/thick_objects.cc
index 91fba14..495c9e0 100644
--- a/scribo/src/filter/thick_objects.cc
+++ b/scribo/src/filter/thick_objects.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
-#include <scribo/filter/thick_objects.hh>
+#include <scribo/filter/objects_thick.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
obj_ima_t objects
= scribo::primitive::extract::objects(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::thick_objects(objects, atoi(argv[2]));
+ obj_ima_t filtered = scribo::filter::objects_thick(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/thin_objects.cc b/scribo/src/filter/thin_objects.cc
index 9da3981..d1be415 100644
--- a/scribo/src/filter/thin_objects.cc
+++ b/scribo/src/filter/thin_objects.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
-#include <scribo/filter/thin_objects.hh>
+#include <scribo/filter/objects_thin.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
obj_ima_t objects
= scribo::primitive::extract::objects(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::thin_objects(objects, atoi(argv[2]));
+ obj_ima_t filtered = scribo::filter::objects_thin(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/preprocess.cc b/scribo/src/preprocess.cc
index 57a0fb7..8c34930 100644
--- a/scribo/src/preprocess.cc
+++ b/scribo/src/preprocess.cc
@@ -35,8 +35,8 @@
#include <scribo/binarization/simple.hh>
#include <scribo/preprocessing/unskew.hh>
-#include <scribo/filter/small_objects.hh>
-#include <scribo/filter/thin_objects.hh>
+#include <scribo/filter/objects_small.hh>
+#include <scribo/filter/objects_thin.hh>
#include <scribo/debug/usage.hh>
@@ -65,8 +65,8 @@ int main(int argc, char *argv[])
image2d<bool> input_bw = scribo::binarization::simple(input);
logical::not_inplace(input_bw);
- input_bw = scribo::filter::small_objects(input_bw, c8(), value::label_16(), 3);
- input_bw = scribo::filter::thin_objects(input_bw, c8(), value::label_16(), 1);
+ input_bw = scribo::filter::objects_small(input_bw, c8(), value::label_16(), 3);
+ input_bw = scribo::filter::objects_thin(input_bw, c8(), value::label_16(), 1);
input_bw = scribo::preprocessing::unskew(input_bw).first();
diff --git a/scribo/src/recognition.cc b/scribo/src/recognition.cc
index f9ea901..de5cafa 100644
--- a/scribo/src/recognition.cc
+++ b/scribo/src/recognition.cc
@@ -42,8 +42,8 @@
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/link/with_several_right_links.hh>
#include <scribo/primitive/group/from_double_link.hh>
-#include <scribo/filter/small_objects.hh>
-#include <scribo/filter/thin_objects.hh>
+#include <scribo/filter/objects_small.hh>
+#include <scribo/filter/objects_thin.hh>
#include <scribo/text/recognition.hh>
#include <scribo/debug/usage.hh>
@@ -82,8 +82,8 @@ int main(int argc, char* argv[])
objects = scribo::primitive::extract::objects(input, c8(), nbboxes);
/// Filter non interesting objects
- objects = filter::small_objects(objects, 4);
- objects = filter::thin_objects<L>(objects, 2);
+ objects = filter::objects_small(objects, 4);
+ objects = filter::objects_thin<L>(objects, 2);
/// Group objects.
object_links<L> left_link
diff --git a/scribo/src/text/grouping/group_from_double_link.cc b/scribo/src/text/grouping/group_from_double_link.cc
index bcd768f..9e8a6b3 100644
--- a/scribo/src/text/grouping/group_from_double_link.cc
+++ b/scribo/src/text/grouping/group_from_double_link.cc
@@ -43,7 +43,7 @@
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
-#include <scribo/filter/small_objects.hh>
+#include <scribo/filter/objects_small.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
typedef object_image(L) text_t;
text_t text = primitive::extract::objects(input, c8(), nbboxes);
- text = filter::small_objects(text, 4);
+ text = filter::objects_small(text, 4);
object_links<L> left_link
= primitive::link::with_single_left_link(text, atoi(argv[2]));
diff --git a/scribo/src/text/grouping/group_from_double_several_links.cc b/scribo/src/text/grouping/group_from_double_several_links.cc
index de9eb20..5b591c2 100644
--- a/scribo/src/text/grouping/group_from_double_several_links.cc
+++ b/scribo/src/text/grouping/group_from_double_several_links.cc
@@ -42,7 +42,7 @@
#include <scribo/primitive/link/with_several_right_links.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
-#include <scribo/filter/small_objects.hh>
+#include <scribo/filter/objects_small.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
std::cout << "Remove small components" << std::endl;
- text = filter::small_objects(text,4);
+ text = filter::objects_small(text,4);
std::cout << "Group with left link" << std::endl;
object_links<L> left_link
diff --git a/scribo/src/text/grouping/group_from_rag.cc b/scribo/src/text/grouping/group_from_rag.cc
index 5bc8b86..8b3d5fd 100644
--- a/scribo/src/text/grouping/group_from_rag.cc
+++ b/scribo/src/text/grouping/group_from_rag.cc
@@ -48,12 +48,12 @@
#include <scribo/primitive/link/with_rag.hh>
//#include <scribo/primitive/group/from_rag.hh>
-#include <scribo/filter/small_objects.hh>
-#include <scribo/filter/thin_objects.hh>
-#include <scribo/filter/thick_objects.hh>
+#include <scribo/filter/objects_small.hh>
+#include <scribo/filter/objects_thin.hh>
+#include <scribo/filter/objects_thick.hh>
-#include <scribo/fun/v2b/small_objects_filter.hh>
+#include <scribo/fun/v2b/objects_small_filter.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -177,13 +177,13 @@ int main(int argc, char* argv[])
/// First filtering.
objects_t filtered_objects
- = scribo::filter::small_objects(objects, 6);
+ = scribo::filter::objects_small(objects, 6);
filtered_objects
- = scribo::filter::thin_objects(filtered_objects, 3);
+ = scribo::filter::objects_thin(filtered_objects, 3);
filtered_objects
- = scribo::filter::thick_objects(filtered_objects,
+ = scribo::filter::objects_thick(filtered_objects,
math::min(input.ncols(), input.nrows()) / 6);
diff --git a/scribo/src/text_in_photo.cc b/scribo/src/text_in_photo.cc
index b18825e..1cf90b5 100644
--- a/scribo/src/text_in_photo.cc
+++ b/scribo/src/text_in_photo.cc
@@ -48,10 +48,10 @@
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/primitive/group/from_single_link.hh>
-#include <scribo/filter/small_objects.hh>
-#include <scribo/filter/thin_objects.hh>
-#include <scribo/filter/thick_objects.hh>
-#include <scribo/filter/small_object_groups.hh>
+#include <scribo/filter/objects_small.hh>
+#include <scribo/filter/objects_thin.hh>
+#include <scribo/filter/objects_thick.hh>
+#include <scribo/filter/object_groups_small.hh>
#include <scribo/make/debug_filename.hh>
#include <scribo/debug/save_bboxes_image.hh>
@@ -97,13 +97,13 @@ highlighted.");
/// First filtering.
object_image(L) filtered_objects
- = scribo::filter::small_objects(objects, 6);
+ = scribo::filter::objects_small(objects, 6);
filtered_objects
- = scribo::filter::thin_objects(filtered_objects, 1);
+ = scribo::filter::objects_thin(filtered_objects, 1);
filtered_objects
- = scribo::filter::thick_objects(filtered_objects,
+ = scribo::filter::objects_thick(filtered_objects,
math::min(input.ncols(), input.nrows()) / 5);
/// Grouping potential objects
@@ -131,7 +131,7 @@ highlighted.");
// Remove objects part of groups with less than 3 objects.
mln::util::array<bool>
- to_be_kept = filter::small_object_groups(groups, 3);
+ to_be_kept = filter::object_groups_small(groups, 3);
// FOR DEBUGGING PURPOSE.
diff --git a/scribo/src/thin_bboxes.cc b/scribo/src/thin_bboxes.cc
index db4dfcf..39c658a 100644
--- a/scribo/src/thin_bboxes.cc
+++ b/scribo/src/thin_bboxes.cc
@@ -34,7 +34,7 @@
#include <scribo/text/extract_lines.hh>
-#include <scribo/filter/thin_objects.hh>
+#include <scribo/filter/objects_thin.hh>
int usage(const char *name)
{
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
if (argc < 1)
return usage(argv[0]);
- scribo::make::internal::debug_filename_prefix = "thin_objects";
+ scribo::make::internal::debug_filename_prefix = "objects_thin";
image2d<bool> input;
io::pbm::load(input, argv[1]);
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
typedef object_image(image2d<value::label_16>) text_t;
text_t lines = scribo::text::extract_lines(input, c8(), nlines);
- text_t filtered_lines = scribo::filter::thin_objects(lines, 5);
+ text_t filtered_lines = scribo::filter::objects_thin(lines, 5);
scribo::debug::save_bboxes_image(input, filtered_lines.bboxes(),
literal::red,
diff --git a/scribo/tests/filter/small_and_large_bboxes.cc b/scribo/tests/filter/small_and_large_bboxes.cc
index 2d765df..0b10cfe 100644
--- a/scribo/tests/filter/small_and_large_bboxes.cc
+++ b/scribo/tests/filter/small_and_large_bboxes.cc
@@ -38,7 +38,7 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_graph.hh>
#include <scribo/primitive/group/from_graph.hh>
-#include <scribo/filter/small_objects.hh>
+#include <scribo/filter/objects_small.hh>
#include <scribo/util/text.hh>
#include <scribo/make/debug_filename.hh>
@@ -99,7 +99,7 @@ int main(int argc, char* argv[])
mln_assertion(grouped_text.nlabels() == 6u);
text_t
- filtered_text = scribo::filter::small_objects(grouped_text, 20);
+ filtered_text = scribo::filter::objects_small(grouped_text, 20);
mln_assertion(filtered_text.nlabels() == 2u);
--
1.5.6.5
1
0
* extract/primitive/canvas.hh,
* extract/primitive/cells.hh,
* extract/primitive/lines_discontinued.hh,
* extract/primitive/lines_h_discontinued.hh,
* extract/primitive/lines_h_pattern.hh,
* extract/primitive/lines_h_single.hh,
* extract/primitive/lines_h_thick.hh,
* extract/primitive/lines_pattern.hh,
* extract/primitive/lines_thick.hh,
* extract/primitive/lines_v_discontinued.hh,
* extract/primitive/lines_v_pattern.hh,
* extract/primitive/lines_v_single.hh,
* extract/primitive/lines_v_thick.hh,
* extract/primitive/objects.hh,
* text/grouping/group_from_double_link.hh,
* text/grouping/group_from_graph.hh,
* text/grouping/group_from_single_link.hh,
* text/grouping/group_with_graph.hh,
* text/grouping/group_with_rag.hh,
* text/grouping/group_with_several_graphes.hh,
* text/grouping/group_with_several_left_links.hh,
* text/grouping/group_with_several_right_links.hh,
* text/grouping/group_with_single_left_link.hh,
* text/grouping/group_with_single_right_link.hh,
* text/grouping/internal/find_graph_link.hh,
* text/grouping/internal/find_root.hh,
* text/grouping/internal/have_link_valid.hh,
* text/grouping/internal/init_link_array.hh,
* text/grouping/internal/init_link_array.hh,
* text/grouping/internal/is_link_valid.hh,
* text/grouping/internal/update_link_array.hh: Move...
* primitive/extract/canvas.hh,
* primitive/extract/cells.hh,
* primitive/extract/lines_discontinued.hh,
* primitive/extract/lines_h_discontinued.hh,
* primitive/extract/lines_h_pattern.hh,
* primitive/extract/lines_h_single.hh,
* primitive/extract/lines_h_thick.hh,
* primitive/extract/lines_pattern.hh,
* primitive/extract/lines_thick.hh,
* primitive/extract/lines_v_discontinued.hh,
* primitive/extract/lines_v_pattern.hh,
* primitive/extract/lines_v_single.hh,
* primitive/extract/lines_v_thick.hh,
* primitive/extract/objects.hh,
* primitive/group/from_double_link.hh,
* primitive/group/from_graph.hh,
* primitive/group/from_single_link.hh,
* primitive/internal/find_graph_link.hh,
* primitive/internal/find_root.hh,
* primitive/internal/have_link_valid.hh,
* primitive/internal/init_link_array.hh,
* primitive/internal/is_link_valid.hh,
* primitive/internal/update_graph_link.hh,
* primitive/link/with_graph.hh,
* primitive/link/with_rag.hh,
* primitive/link/with_several_graphes.hh,
* primitive/link/with_several_left_links.hh,
* primitive/link/with_several_right_links.hh,
* primitive/link/with_single_left_link.hh,
* primitive/link/with_single_right_link.hh: ... here.
* text/all.hh,
* all.hh: Update includes.
* draw/bounding_box_links.hh
* filter/large_objects.hh
* filter/small_object_groups.hh
* filter/thick_objects.hh
* filter/thin_objects.hh
* src/extract/primitive/extract_discontinued_hlines.cc
* src/extract/primitive/extract_discontinued_lines.cc
* src/extract/primitive/extract_discontinued_vlines.cc
* src/extract/primitive/extract_thick_hlines.cc
* src/extract/primitive/extract_thick_vlines.cc
* src/extract/primitive/find_discontinued_lines.cc
* src/extract/primitive/find_single_lines.cc
* src/extract/primitive/find_thick_lines.cc
* src/filter/large_objects.cc
* src/filter/small_objects.cc
* src/filter/thick_objects.cc
* src/filter/thin_objects.cc
* src/recognition.cc
* src/table/erase.cc
* src/table_rebuild_opening.cc
* src/table_rebuild_rank.cc
* src/text/grouping/group_from_double_link.cc
* src/text/grouping/group_from_double_several_links.cc
* src/text/grouping/group_from_graph.cc
* src/text/grouping/group_from_rag.cc
* src/text/grouping/group_from_several_graph.cc
* src/text/grouping/group_from_several_left_links.cc
* src/text/grouping/group_from_single_link.cc
* src/text_in_photo.cc
* table/extract.hh
* table/internal/repair_lines.hh
* tests/filter/small_and_large_bboxes.cc
* tests/table/extract_lines_with_rank.cc
* text/extract_lines.hh: Update function calls and includes.
* filter/small_objects.hh: Update function calls and includes, and
use a functor.
* fun/v2b/small_objects_filter.hh: New filter functor.
* tests/unit_test/unit-tests.mk,
* headers.mk: Regen.
* make/influence_zone_graph.hh: Fix wrong namespace.
* primitive/group/apply.hh: New routine.
* primitive/link/all.hh,
* primitive/group/all.hh: New.
* text/grouping/internal/all.hh,
* text/grouping/internal/find_left_link.hh,
* text/grouping/internal/find_right_link.hh,
* text/grouping/internal/init_link_array.hh,
* text/grouping/internal/update_graph_link.hh: Move...
* primitive/internal/all.hh,
* primitive/internal/find_left_link.hh,
* primitive/internal/find_right_link.hh,
* primitive/internal/init_link_array.hh,
* primitive/internal/update_graph_link.hh: ... here.
* primitive/link/merge_double_link.hh: New routine.
---
scribo/ChangeLog | 135 +++++++++++++++++
scribo/all.hh | 1 +
scribo/draw/bounding_box_links.hh | 16 +-
scribo/filter/large_objects.hh | 4 +-
scribo/filter/small_object_groups.hh | 10 +-
scribo/filter/small_objects.hh | 61 +-------
scribo/filter/thick_objects.hh | 4 +-
scribo/filter/thin_objects.hh | 4 +-
scribo/fun/v2b/small_objects_filter.hh | 129 ++++++++++++++++
scribo/headers.mk | 78 ++++++----
scribo/make/influence_zone_graph.hh | 98 ++++++-------
scribo/{ => primitive}/all.hh | 29 ++--
scribo/{text/grouping => primitive/extract}/all.hh | 47 ++++---
.../primitive => primitive/extract}/canvas.hh | 33 ++--
.../primitive => primitive/extract}/cells.hh | 20 ++--
.../extract}/lines_discontinued.hh | 22 ++--
.../extract}/lines_h_discontinued.hh | 16 +-
.../extract}/lines_h_pattern.hh | 19 ++-
.../extract}/lines_h_single.hh | 14 +-
.../extract}/lines_h_thick.hh | 16 +-
.../extract}/lines_pattern.hh | 16 +-
.../primitive => primitive/extract}/lines_thick.hh | 24 ++--
.../extract}/lines_v_discontinued.hh | 16 +-
.../extract}/lines_v_pattern.hh | 19 ++-
.../extract}/lines_v_single.hh | 14 +-
.../extract}/lines_v_thick.hh | 16 +-
.../primitive => primitive/extract}/objects.hh | 19 ++-
scribo/{text => primitive/group}/all.hh | 30 +++--
scribo/primitive/group/apply.hh | 126 ++++++++++++++++
.../group/from_double_link.hh} | 83 ++++-------
.../group/from_graph.hh} | 69 +++++----
.../group/from_single_link.hh} | 50 ++++---
.../internal/all.hh} | 52 +++-----
.../internal/find_graph_link.hh | 93 ++++++------
scribo/primitive/internal/find_left_link.hh | 104 +++++++++++++
scribo/primitive/internal/find_right_link.hh | 105 +++++++++++++
.../grouping => primitive}/internal/find_root.hh | 15 +--
.../internal/have_link_valid.hh} | 53 +++----
.../internal/init_link_array.hh | 39 ++---
.../internal/is_link_valid.hh} | 61 ++++----
scribo/primitive/internal/update_graph_link.hh | 102 +++++++++++++
.../internal/update_link_array.hh | 86 +++++------
scribo/{text => primitive/link}/all.hh | 33 +++--
scribo/primitive/link/merge_double_link.hh | 123 +++++++++++++++
.../link/with_graph.hh} | 30 ++--
.../link/with_rag.hh} | 24 ++--
.../link/with_several_graphes.hh} | 34 ++--
.../link/with_several_left_links.hh} | 46 +++---
.../link/with_several_right_links.hh} | 46 +++---
.../link/with_single_left_link.hh} | 39 +++---
.../link/with_single_right_link.hh} | 39 +++---
.../primitive/extract_discontinued_hlines.cc | 4 +-
.../primitive/extract_discontinued_lines.cc | 8 +-
.../primitive/extract_discontinued_vlines.cc | 4 +-
.../src/extract/primitive/extract_thick_hlines.cc | 4 +-
.../src/extract/primitive/extract_thick_vlines.cc | 4 +-
.../extract/primitive/find_discontinued_lines.cc | 8 +-
scribo/src/extract/primitive/find_single_lines.cc | 12 +-
scribo/src/extract/primitive/find_thick_lines.cc | 16 +-
scribo/src/filter/large_objects.cc | 2 +-
scribo/src/filter/small_objects.cc | 2 +-
scribo/src/filter/thick_objects.cc | 2 +-
scribo/src/filter/thin_objects.cc | 2 +-
scribo/src/recognition.cc | 31 ++--
scribo/src/table/erase.cc | 8 +-
scribo/src/table_rebuild_opening.cc | 8 +-
scribo/src/table_rebuild_rank.cc | 8 +-
scribo/src/text/grouping/group_from_double_link.cc | 30 +++--
.../grouping/group_from_double_several_links.cc | 50 +++----
scribo/src/text/grouping/group_from_graph.cc | 20 ++-
scribo/src/text/grouping/group_from_rag.cc | 10 +-
.../src/text/grouping/group_from_several_graph.cc | 19 ++-
.../text/grouping/group_from_several_left_links.cc | 22 ++-
scribo/src/text/grouping/group_from_single_link.cc | 34 +++--
scribo/src/text_in_photo.cc | 42 +++---
scribo/table/extract.hh | 14 +-
scribo/table/internal/repair_lines.hh | 4 +-
scribo/tests/filter/small_and_large_bboxes.cc | 22 ++--
scribo/tests/table/extract_lines_with_rank.cc | 15 +-
scribo/tests/unit_test/unit-tests.mk | 156 ++++++++++++--------
scribo/text/all.hh | 1 -
scribo/text/extract_lines.hh | 30 +++--
scribo/text/grouping/internal/all.hh | 65 --------
scribo/text/grouping/internal/find_left_link.hh | 107 -------------
scribo/text/grouping/internal/find_right_link.hh | 110 --------------
scribo/text/grouping/internal/update_graph_link.hh | 107 -------------
86 files changed, 1885 insertions(+), 1458 deletions(-)
create mode 100644 scribo/fun/v2b/small_objects_filter.hh
copy scribo/{ => primitive}/all.hh (76%)
rename scribo/{text/grouping => primitive/extract}/all.hh (52%)
rename scribo/{extract/primitive => primitive/extract}/canvas.hh (81%)
rename scribo/{extract/primitive => primitive/extract}/cells.hh (88%)
rename scribo/{extract/primitive => primitive/extract}/lines_discontinued.hh (87%)
rename scribo/{extract/primitive => primitive/extract}/lines_h_discontinued.hh (90%)
rename scribo/{extract/primitive => primitive/extract}/lines_h_pattern.hh (87%)
rename scribo/{extract/primitive => primitive/extract}/lines_h_single.hh (94%)
rename scribo/{extract/primitive => primitive/extract}/lines_h_thick.hh (90%)
rename scribo/{extract/primitive => primitive/extract}/lines_pattern.hh (90%)
rename scribo/{extract/primitive => primitive/extract}/lines_thick.hh (86%)
rename scribo/{extract/primitive => primitive/extract}/lines_v_discontinued.hh (90%)
rename scribo/{extract/primitive => primitive/extract}/lines_v_pattern.hh (86%)
rename scribo/{extract/primitive => primitive/extract}/lines_v_single.hh (94%)
rename scribo/{extract/primitive => primitive/extract}/lines_v_thick.hh (90%)
rename scribo/{extract/primitive => primitive/extract}/objects.hh (89%)
copy scribo/{text => primitive/group}/all.hh (69%)
create mode 100644 scribo/primitive/group/apply.hh
rename scribo/{text/grouping/group_from_double_link.hh => primitive/group/from_double_link.hh} (57%)
rename scribo/{text/grouping/group_from_graph.hh => primitive/group/from_graph.hh} (70%)
rename scribo/{text/grouping/group_from_single_link.hh => primitive/group/from_single_link.hh} (68%)
copy scribo/{text/grouping/internal/init_link_array.hh => primitive/internal/all.hh} (61%)
rename scribo/{text/grouping => primitive}/internal/find_graph_link.hh (51%)
create mode 100644 scribo/primitive/internal/find_left_link.hh
create mode 100644 scribo/primitive/internal/find_right_link.hh
rename scribo/{text/grouping => primitive}/internal/find_root.hh (84%)
rename scribo/{text/grouping/internal/is_link_valid.hh => primitive/internal/have_link_valid.hh} (60%)
rename scribo/{text/grouping => primitive}/internal/init_link_array.hh (69%)
rename scribo/{text/grouping/internal/have_link_valid.hh => primitive/internal/is_link_valid.hh} (56%)
create mode 100644 scribo/primitive/internal/update_graph_link.hh
rename scribo/{text/grouping => primitive}/internal/update_link_array.hh (52%)
copy scribo/{text => primitive/link}/all.hh (64%)
create mode 100644 scribo/primitive/link/merge_double_link.hh
rename scribo/{text/grouping/group_with_graph.hh => primitive/link/with_graph.hh} (79%)
rename scribo/{text/grouping/group_with_rag.hh => primitive/link/with_rag.hh} (80%)
rename scribo/{text/grouping/group_with_several_graphes.hh => primitive/link/with_several_graphes.hh} (77%)
rename scribo/{text/grouping/group_with_several_left_links.hh => primitive/link/with_several_left_links.hh} (76%)
rename scribo/{text/grouping/group_with_several_right_links.hh => primitive/link/with_several_right_links.hh} (76%)
rename scribo/{text/grouping/group_with_single_left_link.hh => primitive/link/with_single_left_link.hh} (75%)
rename scribo/{text/grouping/group_with_single_right_link.hh => primitive/link/with_single_right_link.hh} (73%)
delete mode 100644 scribo/text/grouping/internal/all.hh
delete mode 100644 scribo/text/grouping/internal/find_left_link.hh
delete mode 100644 scribo/text/grouping/internal/find_right_link.hh
delete mode 100644 scribo/text/grouping/internal/update_graph_link.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 0aae996..03925b6 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,140 @@
2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Mass renaming/cleanup in Scribo.
+
+ * extract/primitive/canvas.hh,
+ * extract/primitive/cells.hh,
+ * extract/primitive/lines_discontinued.hh,
+ * extract/primitive/lines_h_discontinued.hh,
+ * extract/primitive/lines_h_pattern.hh,
+ * extract/primitive/lines_h_single.hh,
+ * extract/primitive/lines_h_thick.hh,
+ * extract/primitive/lines_pattern.hh,
+ * extract/primitive/lines_thick.hh,
+ * extract/primitive/lines_v_discontinued.hh,
+ * extract/primitive/lines_v_pattern.hh,
+ * extract/primitive/lines_v_single.hh,
+ * extract/primitive/lines_v_thick.hh,
+ * extract/primitive/objects.hh,
+ * text/grouping/group_from_double_link.hh,
+ * text/grouping/group_from_graph.hh,
+ * text/grouping/group_from_single_link.hh,
+ * text/grouping/group_with_graph.hh,
+ * text/grouping/group_with_rag.hh,
+ * text/grouping/group_with_several_graphes.hh,
+ * text/grouping/group_with_several_left_links.hh,
+ * text/grouping/group_with_several_right_links.hh,
+ * text/grouping/group_with_single_left_link.hh,
+ * text/grouping/group_with_single_right_link.hh,
+ * text/grouping/internal/find_graph_link.hh,
+ * text/grouping/internal/find_root.hh,
+ * text/grouping/internal/have_link_valid.hh,
+ * text/grouping/internal/init_link_array.hh,
+ * text/grouping/internal/init_link_array.hh,
+ * text/grouping/internal/is_link_valid.hh,
+ * text/grouping/internal/update_link_array.hh: Move...
+
+ * primitive/extract/canvas.hh,
+ * primitive/extract/cells.hh,
+ * primitive/extract/lines_discontinued.hh,
+ * primitive/extract/lines_h_discontinued.hh,
+ * primitive/extract/lines_h_pattern.hh,
+ * primitive/extract/lines_h_single.hh,
+ * primitive/extract/lines_h_thick.hh,
+ * primitive/extract/lines_pattern.hh,
+ * primitive/extract/lines_thick.hh,
+ * primitive/extract/lines_v_discontinued.hh,
+ * primitive/extract/lines_v_pattern.hh,
+ * primitive/extract/lines_v_single.hh,
+ * primitive/extract/lines_v_thick.hh,
+ * primitive/extract/objects.hh,
+ * primitive/group/from_double_link.hh,
+ * primitive/group/from_graph.hh,
+ * primitive/group/from_single_link.hh,
+ * primitive/internal/find_graph_link.hh,
+ * primitive/internal/find_root.hh,
+ * primitive/internal/have_link_valid.hh,
+ * primitive/internal/init_link_array.hh,
+ * primitive/internal/is_link_valid.hh,
+ * primitive/internal/update_graph_link.hh,
+ * primitive/link/with_graph.hh,
+ * primitive/link/with_rag.hh,
+ * primitive/link/with_several_graphes.hh,
+ * primitive/link/with_several_left_links.hh,
+ * primitive/link/with_several_right_links.hh,
+ * primitive/link/with_single_left_link.hh,
+ * primitive/link/with_single_right_link.hh: ... here.
+
+ * text/all.hh,
+ * all.hh: Update includes.
+
+ * draw/bounding_box_links.hh
+ * filter/large_objects.hh
+ * filter/small_object_groups.hh
+ * filter/thick_objects.hh
+ * filter/thin_objects.hh
+ * src/extract/primitive/extract_discontinued_hlines.cc
+ * src/extract/primitive/extract_discontinued_lines.cc
+ * src/extract/primitive/extract_discontinued_vlines.cc
+ * src/extract/primitive/extract_thick_hlines.cc
+ * src/extract/primitive/extract_thick_vlines.cc
+ * src/extract/primitive/find_discontinued_lines.cc
+ * src/extract/primitive/find_single_lines.cc
+ * src/extract/primitive/find_thick_lines.cc
+ * src/filter/large_objects.cc
+ * src/filter/small_objects.cc
+ * src/filter/thick_objects.cc
+ * src/filter/thin_objects.cc
+ * src/recognition.cc
+ * src/table/erase.cc
+ * src/table_rebuild_opening.cc
+ * src/table_rebuild_rank.cc
+ * src/text/grouping/group_from_double_link.cc
+ * src/text/grouping/group_from_double_several_links.cc
+ * src/text/grouping/group_from_graph.cc
+ * src/text/grouping/group_from_rag.cc
+ * src/text/grouping/group_from_several_graph.cc
+ * src/text/grouping/group_from_several_left_links.cc
+ * src/text/grouping/group_from_single_link.cc
+ * src/text_in_photo.cc
+ * table/extract.hh
+ * table/internal/repair_lines.hh
+ * tests/filter/small_and_large_bboxes.cc
+ * tests/table/extract_lines_with_rank.cc
+ * text/extract_lines.hh: Update function calls and includes.
+
+ * filter/small_objects.hh: Update function calls and includes, and
+ use a functor.
+
+ * fun/v2b/small_objects_filter.hh: New filter functor.
+
+ * tests/unit_test/unit-tests.mk,
+ * headers.mk: Regen.
+
+ * make/influence_zone_graph.hh: Fix wrong namespace.
+
+ * primitive/group/apply.hh: New routine.
+
+ * primitive/link/all.hh,
+ * primitive/group/all.hh: New.
+
+
+ * text/grouping/internal/all.hh,
+ * text/grouping/internal/find_left_link.hh,
+ * text/grouping/internal/find_right_link.hh,
+ * text/grouping/internal/init_link_array.hh,
+ * text/grouping/internal/update_graph_link.hh: Move...
+
+ * primitive/internal/all.hh,
+ * primitive/internal/find_left_link.hh,
+ * primitive/internal/find_right_link.hh,
+ * primitive/internal/init_link_array.hh,
+ * primitive/internal/update_graph_link.hh: ... here.
+
+ * primitive/link/merge_double_link.hh: New routine.
+
+2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Set specific cxxflags for tests in Scribo.
* scribo.mk: Set optimization flags in AM_CXXFLAGS.
diff --git a/scribo/all.hh b/scribo/all.hh
index 8fadbb2..4debad0 100644
--- a/scribo/all.hh
+++ b/scribo/all.hh
@@ -43,6 +43,7 @@ namespace scribo
# include <scribo/filter/all.hh>
# include <scribo/make/all.hh>
# include <scribo/preprocessing/all.hh>
+# include <scribo/primitive/all.hh>
# include <scribo/table/all.hh>
# include <scribo/text/all.hh>
# include <scribo/util/all.hh>
diff --git a/scribo/draw/bounding_box_links.hh b/scribo/draw/bounding_box_links.hh
index 908da17..15e7260 100644
--- a/scribo/draw/bounding_box_links.hh
+++ b/scribo/draw/bounding_box_links.hh
@@ -36,7 +36,7 @@
# include <mln/canvas/browsing/depth_first_search.hh>
# include <scribo/core/macros.hh>
-# include <scribo/text/grouping/internal/is_link_valid.hh>
+# include <scribo/primitive/internal/is_link_valid.hh>
namespace scribo
{
@@ -228,7 +228,7 @@ namespace scribo
std::vector<bool> deja_vu;
};
- } // end of namespace scribo::text::grouping::internal
+ } // end of namespace scribo::draw::internal
template <typename I>
@@ -322,9 +322,9 @@ namespace scribo
right_link_value);
mln::util::couple<bool, unsigned>
- nbh = text::grouping::internal::is_link_valid(left_link,
- right_link,
- i);
+ nbh = primitive::internal::is_link_valid(left_link,
+ right_link,
+ i);
if (nbh.first())
mln::draw::line(input,
@@ -372,9 +372,9 @@ namespace scribo
right_link_value);
mln::util::couple<bool, unsigned>
- nbh = text::grouping::internal::is_link_valid(left_link,
- right_link,
- i);
+ nbh = primitive::internal::is_link_valid(left_link,
+ right_link,
+ i);
if (nbh.first())
mln::draw::line(input,
diff --git a/scribo/filter/large_objects.hh b/scribo/filter/large_objects.hh
index e7e4f25..4494965 100644
--- a/scribo/filter/large_objects.hh
+++ b/scribo/filter/large_objects.hh
@@ -43,7 +43,7 @@
# include <mln/pw/all.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/primitive/extract/objects.hh>
namespace scribo
{
@@ -154,7 +154,7 @@ namespace scribo
V nlabels;
typedef object_image(mln_ch_value(I,V)) lbl_t;
- lbl_t lbl = extract::primitive::objects(input, nbh, nlabels);
+ lbl_t lbl = primitive::extract::objects(input, nbh, nlabels);
typedef internal::large_objects_filter<lbl_t> func_t;
func_t fv2b(lbl, max_size);
diff --git a/scribo/filter/small_object_groups.hh b/scribo/filter/small_object_groups.hh
index 7f10e1d..5fa5ee3 100644
--- a/scribo/filter/small_object_groups.hh
+++ b/scribo/filter/small_object_groups.hh
@@ -33,6 +33,8 @@
# include <mln/util/array.hh>
+# include <scribo/core/object_groups.hh>
+
namespace scribo
{
@@ -45,24 +47,26 @@ namespace scribo
/*! \brief Remove objects within a group with less than \p n
links.
- \param[in] parent_link Information about object links.
+ \param[in] groups Information about object groups.
\param[in] n_links The minimum number of links per group.
\return A function mapping an object id to a bool. It is set to
true if an object is part of a group with more than \p n_links
links.
*/
+ template <typename L>
mln::util::array<bool>
- small_object_groups(const mln::util::array<unsigned>& parent_link,
+ small_object_groups(const object_groups<L>& groups,
unsigned n_links);
# ifndef MLN_INCLUDE_ONLY
+ template <typename L>
inline
mln::util::array<bool>
- small_object_groups(const mln::util::array<unsigned>& parent_link,
+ small_object_groups(const object_groups<L>& parent_link,
unsigned n_links)
{
// Counting the number of objects per group.
diff --git a/scribo/filter/small_objects.hh b/scribo/filter/small_objects.hh
index 006827a..d6d7113 100644
--- a/scribo/filter/small_objects.hh
+++ b/scribo/filter/small_objects.hh
@@ -48,8 +48,10 @@
# include <mln/set/compute.hh>
+
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/fun/v2b/small_objects_filter.hh>
+# include <scribo/primitive/extract/objects.hh>
namespace scribo
@@ -93,57 +95,6 @@ namespace scribo
# ifndef MLN_INCLUDE_ONLY
- namespace internal
- {
-
-
- /// Filter Functor.
- /// Return false for all objects which are too small.
- template <typename L>
- struct small_objects_filter
- : Function_v2b< small_objects_filter<L> >
- {
- typedef accu::math::count<mln_psite(L)> card_t;
-
- /// Constructor
- ///
- /// \param[in] objects Component bounding boxes.
- /// \param[in] min_size Minimum component size.
- //
- small_objects_filter(const object_image(L)& objects,
- unsigned min_size)
- {
- card_ = labeling::compute(card_t(), objects, objects.nlabels());
- min_size_ = min_size;
- }
-
-
- /// Check if the component is large enough.
- ///
- /// \param l A label.
- ///
- /// \return false if the component area is strictly inferion to
- /// \p min_size_.
- //
- bool operator()(const mln_value(L)& l) const
- {
- if (l == literal::zero)
- return true;
- return card_[l] >= min_size_;
- }
-
- /// The component bounding boxes.
- mln::util::array<mln_result(card_t)> card_;
-
- /// The minimum area.
- unsigned min_size_;
- };
-
-
- } // end of namespace scribo::filter::internal
-
-
-
template <typename I, typename N, typename V>
inline
mln_concrete(I)
@@ -162,9 +113,9 @@ namespace scribo
V nlabels;
typedef mln_ch_value(I,V) lbl_t;
- object_image(lbl_t) lbl = extract::primitive::objects(input, nbh, nlabels);
+ object_image(lbl_t) lbl = primitive::extract::objects(input, nbh, nlabels);
- typedef internal::small_objects_filter<mln_ch_value(I,V)> func_t;
+ typedef fun::v2b::small_objects_filter<mln_ch_value(I,V)> func_t;
func_t fv2b(lbl, min_size);
lbl.relabel(fv2b);
@@ -187,7 +138,7 @@ namespace scribo
mln_precondition(objects.is_valid());
- internal::small_objects_filter<L> f(objects, min_size);
+ fun::v2b::small_objects_filter<L> f(objects, min_size);
object_image(L) output;
output.init_from_(objects);
diff --git a/scribo/filter/thick_objects.hh b/scribo/filter/thick_objects.hh
index 15b4c78..2cb1f30 100644
--- a/scribo/filter/thick_objects.hh
+++ b/scribo/filter/thick_objects.hh
@@ -36,7 +36,7 @@
# include <mln/util/array.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/primitive/extract/objects.hh>
@@ -146,7 +146,7 @@ namespace scribo
V nlabels;
typedef mln_ch_value(I,V) lbl_t;
object_image(lbl_t) objects
- = extract::primitive::objects(input, nbh, nlabels);
+ = primitive::extract::objects(input, nbh, nlabels);
typedef internal::thick_object_filter<lbl_t> func_t;
func_t fv2b(objects, max_thickness);
diff --git a/scribo/filter/thin_objects.hh b/scribo/filter/thin_objects.hh
index 867be28..2149a38 100644
--- a/scribo/filter/thin_objects.hh
+++ b/scribo/filter/thin_objects.hh
@@ -36,7 +36,7 @@
# include <mln/util/array.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/primitive/extract/objects.hh>
namespace scribo
{
@@ -144,7 +144,7 @@ namespace scribo
V nlabels;
typedef mln_ch_value(I,V) lbl_t;
object_image(lbl_t) objects
- = extract::primitive::objects(input, nbh, nlabels);
+ = primitive::extract::objects(input, nbh, nlabels);
typedef internal::thin_objects_filter<lbl_t> func_t;
func_t fv2b(objects, min_thickness);
diff --git a/scribo/fun/v2b/small_objects_filter.hh b/scribo/fun/v2b/small_objects_filter.hh
new file mode 100644
index 0000000..477bd47
--- /dev/null
+++ b/scribo/fun/v2b/small_objects_filter.hh
@@ -0,0 +1,129 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_FUN_V2B_SMALL_OBJECTS_FILTER_HH
+# define SCRIBO_FUN_V2B_SMALL_OBJECTS_FILTER_HH
+
+/// \file
+///
+/// Remove small objects in a binary image.
+
+
+
+# include <mln/core/concept/function.hh>
+
+# include <mln/util/array.hh>
+
+# include <mln/accu/math/count.hh>
+
+# include <mln/labeling/compute.hh>
+
+# include <scribo/core/object_image.hh>
+
+
+namespace scribo
+{
+
+ namespace fun
+ {
+
+ namespace v2b
+ {
+
+ using namespace mln;
+
+
+ /// Filter Functor.
+ /// Return false for all objects which are too small.
+ template <typename L>
+ struct small_objects_filter
+ : Function_v2b< small_objects_filter<L> >
+ {
+ typedef accu::math::count<mln_psite(L)> card_t;
+
+ /// Constructor
+ ///
+ /// \param[in] objects Component bounding boxes.
+ /// \param[in] min_size Minimum component size.
+ //
+ small_objects_filter(const object_image(L)& objects,
+ unsigned min_size);
+
+
+ /// Check if the component is large enough.
+ ///
+ /// \param l A label.
+ ///
+ /// \return false if the component area is strictly inferion to
+ /// \p min_size_.
+ //
+ bool operator()(const mln_value(L)& l) const;
+
+ /// The component bounding boxes.
+ mln::util::array<mln_result(card_t)> card_;
+
+ /// The minimum area.
+ unsigned min_size_;
+ };
+
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ inline
+ small_objects_filter<L>::small_objects_filter(
+ const object_image(L)& objects,
+ unsigned min_size)
+ {
+ card_ = labeling::compute(card_t(), objects, objects.nlabels());
+ min_size_ = min_size;
+ }
+
+
+
+ template <typename L>
+ inline
+ bool
+ small_objects_filter<L>::operator()(const mln_value(L)& l) const
+ {
+ if (l == literal::zero)
+ return true;
+ return card_[l] >= min_size_;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace scribo::fun::v2b
+
+ } // end of namespace scribo::fun
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_FILTER_SMALL_OBJECTS_HH
diff --git a/scribo/headers.mk b/scribo/headers.mk
index 0aa7b35..c266c78 100644
--- a/scribo/headers.mk
+++ b/scribo/headers.mk
@@ -7,7 +7,9 @@ nobase_scribo_HEADERS = \
./core/central_sites.hh \
./core/erase_objects.hh \
./core/macros.hh \
+./core/object_groups.hh \
./core/object_image.hh \
+./core/object_links.hh \
./debug/all.hh \
./debug/save_bboxes_image.hh \
./debug/save_label_image.hh \
@@ -18,18 +20,6 @@ nobase_scribo_HEADERS = \
./draw/all.hh \
./draw/bounding_box_links.hh \
./draw/bounding_boxes.hh \
-./extract/primitive/canvas.hh \
-./extract/primitive/cells.hh \
-./extract/primitive/lines_discontinued.hh \
-./extract/primitive/lines_h_discontinued.hh \
-./extract/primitive/lines_h_pattern.hh \
-./extract/primitive/lines_h_thick.hh \
-./extract/primitive/lines_pattern.hh \
-./extract/primitive/lines_thick.hh \
-./extract/primitive/lines_v_discontinued.hh \
-./extract/primitive/lines_v_pattern.hh \
-./extract/primitive/lines_v_thick.hh \
-./extract/primitive/objects.hh \
./filter/all.hh \
./filter/large_objects.hh \
./filter/small_object_groups.hh \
@@ -43,6 +33,49 @@ nobase_scribo_HEADERS = \
./make/text.hh \
./preprocessing/all.hh \
./preprocessing/unskew.hh \
+./primitive/all.hh \
+./primitive/extract/all.hh \
+./primitive/extract/canvas.hh \
+./primitive/extract/cells.hh \
+./primitive/extract/lines_discontinued.hh \
+./primitive/extract/lines_h_discontinued.hh \
+./primitive/extract/lines_h_pattern.hh \
+./primitive/extract/lines_h_single.hh \
+./primitive/extract/lines_h_thick.hh \
+./primitive/extract/lines_pattern.hh \
+./primitive/extract/lines_thick.hh \
+./primitive/extract/lines_v_discontinued.hh \
+./primitive/extract/lines_v_pattern.hh \
+./primitive/extract/lines_v_single.hh \
+./primitive/extract/lines_v_thick.hh \
+./primitive/extract/objects.hh \
+./primitive/group/all.hh \
+./primitive/group/apply.hh \
+./primitive/group/filter_non_aligned.hh \
+./primitive/group/filter_non_h_aligned.hh \
+./primitive/group/filter_non_v_aligned.hh \
+./primitive/group/from_double_link.hh \
+./primitive/group/from_graph.hh \
+./primitive/group/from_single_link.hh \
+./primitive/internal/all.hh \
+./primitive/internal/find_graph_link.hh \
+./primitive/internal/find_left_link.hh \
+./primitive/internal/find_right_link.hh \
+./primitive/internal/find_root.hh \
+./primitive/internal/have_link_valid.hh \
+./primitive/internal/init_link_array.hh \
+./primitive/internal/is_link_valid.hh \
+./primitive/internal/update_graph_link.hh \
+./primitive/internal/update_link_array.hh \
+./primitive/link/all.hh \
+./primitive/link/merge_double_link.hh \
+./primitive/link/with_graph.hh \
+./primitive/link/with_rag.hh \
+./primitive/link/with_several_graphes.hh \
+./primitive/link/with_several_left_links.hh \
+./primitive/link/with_several_right_links.hh \
+./primitive/link/with_single_left_link.hh \
+./primitive/link/with_single_right_link.hh \
./table/align_lines_horizontaly.hh \
./table/align_lines_verticaly.hh \
./table/all.hh \
@@ -60,27 +93,6 @@ nobase_scribo_HEADERS = \
./text/all.hh \
./text/clean.hh \
./text/extract_lines.hh \
-./text/grouping/all.hh \
-./text/grouping/group_from_double_link.hh \
-./text/grouping/group_from_graph.hh \
-./text/grouping/group_from_single_link.hh \
-./text/grouping/group_with_graph.hh \
-./text/grouping/group_with_rag.hh \
-./text/grouping/group_with_several_graphes.hh \
-./text/grouping/group_with_several_left_links.hh \
-./text/grouping/group_with_several_right_links.hh \
-./text/grouping/group_with_single_left_link.hh \
-./text/grouping/group_with_single_right_link.hh \
-./text/grouping/internal/all.hh \
-./text/grouping/internal/find_graph_link.hh \
-./text/grouping/internal/find_left_link.hh \
-./text/grouping/internal/find_right_link.hh \
-./text/grouping/internal/find_root.hh \
-./text/grouping/internal/have_link_valid.hh \
-./text/grouping/internal/init_link_array.hh \
-./text/grouping/internal/is_link_valid.hh \
-./text/grouping/internal/update_graph_link.hh \
-./text/grouping/internal/update_link_array.hh \
./text/recognition.hh \
./util/all.hh \
./util/text.hh
diff --git a/scribo/make/influence_zone_graph.hh b/scribo/make/influence_zone_graph.hh
index ca0d6fb..c01fba1 100644
--- a/scribo/make/influence_zone_graph.hh
+++ b/scribo/make/influence_zone_graph.hh
@@ -48,72 +48,66 @@
namespace scribo
{
- namespace text
+ namespace make
{
-
- namespace grouping
- {
-
- using namespace mln;
-
-
- /// Compute a labeled image of input, then compute an influence
- /// zone image and make a graph from it.
- ///
- /// \param[in] input_ a binary image.
- /// \param[in] nbh_ a neighbordhood.
- /// \param[in] label_type The type of this argument is used
- /// as label type while labeling the image.
- /// \param[in] iz_dmax Max distance of the influence zone.
- ///
- /// \return a region adjacency graph.
- template <typename I, typename N, typename V>
- util::graph
- influence_zone_graph(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned iz_dmax);
+ using namespace mln;
+
+
+ /// Compute a labeled image of input, then compute an influence
+ /// zone image and make a graph from it.
+ ///
+ /// \param[in] input_ a binary image.
+ /// \param[in] nbh_ a neighbordhood.
+ /// \param[in] label_type The type of this argument is used
+ /// as label type while labeling the image.
+ /// \param[in] iz_dmax Max distance of the influence zone.
+ ///
+ /// \return a region adjacency graph.
+ template <typename I, typename N, typename V>
+ util::graph
+ influence_zone_graph(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned iz_dmax);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename V>
- util::graph
- influence_zone_graph(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned iz_dmax)
- {
- trace::entering("scribo::make::influence_zone_graph");
+ template <typename I, typename N, typename V>
+ util::graph
+ influence_zone_graph(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned iz_dmax)
+ {
+ trace::entering("scribo::make::influence_zone_graph");
- (void) label_type;
- I& input = exact(input_);
- const N& nbh = exact(nbh_);
+ (void) label_type;
+ I& input = exact(input_);
+ const N& nbh = exact(nbh_);
- mlc_equal(mln_value(I), bool)::check();
- mln_assertion(input.is_valid());
- mln_assertion(nbh.is_valid());
+ mlc_equal(mln_value(I), bool)::check();
+ mln_assertion(input.is_valid());
+ mln_assertion(nbh.is_valid());
- V nlabels;
- typedef mln_ch_value(I,V) lbl_t;
- lbl_t lbl = labeling::blobs(input, nbh, nlabels);
+ V nlabels;
+ typedef mln_ch_value(I,V) lbl_t;
+ lbl_t lbl = labeling::blobs(input, nbh, nlabels);
- lbl_t iz = transform::influence_zone_geodesic(lbl, nbh, iz_dmax);
+ lbl_t iz = transform::influence_zone_geodesic(lbl, nbh, iz_dmax);
- util::graph g
- = mln::make::influence_zone_adjacency_graph(
- iz | (pw::value(iz) != pw::cst(literal::zero)),
- nbh, nlabels);
+ util::graph g
+ = mln::make::influence_zone_adjacency_graph(
+ iz | (pw::value(iz) != pw::cst(literal::zero)),
+ nbh, nlabels);
- trace::exiting("scribo::make::influence_zone_graph");
- return g;
- }
+ trace::exiting("scribo::make::influence_zone_graph");
+ return g;
+ }
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
-
- } // end of namespace scribo::text
+ } // end of namespace scribo::make
} // end of namespace scribo
diff --git a/scribo/all.hh b/scribo/primitive/all.hh
similarity index 76%
copy from scribo/all.hh
copy to scribo/primitive/all.hh
index 8fadbb2..3eb72d7 100644
--- a/scribo/all.hh
+++ b/scribo/primitive/all.hh
@@ -23,28 +23,29 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_ALL_HH
-# define SCRIBO_ALL_HH
+#ifndef SCRIBO_PRIMITIVE_ALL_HH
+# define SCRIBO_PRIMITIVE_ALL_HH
/// \file
///
-/// Include all headers located in scribo/.
+/// Include all headers located in scribo/primitive.
/// Namespace of the whole project.
namespace scribo
{
+ /// Namespace of primitive related routines.
+ namespace primitive
+ {
+ }
+
} // end of namespace scribo
-# include <scribo/core/all.hh>
-# include <scribo/debug/all.hh>
-# include <scribo/draw/all.hh>
-# include <scribo/filter/all.hh>
-# include <scribo/make/all.hh>
-# include <scribo/preprocessing/all.hh>
-# include <scribo/table/all.hh>
-# include <scribo/text/all.hh>
-# include <scribo/util/all.hh>
-
-#endif // ! SCRIBO_ALL_HH
+
+# include <scribo/primitive/extract/all.hh>
+# include <scribo/primitive/group/all.hh>
+# include <scribo/primitive/internal/all.hh>
+# include <scribo/primitive/link/all.hh>
+
+#endif // ! SCRIBO_PRIMITIVE_ALL_HH
diff --git a/scribo/text/grouping/all.hh b/scribo/primitive/extract/all.hh
similarity index 52%
rename from scribo/text/grouping/all.hh
rename to scribo/primitive/extract/all.hh
index a4a664c..de1688e 100644
--- a/scribo/text/grouping/all.hh
+++ b/scribo/primitive/extract/all.hh
@@ -23,40 +23,45 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_ALL_HH
-# define SCRIBO_TEXT_GROUPING_ALL_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_ALL_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_ALL_HH
/// \file
///
-/// Include all headers located in scribo/text/grouping.
+/// Include all headers located in scribo/primitive.
+
+/// Namespace of the whole project.
namespace scribo
{
- namespace text
+ namespace primitive
{
- /// Namespace of routines grouping text components.
- namespace grouping
+ /// Namespace of primitive extraction related routines.
+ namespace extract
{
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
+# include <scribo/primitive/extract/lines_pattern.hh>
+# include <scribo/primitive/extract/canvas.hh>
+# include <scribo/primitive/extract/lines_h_thick.hh>
+# include <scribo/primitive/extract/lines_h_single.hh>
+# include <scribo/primitive/extract/lines_v_single.hh>
+# include <scribo/primitive/extract/lines_discontinued.hh>
+# include <scribo/primitive/extract/all.hh>
+# include <scribo/primitive/extract/lines_v_thick.hh>
+# include <scribo/primitive/extract/lines_v_discontinued.hh>
+# include <scribo/primitive/extract/lines_h_pattern.hh>
+# include <scribo/primitive/extract/objects.hh>
+# include <scribo/primitive/extract/cells.hh>
+# include <scribo/primitive/extract/lines_thick.hh>
+# include <scribo/primitive/extract/lines_h_discontinued.hh>
+# include <scribo/primitive/extract/lines_v_pattern.hh>
-# include <scribo/text/grouping/internal/all.hh>
-# include <scribo/text/grouping/group_with_several_graphes.hh>
-# include <scribo/text/grouping/group_from_double_link.hh>
-# include <scribo/text/grouping/group_with_several_right_links.hh>
-# include <scribo/text/grouping/group_with_graph.hh>
-# include <scribo/text/grouping/group_with_single_left_link.hh>
-# include <scribo/text/grouping/group_with_several_left_links.hh>
-# include <scribo/text/grouping/group_from_graph.hh>
-# include <scribo/text/grouping/group_from_single_link.hh>
-# include <scribo/text/grouping/group_with_single_right_link.hh>
-
-
-#endif // ! SCRIBO_TEXT_GROUPING_ALL_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_ALL_HH
diff --git a/scribo/extract/primitive/canvas.hh b/scribo/primitive/extract/canvas.hh
similarity index 81%
rename from scribo/extract/primitive/canvas.hh
rename to scribo/primitive/extract/canvas.hh
index dbd1de4..a2e9b4a 100644
--- a/scribo/extract/primitive/canvas.hh
+++ b/scribo/primitive/extract/canvas.hh
@@ -23,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_EXTRACT_PRIMITIVE_CANVAS_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_CANVAS_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_CANVAS_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_CANVAS_HH
/// \file
///
@@ -51,12 +51,12 @@
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
-
+ using namespace mln;
/// Rebuild a table from its line bounding boxes.
/*!
@@ -72,8 +72,8 @@ namespace scribo
template <typename I, typename V>
mln_ch_value(I,bool)
canvas(const Image<I>& input_,
- const util::array<box<mln_site(I)> >& hlines_,
- const util::array<box<mln_site(I)> >& vlines_,
+ const mln::util::array<box<mln_site(I)> >& hlines_,
+ const mln::util::array<box<mln_site(I)> >& vlines_,
unsigned max_dist_lines);
@@ -83,8 +83,8 @@ namespace scribo
template <typename I, typename V>
mln_ch_value(I,bool)
canvas(const Image<I>& input_,
- const util::array<box<mln_site(I)> >& hlines,
- const util::array<box<mln_site(I)> >& vlines,
+ const mln::util::array<box<mln_site(I)> >& hlines,
+ const mln::util::array<box<mln_site(I)> >& vlines,
unsigned max_dist_lines)
{
trace::entering("scribo::primitive::canvas");
@@ -93,11 +93,12 @@ namespace scribo
mlc_equal(mln_value(I), bool)::check();
mln_precondition(input.is_valid());
- typedef util::array<box<mln_site(I)> > lines_t;
- util::couple<lines_t, lines_t> lines = mln::make::couple(hlines, vlines);
+ typedef mln::util::array<box<mln_site(I)> > lines_t;
+ mln::util::couple<lines_t, lines_t>
+ lines = mln::make::couple(hlines, vlines);
- util::array<int> rows = align_lines_horizontaly(input, hlines, 5);
- util::array<int> cols = align_lines_verticaly(input, vlines, 5);
+ mln::util::array<int> rows = align_lines_horizontaly(input, hlines, 5);
+ mln::util::array<int> cols = align_lines_verticaly(input, vlines, 5);
repair_vertical_lines(input, lines, 30);
repair_horizontal_lines(input, lines, 30);
@@ -121,10 +122,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_CANVAS_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_CANVAS_HH
diff --git a/scribo/extract/primitive/cells.hh b/scribo/primitive/extract/cells.hh
similarity index 88%
rename from scribo/extract/primitive/cells.hh
rename to scribo/primitive/extract/cells.hh
index 44690e7..08b3fd6 100644
--- a/scribo/extract/primitive/cells.hh
+++ b/scribo/primitive/extract/cells.hh
@@ -23,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_EXTRACT_PRIMITIVE_CELLS_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_CELLS_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_CELLS_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_CELLS_HH
/// \file
///
@@ -44,7 +44,7 @@
# include <scribo/table/rebuild.hh>
# include <scribo/table/erase.hh>
-# include <scribo/extract/primitive/lines_discontinued.hh>
+# include <scribo/primitive/extract/lines_discontinued.hh>
# include <scribo/make/debug_filename.hh>
@@ -52,10 +52,10 @@
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -98,9 +98,9 @@ namespace scribo
win::line<mln_grid(I::site), 0, mln_coord(I::site)> vline(51);
win::line<mln_grid(I::site), 1, mln_coord(I::site)> hline(51);
boxarray_t
- vlines = extract::primitive::lines_discontinued(input, nbh,
+ vlines = primitive::extract::lines_discontinued(input, nbh,
ncells, vline, 6),
- hlines = extract::primitive::lines_discontinued(input, nbh,
+ hlines = primitive::extract::lines_discontinued(input, nbh,
ncells, hline, 6);
typedef mln_ch_value(I,V) cells_ima_t;
@@ -117,10 +117,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_CELLS_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_CELLS_HH
diff --git a/scribo/extract/primitive/lines_discontinued.hh b/scribo/primitive/extract/lines_discontinued.hh
similarity index 87%
rename from scribo/extract/primitive/lines_discontinued.hh
rename to scribo/primitive/extract/lines_discontinued.hh
index 97d08f8..8ced7e3 100644
--- a/scribo/extract/primitive/lines_discontinued.hh
+++ b/scribo/primitive/extract/lines_discontinued.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_DISCONTINUED_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_DISCONTINUED_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_DISCONTINUED_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_DISCONTINUED_HH
/// \file
///
@@ -42,15 +42,15 @@
# include <scribo/core/macros.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/primitive/extract/objects.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -113,7 +113,7 @@ namespace scribo
const Neighborhood<N>& nbh_, V& nlines,
const Window<W>& win_, unsigned rank_k)
{
- trace::entering("scribo::primitive::lines_discontinued");
+ trace::entering("scribo::primitive::extract::lines_discontinued");
internal::lines_discontinued_tests(input_, nbh_, nlines, win_, rank_k);
@@ -130,9 +130,9 @@ namespace scribo
mln_ch_value(I,bool) filter
= morpho::dilation(morpho::rank_filter(input, win, rank_k), W(dil));
object_image(mln_ch_value(I,V)) output
- = extract::primitive::objects(filter, nbh, nlines);
+ = primitive::extract::objects(filter, nbh, nlines);
- trace::exiting("scribo::primitive::lines_discontinued");
+ trace::exiting("scribo::primitive::extract::lines_discontinued");
return output;
}
@@ -140,10 +140,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_DISCONTINUED_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_DISCONTINUED_HH
diff --git a/scribo/extract/primitive/lines_h_discontinued.hh b/scribo/primitive/extract/lines_h_discontinued.hh
similarity index 90%
rename from scribo/extract/primitive/lines_h_discontinued.hh
rename to scribo/primitive/extract/lines_h_discontinued.hh
index ce62fde..48ba12a 100644
--- a/scribo/extract/primitive/lines_h_discontinued.hh
+++ b/scribo/primitive/extract/lines_h_discontinued.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_H_DISCONTINUED_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_H_DISCONTINUED_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_H_DISCONTINUED_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_H_DISCONTINUED_HH
/// \file
///
@@ -35,17 +35,17 @@
# include <mln/win/hline2d.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/lines_discontinued.hh>
+# include <scribo/primitive/extract/lines_discontinued.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -124,10 +124,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_H_DISCONTINUED_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_H_DISCONTINUED_HH
diff --git a/scribo/extract/primitive/lines_h_pattern.hh b/scribo/primitive/extract/lines_h_pattern.hh
similarity index 87%
rename from scribo/extract/primitive/lines_h_pattern.hh
rename to scribo/primitive/extract/lines_h_pattern.hh
index 2aa531e..7716ac5 100644
--- a/scribo/extract/primitive/lines_h_pattern.hh
+++ b/scribo/primitive/extract/lines_h_pattern.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_H_PATTERN_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_H_PATTERN_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_H_PATTERN_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_H_PATTERN_HH
/// \file
///
@@ -37,16 +37,17 @@
# include <mln/morpho/dilation.hh>
-# include <scribo/extract/primitive/lines_pattern.hh>
+# include <scribo/primitive/extract/lines_pattern.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
+
using namespace mln;
/// Extract horizontal lines matching a specific pattern.
@@ -90,12 +91,12 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::impl::generic
+ } // end of namespace scribo::primitive::extract
- } // end of namespace mln::impl
+ } // end of namespace scribo::primitive
-} // end of namespace mln
+} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_H_PATTERN_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_H_PATTERN_HH
diff --git a/scribo/extract/primitive/lines_h_single.hh b/scribo/primitive/extract/lines_h_single.hh
similarity index 94%
rename from scribo/extract/primitive/lines_h_single.hh
rename to scribo/primitive/extract/lines_h_single.hh
index 9146483..9b6d7c4 100644
--- a/scribo/extract/primitive/lines_h_single.hh
+++ b/scribo/primitive/extract/lines_h_single.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_H_SINGLE_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_H_SINGLE_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_H_SINGLE_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_H_SINGLE_HH
/// \file
///
@@ -40,10 +40,10 @@
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
@@ -194,10 +194,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_H_SINGLE_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_H_SINGLE_HH
diff --git a/scribo/extract/primitive/lines_h_thick.hh b/scribo/primitive/extract/lines_h_thick.hh
similarity index 90%
rename from scribo/extract/primitive/lines_h_thick.hh
rename to scribo/primitive/extract/lines_h_thick.hh
index cfbf1cc..817f47d 100644
--- a/scribo/extract/primitive/lines_h_thick.hh
+++ b/scribo/primitive/extract/lines_h_thick.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_H_THICK_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_H_THICK_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_H_THICK_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_H_THICK_HH
/// \file
///
@@ -35,15 +35,15 @@
# include <mln/win/hline2d.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/lines_thick.hh>
+# include <scribo/primitive/extract/lines_thick.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -120,10 +120,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_H_THICK_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_H_THICK_HH
diff --git a/scribo/extract/primitive/lines_pattern.hh b/scribo/primitive/extract/lines_pattern.hh
similarity index 90%
rename from scribo/extract/primitive/lines_pattern.hh
rename to scribo/primitive/extract/lines_pattern.hh
index 45bc487..cd2b558 100644
--- a/scribo/extract/primitive/lines_pattern.hh
+++ b/scribo/primitive/extract/lines_pattern.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_PATTERN_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_PATTERN_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_PATTERN_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_PATTERN_HH
/// \file
///
@@ -43,10 +43,10 @@
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -112,11 +112,11 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::impl::generic
+ } // end of namespace scribo::primitive::extract
- } // end of namespace mln::impl
+ } // end of namespace scribo::primitive
-} // end of namespace mln
+} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_PATTERN_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_PATTERN_HH
diff --git a/scribo/extract/primitive/lines_thick.hh b/scribo/primitive/extract/lines_thick.hh
similarity index 86%
rename from scribo/extract/primitive/lines_thick.hh
rename to scribo/primitive/extract/lines_thick.hh
index 5d88cc5..f54e9b0 100644
--- a/scribo/extract/primitive/lines_thick.hh
+++ b/scribo/primitive/extract/lines_thick.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_THICK_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_THICK_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_THICK_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_THICK_HH
/// \file
///
@@ -39,15 +39,15 @@
# include <scribo/core/object_image.hh>
# include <scribo/core/macros.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/primitive/extract/objects.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
@@ -81,9 +81,9 @@ namespace scribo
template <typename I, typename N, typename V, typename W>
void
- lines_thick_tests(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_)
+ lines_thick_tests(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
+ const Window<W>& win)
{
mlc_equal(mln_value(I),bool)::check();
mlc_bool(mln_site_(I)::dim == 2)::check();
@@ -117,7 +117,7 @@ namespace scribo
mln_ch_value(I,bool) filter = morpho::opening::structural(input, win);
object_image(mln_ch_value(I,V)) output
- = extract::primitive::objects(filter, nbh, nlines);
+ = primitive::extract::objects(filter, nbh, nlines);
trace::exiting("scribo::primitive::lines_thick");
return output;
@@ -126,10 +126,10 @@ namespace scribo
# endif // !MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_VERTICAL_LINES_THICK_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_VERTICAL_LINES_THICK_HH
diff --git a/scribo/extract/primitive/lines_v_discontinued.hh b/scribo/primitive/extract/lines_v_discontinued.hh
similarity index 90%
rename from scribo/extract/primitive/lines_v_discontinued.hh
rename to scribo/primitive/extract/lines_v_discontinued.hh
index 0755d2b..8463111 100644
--- a/scribo/extract/primitive/lines_v_discontinued.hh
+++ b/scribo/primitive/extract/lines_v_discontinued.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_V_DISCONTINUED_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_V_DISCONTINUED_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_V_DISCONTINUED_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_V_DISCONTINUED_HH
/// \file
///
@@ -34,17 +34,17 @@
# include <mln/core/concept/neighborhood.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/lines_discontinued.hh>
+# include <scribo/primitive/extract/lines_discontinued.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
@@ -118,11 +118,11 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_V_DISCONTINUED_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_V_DISCONTINUED_HH
diff --git a/scribo/extract/primitive/lines_v_pattern.hh b/scribo/primitive/extract/lines_v_pattern.hh
similarity index 86%
rename from scribo/extract/primitive/lines_v_pattern.hh
rename to scribo/primitive/extract/lines_v_pattern.hh
index be920fc..29f4a54 100644
--- a/scribo/extract/primitive/lines_v_pattern.hh
+++ b/scribo/primitive/extract/lines_v_pattern.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_V_PATTERN_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_V_PATTERN_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_V_PATTERN_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_V_PATTERN_HH
/// \file
///
@@ -37,16 +37,17 @@
# include <mln/morpho/dilation.hh>
-# include <scribo/extract/primitive/lines_pattern.hh>
+# include <scribo/primitive/extract/lines_pattern.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
+
using namespace mln;
@@ -85,12 +86,12 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::impl::generic
+ } // end of namespace scribo::primitive::extract
- } // end of namespace mln::impl
+ } // end of namespace scribo::primitive
-} // end of namespace mln
+} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_V_PATTERN_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_V_PATTERN_HH
diff --git a/scribo/extract/primitive/lines_v_single.hh b/scribo/primitive/extract/lines_v_single.hh
similarity index 94%
rename from scribo/extract/primitive/lines_v_single.hh
rename to scribo/primitive/extract/lines_v_single.hh
index ee49eb8..f700dd0 100644
--- a/scribo/extract/primitive/lines_v_single.hh
+++ b/scribo/primitive/extract/lines_v_single.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_V_SINGLE_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_V_SINGLE_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_V_SINGLE_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_V_SINGLE_HH
/// \file
///
@@ -40,10 +40,10 @@
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -190,10 +190,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_V_SINGLE_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_V_SINGLE_HH
diff --git a/scribo/extract/primitive/lines_v_thick.hh b/scribo/primitive/extract/lines_v_thick.hh
similarity index 90%
rename from scribo/extract/primitive/lines_v_thick.hh
rename to scribo/primitive/extract/lines_v_thick.hh
index 19cec92..e1cecee 100644
--- a/scribo/extract/primitive/lines_v_thick.hh
+++ b/scribo/primitive/extract/lines_v_thick.hh
@@ -23,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_EXTRACT_PRIMITIVE_LINES_V_THICK_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_LINES_V_THICK_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_LINES_V_THICK_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_LINES_V_THICK_HH
/// \file
///
@@ -35,15 +35,15 @@
# include <mln/win/vline2d.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/extract/primitive/lines_thick.hh>
+# include <scribo/primitive/extract/lines_thick.hh>
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
@@ -120,10 +120,10 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_V_THICK_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_LINES_V_THICK_HH
diff --git a/scribo/extract/primitive/objects.hh b/scribo/primitive/extract/objects.hh
similarity index 89%
rename from scribo/extract/primitive/objects.hh
rename to scribo/primitive/extract/objects.hh
index a4110e2..2ca2f5d 100644
--- a/scribo/extract/primitive/objects.hh
+++ b/scribo/primitive/extract/objects.hh
@@ -23,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_EXTRACT_PRIMITIVE_OBJECTS_HH
-# define SCRIBO_EXTRACT_PRIMITIVE_OBJECTS_HH
+#ifndef SCRIBO_PRIMITIVE_EXTRACT_OBJECTS_HH
+# define SCRIBO_PRIMITIVE_EXTRACT_OBJECTS_HH
/// \file
///
@@ -52,17 +52,18 @@
namespace scribo
{
- namespace extract
+ namespace primitive
{
- namespace primitive
+ namespace extract
{
using namespace mln;
/// Extract objects in a binary image.
///
- /// \param[in] input A binary image. Objects are must be set to 'true'
+ /// \param[in] input A binary image. Objects are must be set
+ /// to 'true'
/// and background to 'false'.
/// \param[in] nbh A neighborhood to be used for labeling.
/// \param[in,out] nobjects Will store the numbers of objects found.
@@ -98,7 +99,7 @@ namespace scribo
}
- } // end of namespace scribo::extract::primitive::internal
+ } // end of namespace scribo::primitive::extract::internal
template <typename I, typename N, typename V>
@@ -127,11 +128,11 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::extract::primitive
+ } // end of namespace scribo::primitive::extract
- } // end of namespace scribo::extract
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_EXTRACT_PRIMITIVE_OBJECTS_HH
+#endif // ! SCRIBO_PRIMITIVE_EXTRACT_OBJECTS_HH
diff --git a/scribo/text/all.hh b/scribo/primitive/group/all.hh
similarity index 69%
copy from scribo/text/all.hh
copy to scribo/primitive/group/all.hh
index 000d5b9..75f0685 100644
--- a/scribo/text/all.hh
+++ b/scribo/primitive/group/all.hh
@@ -23,27 +23,35 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_ALL_HH
-# define SCRIBO_TEXT_ALL_HH
+#ifndef SCRIBO_PRIMITIVE_GROUP_ALL_HH
+# define SCRIBO_PRIMITIVE_GROUP_ALL_HH
/// \file
///
-/// Include all headers located in scribo/text.
+/// Include all headers located in scribo/primitive/group.
namespace scribo
{
- /// Namespace of routines working on text components.
- namespace text
+ namespace primitive
{
- } // end of namespace scribo::text
+ /// Namespace of primitive grouping related routines.
+ namespace group
+ {
+
+ } // end of namespace scribo::primitive::group
+
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-# include <scribo/text/extract_lines.hh>
-//# include <scribo/text/recognition.hh>
-# include <scribo/text/clean.hh>
-# include <scribo/text/grouping/all.hh>
-#endif // ! SCRIBO_TEXT_ALL_HH
+
+# include <scribo/primitive/group/apply.hh>
+# include <scribo/primitive/group/from_double_link.hh>
+# include <scribo/primitive/group/from_graph.hh>
+# include <scribo/primitive/group/from_single_link.hh>
+
+
+#endif // ! SCRIBO_PRIMITIVE_GROUP_ALL_HH
diff --git a/scribo/primitive/group/apply.hh b/scribo/primitive/group/apply.hh
new file mode 100644
index 0000000..02e75cd
--- /dev/null
+++ b/scribo/primitive/group/apply.hh
@@ -0,0 +1,126 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_PRIMITIVE_GROUP_APPLY_HH
+# define SCRIBO_PRIMITIVE_GROUP_APPLY_HH
+
+/// \file
+///
+/// Apply grouping in an object image.
+
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_groups.hh>
+# include <scribo/core/object_image.hh>
+
+# include <scribo/primitive/group/from_single_link.hh>
+
+namespace scribo
+{
+
+ namespace primitive
+ {
+
+ namespace group
+ {
+
+ using namespace mln;
+
+ /*! \brief Apply grouping in an object image.
+
+ \param objects An object image.
+ \param groups An object group structure.
+
+ \return A copy of \p objects with grouped objects.
+ */
+ template <typename L>
+ object_image(L)
+ apply(const object_image(L)& objects,
+ const object_groups<L>& groups);
+
+ /// \overload
+ template <typename L>
+ object_image(L)
+ apply(const object_image(L)& objects,
+ const object_links<L>& links);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ object_image(L)
+ apply(const object_image(L)& objects,
+ const object_groups<L>& groups)
+
+ {
+ trace::entering("scribo::primitive::group::apply");
+
+ mln_precondition(objects.is_valid());
+ mln_precondition(groups.nelements() == objects.nlabels().next());
+ mln_precondition(groups.nelements() == objects.bboxes().nelements());
+ mln_precondition(groups.objects_id_() == objects.id_());
+
+ object_image(L) output;
+ output.init_from_(objects);
+ output.relabel(groups);
+
+ trace::exiting("scribo::primitive::group::apply");
+ return output;
+ }
+
+
+ template <typename L>
+ object_image(L)
+ apply(const object_image(L)& objects,
+ const object_links<L>& links)
+
+ {
+ trace::entering("scribo::primitive::group::apply");
+
+ mln_precondition(objects.is_valid());
+ mln_precondition(links.nelements() == objects.nlabels().next());
+ mln_precondition(links.nelements() == objects.bboxes().nelements());
+ mln_precondition(links.objects_id_() == objects.id_());
+
+
+ object_groups<L> group = group::from_single_link(objects, links);
+
+ object_image(L) output = apply(objects, links);
+
+ trace::exiting("scribo::primitive::group::apply");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::primitive::group
+
+ } // end of namespace scribo::primitive
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_PRIMITIVE_GROUP_APPLY_HH
diff --git a/scribo/text/grouping/group_from_double_link.hh b/scribo/primitive/group/from_double_link.hh
similarity index 57%
rename from scribo/text/grouping/group_from_double_link.hh
rename to scribo/primitive/group/from_double_link.hh
index 5c82cb2..8c15dc3 100644
--- a/scribo/text/grouping/group_from_double_link.hh
+++ b/scribo/primitive/group/from_double_link.hh
@@ -23,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_GROUPING_GROUP_FROM_DOUBLE_LINK_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_FROM_DOUBLE_LINK_HH
+#ifndef SCRIBO_PRIMITIVE_GROUP_FROM_DOUBLE_LINK_HH
+# define SCRIBO_PRIMITIVE_GROUP_FROM_DOUBLE_LINK_HH
/// \file
@@ -42,23 +42,20 @@
# include <scribo/core/macros.hh>
-# include <scribo/util/text.hh>
-
-# include <scribo/make/text.hh>
-
+# include <scribo/core/object_groups.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/find_root.hh>
-# include <scribo/text/grouping/internal/is_link_valid.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_root.hh>
+# include <scribo/primitive/internal/is_link_valid.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace group
{
/*! Group objects from left and right links information and
@@ -70,22 +67,13 @@ namespace scribo
\param[in] right_link The right neighbor of each line of text.
\param[in] parent_link The function used to group components.
- \return An image of grouped objects.
+ \return Return object groups information.
*/
template <typename L>
- object_image(L)
- group_from_double_link(const object_image(L)& objects,
- const mln::util::array<unsigned>& left_link,
- const mln::util::array<unsigned>& right_link,
- mln::util::array<unsigned>& parent_link);
-
- /// \overload
- template <typename L>
- object_image(L)
- group_from_double_link(const object_image(L)& objects,
- const mln::util::array<unsigned>& left_link,
- const mln::util::array<unsigned>& right_link);
-
+ object_groups<L>
+ from_double_link(const object_image(L)& objects,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link);
@@ -94,17 +82,18 @@ namespace scribo
template <typename L>
inline
- object_image(L)
- group_from_double_link(const object_image(L)& objects,
- const mln::util::array<unsigned>& left_link,
- const mln::util::array<unsigned>& right_link,
- mln::util::array<unsigned>& parent_link)
+ object_groups<L>
+ from_double_link(const object_image(L)& objects,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link)
{
- trace::entering("scribo::text::grouping::group_from_double_link");
+ trace::entering("scribo::primitive::group::from_double_link");
mln_precondition(left_link.nelements() == right_link.nelements());
+ mln_precondition(left_link.objects_id_() == objects.id_());
+ mln_precondition(right_link.objects_id_() == objects.id_());
- mln::util::array<unsigned> parent(left_link.nelements());
+ object_groups<L> parent(objects, left_link.nelements());
internal::init_link_array(parent);
for_all_ncomponents(i, objects.nlabels())
{
@@ -123,38 +112,18 @@ namespace scribo
for (unsigned i = parent.nelements() - 1; i < parent.nelements(); --i)
parent[i] = parent[parent[i]];
- object_image(L) output;
- output.init_from_(objects);
- output.relabel(parent);
-
- parent_link = parent;
- trace::exiting("scribo::text::grouping::group_from_double_link");
- return output;
- }
-
-
- template <typename L>
- inline
- object_image(L)
- group_from_double_link(const object_image(L)& objects,
- const mln::util::array<unsigned>& left_link,
- const mln::util::array<unsigned>& right_link)
- {
- mln::util::array<unsigned> parent_link;
- return group_from_double_link(objects,
- left_link,
- right_link,
- parent_link);
+ trace::exiting("scribo::primitive::group::from_double_link");
+ return parent;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::group
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_FROM_DOUBLE_LINK_HH
+#endif // ! SCRIBO_PRIMITIVE_GROUP_FROM_DOUBLE_LINK_HH
diff --git a/scribo/text/grouping/group_from_graph.hh b/scribo/primitive/group/from_graph.hh
similarity index 70%
rename from scribo/text/grouping/group_from_graph.hh
rename to scribo/primitive/group/from_graph.hh
index f6e6cf2..55cb56d 100644
--- a/scribo/text/grouping/group_from_graph.hh
+++ b/scribo/primitive/group/from_graph.hh
@@ -23,13 +23,13 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_FROM_GRAPH_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_FROM_GRAPH_HH
+#ifndef SCRIBO_PRIMITIVE_GROUP_FROM_GRAPH_HH
+# define SCRIBO_PRIMITIVE_GROUP_FROM_GRAPH_HH
/// \file
///
-/// Group lines of text according to a graph of links between
-/// the lines of text.
+/// Group objects according to a graph of links
+
# include <mln/core/concept/graph.hh>
# include <mln/core/concept/image.hh>
@@ -46,6 +46,8 @@
# include <mln/util/array.hh>
# include <mln/util/graph_ids.hh>
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_groups.hh>
# include <scribo/core/object_image.hh>
# include <scribo/core/macros.hh>
@@ -53,26 +55,25 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace group
{
using namespace mln;
- /// Group lines of text according to a graph of links between
- /// the lines of text.
+ /// Group objects according to a graph of links
///
- /// \param[in] text An object image.
- /// \param[in] g_ The graph of links between the lines of text.
+ /// \param[in] objects An object image.
+ /// \param[in] g_ The graph of object links.
///
- /// \return An image with grouped objects.
+ /// \return Object groups information.
//
template <typename L, typename G>
- object_image(L)
- group_from_graph(const object_image(L)& text,
- const Graph<G>& g_);
+ object_groups<L>
+ from_graph(const object_image(L)& objects,
+ const Graph<G>& g_);
# ifndef MLN_INCLUDE_ONLY
@@ -83,15 +84,20 @@ namespace scribo
/// Functor to be passed to depth_first_search.
/// Map each component vertex with its representative vertex id.
- template <typename V>
+ template <typename L>
struct map_vertex_to_representative_id_functor
{
+ map_vertex_to_representative_id_functor(const object_image(L)& objects)
+ : vertextorep(objects)
+ {
+ }
+
/// Initialize the functor.
template <typename G>
void init(const Graph<G>& g)
{
- vertextorep.resize(exact(g).v_nmax(), mln_max(V));
+ vertextorep.resize(exact(g).v_nmax(), mln_max(mln_value(L)));
}
/// All components have been processed.
@@ -123,7 +129,7 @@ namespace scribo
/// Does the vertex with id \p id have been already treated?
bool to_be_treated(const mln::util::vertex_id_t& id)
- { return vertextorep(id) == mln_max(V); }
+ { return vertextorep(id) == mln_max(mln_value(L)); }
/// Does the neighbor vertex \p id have been already treated?
bool to_be_queued(const mln::util::vertex_id_t& id)
@@ -133,43 +139,42 @@ namespace scribo
mln::util::vertex_id_t current_;
/// Map a verted id to its component id.
- fun::i2v::array<V> vertextorep;
+ object_links<L> vertextorep;
};
- } // end of namespace scribo::text::grouping::internal
+ } // end of namespace scribo::primitive::group::internal
template <typename L, typename G>
inline
- object_image(L)
- group_from_graph(const object_image(L)& text,
- const Graph<G>& g_)
+ object_groups<L>
+ from_graph(const object_image(L)& objects,
+ const Graph<G>& g_)
{
- trace::entering("scribo::text::grouping::group_from_graph");
+ trace::entering("scribo::primitive::group::from_graph");
const G& g = exact(g_);
mln_assertion(g.is_valid());
- internal::map_vertex_to_representative_id_functor<mln_value(L)> f;
+ internal::map_vertex_to_representative_id_functor<L> f(objects);
canvas::browsing::depth_first_search(g, f);
- object_image(L) output;
- output.init_from_(text);
- output.relabel(f.vertextorep);
+ object_groups<L> groups(objects);
+ groups.init_(f.vertextorep);
- trace::exiting("scribo::text::grouping::group_from_graph");
- return output;
+ trace::exiting("scribo::primitive::group::from_graph");
+ return groups;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::group
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_FROM_GRAPH_HH
+#endif // ! SCRIBO_PRIMITIVE_GROUP_FROM_GRAPH_HH
diff --git a/scribo/text/grouping/group_from_single_link.hh b/scribo/primitive/group/from_single_link.hh
similarity index 68%
rename from scribo/text/grouping/group_from_single_link.hh
rename to scribo/primitive/group/from_single_link.hh
index 0f4e7b3..2b53b67 100644
--- a/scribo/text/grouping/group_from_single_link.hh
+++ b/scribo/primitive/group/from_single_link.hh
@@ -23,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_GROUPING_GROUP_FROM_SINGLE_LINK_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_FROM_SINGLE_LINK_HH
+#ifndef SCRIBO_PRIMITIVE_GROUP_FROM_SINGLE_LINK_HH
+# define SCRIBO_PRIMITIVE_GROUP_FROM_SINGLE_LINK_HH
/// \file
///
@@ -38,8 +38,10 @@
# include <mln/util/array.hh>
-# include <scribo/text/grouping/internal/find_root.hh>
+# include <scribo/primitive/internal/find_root.hh>
+# include <scribo/core/object_groups.hh>
+# include <scribo/core/object_links.hh>
# include <scribo/core/object_image.hh>
# include <scribo/core/macros.hh>
@@ -47,10 +49,10 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace group
{
using namespace mln;
@@ -62,45 +64,45 @@ namespace scribo
\param[in] objects An object image.
\param[in] link_array The neighbor line of each line.
- \return An object image with grouped objects.
+ \return Object groups information.
*/
template <typename L>
- object_image(L)
- group_from_single_link(const object_image(L)& objects,
- const mln::util::array<unsigned>& link_array);
+ object_groups<L>
+ from_single_link(const object_image(L)& objects,
+ const object_links<L>& link_array);
+
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
- object_image(L)
- group_from_single_link(const object_image(L)& objects,
- const mln::util::array<unsigned>& link_array)
+ object_groups<L>
+ from_single_link(const object_image(L)& objects,
+ const object_links<L>& link_array)
{
- trace::entering("scribo::text::grouping::group_from_single_link");
+ trace::entering("scribo::primitive::group::from_single_link");
mln_precondition(objects.is_valid());
mln_precondition(link_array.nelements() == objects.nlabels().next());
mln_precondition(link_array.nelements() == objects.bboxes().nelements());
+ mln_precondition(link_array.objects_id_() == objects.id_());
- mln::util::array<unsigned> parent_array = link_array;
- for_all_components(i, parent_array)
- internal::find_root(parent_array, i);
+ object_groups<L> parent_array(objects);
+ parent_array.init_(link_array);
- object_image(L) output;
- output.init_from_(objects);
- output.relabel(parent_array);
+ for_all_components(i, parent_array)
+ primitive::internal::find_root(parent_array, i);
- trace::exiting("scribo::text::grouping::group_from_single_link");
- return output;
+ trace::exiting("scribo::primitive::group::from_single_link");
+ return parent_array;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::group
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_FROM_SINGLE_LINK_HH
+#endif // ! SCRIBO_PRIMITIVE_GROUP_FROM_SINGLE_LINK_HH
diff --git a/scribo/text/grouping/internal/init_link_array.hh b/scribo/primitive/internal/all.hh
similarity index 61%
copy from scribo/text/grouping/internal/init_link_array.hh
copy to scribo/primitive/internal/all.hh
index 522c221..86aa62a 100644
--- a/scribo/text/grouping/internal/init_link_array.hh
+++ b/scribo/primitive/internal/all.hh
@@ -23,54 +23,38 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_INIT_LINK_ARRAY_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_INIT_LINK_ARRAY_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_ALL_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_ALL_HH
/// \file
///
-/// Initialize a link array.
-
-
-# include <mln/util/array.hh>
-
+/// Include all headers located in scribo/primitive/internal.
namespace scribo
{
- using namespace mln;
-
- namespace text
+ namespace primitive
{
- namespace grouping
+ /// Namespace of internal routines grouping text components.
+ namespace internal
{
- namespace internal
- {
-
- /// Initialize a link array.
- void
- init_link_array(mln::util::array<unsigned>& link_array);
+ } // end of namespace scribo::primitive::internal
-# ifndef MLN_INCLUDE_ONLY
+ } // end of namespace scribo::primitive
- inline
- void
- init_link_array(mln::util::array<unsigned>& link_array)
- {
- for (unsigned i = 0; i < link_array.nelements(); ++i)
- link_array[i] = i;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
+} // end of namespace scribo
- } // end of namespace scribo::text
-} // end of namespace scribo
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/is_link_valid.hh>
+# include <scribo/primitive/internal/find_root.hh>
+# include <scribo/primitive/internal/find_graph_link.hh>
+# include <scribo/primitive/internal/find_right_link.hh>
+# include <scribo/primitive/internal/update_graph_link.hh>
+# include <scribo/primitive/internal/update_link_array.hh>
+# include <scribo/primitive/internal/find_left_link.hh>
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_INIT_LINK_ARRAY_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_ALL_HH
diff --git a/scribo/text/grouping/internal/find_graph_link.hh b/scribo/primitive/internal/find_graph_link.hh
similarity index 51%
rename from scribo/text/grouping/internal/find_graph_link.hh
rename to scribo/primitive/internal/find_graph_link.hh
index 733b646..b2f6549 100644
--- a/scribo/text/grouping/internal/find_graph_link.hh
+++ b/scribo/primitive/internal/find_graph_link.hh
@@ -23,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_GROUPING_INTERNAL_FIND_GRAPH_LINK_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_FIND_GRAPH_LINK_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_FIND_GRAPH_LINK_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_FIND_GRAPH_LINK_HH
/// \file
///
@@ -38,7 +38,7 @@
# include <mln/util/array.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/update_graph_link.hh>
+# include <scribo/primitive/internal/update_graph_link.hh>
//FIXME: not generic.
# include <mln/core/alias/dpoint2d.hh>
@@ -47,70 +47,65 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace internal
{
- namespace internal
- {
-
- /// Find a neighbor of a text line in a specific range if it exists.
- ///
- /// \param g_ The link graph.
- /// \param text The lines of text.
- /// \param current_comp The current line being processed.
- /// \param dmax The maximum lookup distance.
- /// \param c Start point of the neighbor lookup.
- //
- template <typename G, typename L>
- void
- find_graph_link(Graph<G>& g_,
- const object_image(L)& text,
- unsigned current_comp,
- int dmax,
- const mln_site(L)& c);
+ /// Find a neighbor of a text line in a specific range if it exists.
+ ///
+ /// \param g_ The link graph.
+ /// \param text The lines of text.
+ /// \param current_comp The current line being processed.
+ /// \param dmax The maximum lookup distance.
+ /// \param c Start point of the neighbor lookup.
+ //
+ template <typename G, typename L>
+ void
+ find_graph_link(Graph<G>& g_,
+ const object_image(L)& text,
+ unsigned current_comp,
+ int dmax,
+ const mln_site(L)& c);
# ifndef MLN_INCLUDE_ONLY
- template <typename G, typename L>
- void
- find_graph_link(Graph<G>& g_,
- const object_image(L)& text,
- unsigned current_comp,
- int dmax,
- const mln_site(L)& c)
- {
- trace::entering("scribo::text::grouping::internal::find_graph_link");
+ template <typename G, typename L>
+ void
+ find_graph_link(Graph<G>& g_,
+ const object_image(L)& text,
+ unsigned current_comp,
+ int dmax,
+ const mln_site(L)& c)
+ {
+ trace::entering("scribo::primitive::internal::find_graph_link");
- G& g = exact(g_);
- mln_precondition(g.is_valid());
- mln_precondition(text.is_valid());
+ G& g = exact(g_);
+ mln_precondition(g.is_valid());
+ mln_precondition(text.is_valid());
- ///FIXME: the following code is not generic...
- /// First site on the right of the central site
- mln_site(L) p = c + right;
+ ///FIXME: the following code is not generic...
+ /// First site on the right of the central site
+ mln_site(L) p = c + right;
- while (text.domain().has(p) && (text(p) == literal::zero
- || text(p) == current_comp)
- && math::abs(p.col() - c.col()) < dmax)
- ++p.col();
+ while (text.domain().has(p) && (text(p) == literal::zero
+ || text(p) == current_comp)
+ && math::abs(p.col() - c.col()) < dmax)
+ ++p.col();
- update_graph_link(text, g, p, c, current_comp, dmax);
+ update_graph_link(text, g, p, c, current_comp, dmax);
- trace::exiting("scribo::text::grouping::internal::find_graph_link");
- }
+ trace::exiting("scribo::primitive::internal::find_graph_link");
+ }
# endif // MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::internal
} // end of namespace scribo::text
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_FIND_GRAPH_LINK_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_GRAPH_LINK_HH
diff --git a/scribo/primitive/internal/find_left_link.hh b/scribo/primitive/internal/find_left_link.hh
new file mode 100644
index 0000000..7ef2895
--- /dev/null
+++ b/scribo/primitive/internal/find_left_link.hh
@@ -0,0 +1,104 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_FIND_LEFT_LINK_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_FIND_LEFT_LINK_HH
+
+/// \file
+///
+/// Find the left neighbor of a line of text if exists.
+
+# include <mln/core/concept/image.hh>
+
+# include <mln/math/abs.hh>
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/primitive/internal/update_link_array.hh>
+
+//FIXME: not generic.
+# include <mln/core/alias/dpoint2d.hh>
+
+namespace scribo
+{
+
+ namespace primitive
+ {
+
+ namespace internal
+ {
+
+ /// Find the left neighbor of a line of text if exists.
+ ///
+ /// \param objects An image of objects.
+ /// \param left_link The left neighbors.
+ /// \param current_comp A text line id.
+ /// \param dmax The maximum lookup distance.
+ /// \param c The lookup start point.
+ //
+ template <typename L>
+ void
+ find_left_link(const object_image(L)& objects,
+ mln::util::array<unsigned>& left_link,
+ unsigned current_comp,
+ int dmax,
+ const mln_site(L)& c);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ void
+ find_left_link(const object_image(L)& objects,
+ mln::util::array<unsigned>& left_link,
+ unsigned current_comp,
+ int dmax,
+ const mln_site(L)& c)
+ {
+ ///FIXME: the following code is not generic...
+ /// First site on the right of the central site
+ mln_site(L) p = c + mln::left;
+
+ while (objects.domain().has(p) // Not outside image domain
+ && (objects(p) == literal::zero // Is the background
+ || objects(p) == current_comp // Is the current component
+ || left_link[objects(p)] == current_comp) // Creates a loop
+ && math::abs(p.col() - c.col()) < dmax) // Not to far
+ --p.col();
+
+ update_link_array(objects, left_link, p, c, current_comp, dmax);
+ }
+
+# endif // MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::primitive::internal
+
+ } // end of namespace scribo::primitive
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_LEFT_LINK_HH
diff --git a/scribo/primitive/internal/find_right_link.hh b/scribo/primitive/internal/find_right_link.hh
new file mode 100644
index 0000000..10f9565
--- /dev/null
+++ b/scribo/primitive/internal/find_right_link.hh
@@ -0,0 +1,105 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_FIND_RIGHT_LINK_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_FIND_RIGHT_LINK_HH
+
+/// \file
+///
+/// Find the right neighbor of a line of text if exists.
+
+# include <mln/core/concept/image.hh>
+
+# include <mln/math/abs.hh>
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/primitive/internal/update_link_array.hh>
+
+//FIXME: not generic.
+# include <mln/core/alias/dpoint2d.hh>
+
+namespace scribo
+{
+
+ namespace primitive
+ {
+
+ namespace internal
+ {
+
+ using namespace mln;
+
+ /// Find the right neighbor of a line of text if exists.
+ ///
+ /// \param text The lines of text.
+ /// \param right_link The right neighbors.
+ /// \param current_comp A text line id.
+ /// \param dmax The maximum lookup distance.
+ /// \param c The lookup start point.
+ //
+ template <typename L>
+ void
+ find_right_link(const object_image(L)& text,
+ mln::util::array<unsigned>& right_link,
+ unsigned current_comp,
+ int dmax,
+ const mln_site(L)& c);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ void
+ find_right_link(const object_image(L)& objects,
+ mln::util::array<unsigned>& right_link,
+ unsigned current_comp,
+ int dmax,
+ const mln_site(L)& c)
+ {
+ ///FIXME: the following code is not generic...
+ /// First site on the right of the central site
+ mln_site(L) p = c + mln::right;
+
+ while (objects.domain().has(p) // Not outside image domain
+ && (objects(p) == literal::zero // Is the background
+ || objects(p) == current_comp // Is the current component
+ || right_link[objects(p)] == current_comp) // Creates a loop
+ && math::abs(p.col() - c.col()) < dmax) // Not too far
+ ++p.col();
+
+ update_link_array(objects, right_link, p, c, current_comp, dmax);
+ }
+
+# endif // MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::primitive::internal
+
+ } // end of namespace scribo::primitive
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_RIGHT_LINK_HH
diff --git a/scribo/text/grouping/internal/find_root.hh b/scribo/primitive/internal/find_root.hh
similarity index 84%
rename from scribo/text/grouping/internal/find_root.hh
rename to scribo/primitive/internal/find_root.hh
index c1da04f..70499ec 100644
--- a/scribo/text/grouping/internal/find_root.hh
+++ b/scribo/primitive/internal/find_root.hh
@@ -23,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_GROUPING_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
/// \file
///
@@ -37,12 +37,9 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
- {
-
namespace internal
{
@@ -64,13 +61,11 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::internal
} // end of namespace scribo::text
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
diff --git a/scribo/text/grouping/internal/is_link_valid.hh b/scribo/primitive/internal/have_link_valid.hh
similarity index 60%
rename from scribo/text/grouping/internal/is_link_valid.hh
rename to scribo/primitive/internal/have_link_valid.hh
index 32d6747..3425745 100644
--- a/scribo/text/grouping/internal/is_link_valid.hh
+++ b/scribo/primitive/internal/have_link_valid.hh
@@ -23,12 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_IS_LINK_VALID_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_IS_LINK_VALID_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_HAVE_LINK_VALID_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_HAVE_LINK_VALID_HH
/// \file
///
-/// Validate a link from two different links.
+/// Tells whether a component have at least one valid link
# include <mln/util/array.hh>
@@ -37,47 +37,42 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace internal
{
- namespace internal
- {
-
- /// Validate a link from two different links.
- ///
- /// \param[in] left_link Left link of components.
- /// \param[in] right_link Right link of components.
- /// \param[in] i The component id.
- ///
- /// \return True if the link is between the \p i-th component
- /// and it neighbor is validated.
- mln::util::couple<bool,unsigned>
- is_link_valid(const mln::util::array<unsigned>& left_link,
+ /// Tells whether a component have at least one valid link link.
+ ///
+ /// \param[in] left_link Left link of components.
+ /// \param[in] right_link Right link of components.
+ /// \param[in] i The component id.
+ ///
+ /// \return True if the \p i-th component has at least one
+ /// valid link.
+ bool
+ have_link_valid(const mln::util::array<unsigned>& left_link,
const mln::util::array<unsigned>& right_link,
unsigned i);
# ifndef MLN_INCLUDE_ONLY
- mln::util::couple<bool,unsigned>
- is_link_valid(const mln::util::array<unsigned>& left_link,
+ bool
+ have_link_valid(const mln::util::array<unsigned>& left_link,
const mln::util::array<unsigned>& right_link,
unsigned i)
- {
- bool b = (right_link[left_link[i]] == i && left_link[i] != i);
- return mln::make::couple(b, left_link[i]);
- }
+ {
+ return (right_link[left_link[i]] == i && left_link[i] != i)
+ || (left_link[right_link[i]] == i && right_link[i] != i);
+ }
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::internal
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_IS_LINK_VALID_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_HAVE_LINK_VALID_HH
diff --git a/scribo/text/grouping/internal/init_link_array.hh b/scribo/primitive/internal/init_link_array.hh
similarity index 69%
rename from scribo/text/grouping/internal/init_link_array.hh
rename to scribo/primitive/internal/init_link_array.hh
index 522c221..c46dca0 100644
--- a/scribo/text/grouping/internal/init_link_array.hh
+++ b/scribo/primitive/internal/init_link_array.hh
@@ -23,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_GROUPING_INTERNAL_INIT_LINK_ARRAY_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_INIT_LINK_ARRAY_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_INIT_LINK_ARRAY_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_INIT_LINK_ARRAY_HH
/// \file
///
@@ -39,38 +39,33 @@ namespace scribo
using namespace mln;
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace internal
{
- namespace internal
- {
-
- /// Initialize a link array.
- void
- init_link_array(mln::util::array<unsigned>& link_array);
+ /// Initialize a link array.
+ void
+ init_link_array(mln::util::array<unsigned>& link_array);
# ifndef MLN_INCLUDE_ONLY
- inline
- void
- init_link_array(mln::util::array<unsigned>& link_array)
- {
- for (unsigned i = 0; i < link_array.nelements(); ++i)
- link_array[i] = i;
- }
+ inline
+ void
+ init_link_array(mln::util::array<unsigned>& link_array)
+ {
+ for (unsigned i = 0; i < link_array.nelements(); ++i)
+ link_array[i] = i;
+ }
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::internal
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_INIT_LINK_ARRAY_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_INIT_LINK_ARRAY_HH
diff --git a/scribo/text/grouping/internal/have_link_valid.hh b/scribo/primitive/internal/is_link_valid.hh
similarity index 56%
rename from scribo/text/grouping/internal/have_link_valid.hh
rename to scribo/primitive/internal/is_link_valid.hh
index bdc6f18..69fe484 100644
--- a/scribo/text/grouping/internal/have_link_valid.hh
+++ b/scribo/primitive/internal/is_link_valid.hh
@@ -23,12 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_HAVE_LINK_VALID_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_HAVE_LINK_VALID_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_IS_LINK_VALID_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_IS_LINK_VALID_HH
/// \file
///
-/// Tells whether a component have at least one valid link
+/// Validate a link from two different links.
# include <mln/util/array.hh>
@@ -37,47 +37,42 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace internal
{
- namespace internal
- {
-
- /// Tells whether a component have at least one valid link link.
- ///
- /// \param[in] left_link Left link of components.
- /// \param[in] right_link Right link of components.
- /// \param[in] i The component id.
- ///
- /// \return True if the \p i-th component has at least one
- /// valid link.
- bool
- have_link_valid(const mln::util::array<unsigned>& left_link,
- const mln::util::array<unsigned>& right_link,
- unsigned i);
+ /// Validate a link from two different links.
+ ///
+ /// \param[in] left_link Left link of components.
+ /// \param[in] right_link Right link of components.
+ /// \param[in] i The component id.
+ ///
+ /// \return True if the link is between the \p i-th component
+ /// and it neighbor is validated.
+ mln::util::couple<bool,unsigned>
+ is_link_valid(const mln::util::array<unsigned>& left_link,
+ const mln::util::array<unsigned>& right_link,
+ unsigned i);
# ifndef MLN_INCLUDE_ONLY
- bool
- have_link_valid(const mln::util::array<unsigned>& left_link,
- const mln::util::array<unsigned>& right_link,
- unsigned i)
- {
- return (right_link[left_link[i]] == i && left_link[i] != i)
- || (left_link[right_link[i]] == i && right_link[i] != i);
- }
+ mln::util::couple<bool,unsigned>
+ is_link_valid(const mln::util::array<unsigned>& left_link,
+ const mln::util::array<unsigned>& right_link,
+ unsigned i)
+ {
+ bool b = (right_link[left_link[i]] == i && left_link[i] != i);
+ return mln::make::couple(b, left_link[i]);
+ }
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::internal
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_HAVE_LINK_VALID_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_IS_LINK_VALID_HH
diff --git a/scribo/primitive/internal/update_graph_link.hh b/scribo/primitive/internal/update_graph_link.hh
new file mode 100644
index 0000000..54e06de
--- /dev/null
+++ b/scribo/primitive/internal/update_graph_link.hh
@@ -0,0 +1,102 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_UPDATE_GRAPH_LINK_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_UPDATE_GRAPH_LINK_HH
+
+/// \file
+///
+/// Update graph edges if a valid neighbor is found.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/graph.hh>
+# include <mln/math/abs.hh>
+
+namespace scribo
+{
+
+ namespace primitive
+ {
+
+ namespace internal
+ {
+
+ using namespace mln;
+
+
+ /// Update graph edges if a valid neighbor is found.
+ ///
+ /// \param[in] lbl_ A label image.
+ /// \param[in] g_ A graph.
+ /// \param[in] p A site of \p lbl_.
+ /// \param[in] c A site of \p lbl_.
+ /// \param[in] i A vertex id.
+ /// \param[in] dmax The maximum distance allowed to look for a
+ /// neighbor.
+ //
+ template <typename I, typename G>
+ void
+ update_graph_link(const Image<I>& lbl_, Graph<G>& g_,
+ const mln_site(I)& p, const mln_site(I)& c,
+ unsigned i, int dmax);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename G>
+ inline
+ void
+ update_graph_link(const Image<I>& lbl_, Graph<G>& g_,
+ const mln_site(I)& p, const mln_site(I)& c,
+ unsigned i, int dmax)
+ {
+ trace::entering("scribo::primitive::internal::update_graph_link");
+
+ const I& lbl = exact(lbl_);
+ G& g = exact(g_);
+
+ mlc_is_a(mln_value(I), mln::value::Symbolic)::check();
+ mln_precondition(exact(lbl).is_valid());
+ mln_precondition(g.is_valid());
+
+ if (lbl.domain().has(p) && lbl(p) != literal::zero && lbl(p) != i
+ && (math::abs(p.col() - c.col())) < dmax)
+ g.add_edge(lbl(p), i);
+
+ trace::exiting("scribo::primitive::internal::update_graph_link");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::primitive::internal
+
+ } // end of namespace scribo::primitive
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_UPDATE_GRAPH_LINK_HH
diff --git a/scribo/text/grouping/internal/update_link_array.hh b/scribo/primitive/internal/update_link_array.hh
similarity index 52%
rename from scribo/text/grouping/internal/update_link_array.hh
rename to scribo/primitive/internal/update_link_array.hh
index 0a82cc8..c26ec78 100644
--- a/scribo/text/grouping/internal/update_link_array.hh
+++ b/scribo/primitive/internal/update_link_array.hh
@@ -23,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_GROUPING_INTERNAL_UPDATE_LINK_ARRAY_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_UPDATE_LINK_ARRAY_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_UPDATE_LINK_ARRAY_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_UPDATE_LINK_ARRAY_HH
/// \file
///
@@ -40,64 +40,60 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace internal
{
- namespace internal
- {
-
- using namespace mln;
+ using namespace mln;
- /// Update the lookup table \p link_array if a neighbor is found
- /// on the right of the current bbox.
- ///
- /// \param[in] lbl A label image.
- /// \param[in] link_array Links of bounding boxes.
- /// \param[in] p A site of \p lbl.
- /// \param[in] c A site of \p lbl.
- //
- template <typename I>
- void
- update_link_array(const Image<I>& lbl,
- mln::util::array<unsigned>& link_array,
- const mln_site(I)& p, const mln_site(I)& c,
- unsigned i, int dmax);
+ /// Update the lookup table \p link_array if a neighbor is found
+ /// on the right of the current bbox.
+ ///
+ /// \param[in] lbl A label image.
+ /// \param[in] link_array Links of bounding boxes.
+ /// \param[in] p A site of \p lbl.
+ /// \param[in] c A site of \p lbl.
+ //
+ template <typename I>
+ void
+ update_link_array(const Image<I>& lbl,
+ mln::util::array<unsigned>& link_array,
+ const mln_site(I)& p, const mln_site(I)& c,
+ unsigned i, int dmax);
# ifndef MLN_INCLUDE_ONLY
- template <typename I>
- inline
- void
- update_link_array(const Image<I>& lbl_, mln::util::array<unsigned>& link_array,
- const mln_site(I)& p, const mln_site(I)& c,
- unsigned i, int dmax)
- {
- const I& lbl = exact(lbl_);
-
- mlc_is_a(mln_value(I), mln::value::Symbolic)::check();
- mln_assertion(lbl.is_valid());
-
- if (lbl.domain().has(p) // Not outside image domain
- && lbl(p) != literal::zero // Not the background
- && lbl(p) != i // Not the current component
- && (math::abs(p.col() - c.col())) < dmax // Not too far
- && link_array[lbl(p)] != i) // Not creating a loop
- link_array[i] = lbl(p);
- }
+ template <typename I>
+ inline
+ void
+ update_link_array(const Image<I>& lbl_,
+ mln::util::array<unsigned>& link_array,
+ const mln_site(I)& p, const mln_site(I)& c,
+ unsigned i, int dmax)
+ {
+ const I& lbl = exact(lbl_);
+
+ mlc_is_a(mln_value(I), mln::value::Symbolic)::check();
+ mln_assertion(lbl.is_valid());
-# endif // ! MLN_INCLUDE_ONLY
+ if (lbl.domain().has(p) // Not outside image domain
+ && lbl(p) != literal::zero // Not the background
+ && lbl(p) != i // Not the current component
+ && (math::abs(p.col() - c.col())) < dmax // Not too far
+ && link_array[lbl(p)] != i) // Not creating a loop
+ link_array[i] = lbl(p);
+ }
- } // end of namespace scribo::text::grouping::internal
+# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::internal
} // end of namespace scribo::text
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_UPDATE_LINK_ARRAY_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_UPDATE_LINK_ARRAY_HH
diff --git a/scribo/text/all.hh b/scribo/primitive/link/all.hh
similarity index 64%
copy from scribo/text/all.hh
copy to scribo/primitive/link/all.hh
index 000d5b9..7313adb 100644
--- a/scribo/text/all.hh
+++ b/scribo/primitive/link/all.hh
@@ -23,27 +23,38 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_ALL_HH
-# define SCRIBO_TEXT_ALL_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_ALL_HH
+# define SCRIBO_PRIMITIVE_LINK_ALL_HH
/// \file
///
-/// Include all headers located in scribo/text.
+/// Include all headers located in scribo/primitive/group.
namespace scribo
{
- /// Namespace of routines working on text components.
- namespace text
+ namespace primitive
{
- } // end of namespace scribo::text
+ /// Namespace of primitive linking related routines.
+ namespace link
+ {
+
+ } // end of namespace scribo::primitive::group
+
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-# include <scribo/text/extract_lines.hh>
-//# include <scribo/text/recognition.hh>
-# include <scribo/text/clean.hh>
-# include <scribo/text/grouping/all.hh>
-#endif // ! SCRIBO_TEXT_ALL_HH
+
+
+# include <scribo/primitive/link/with_several_graphes.hh>
+# include <scribo/primitive/link/with_several_right_links.hh>
+# include <scribo/primitive/link/with_graph.hh>
+# include <scribo/primitive/link/with_single_left_link.hh>
+# include <scribo/primitive/link/with_several_left_links.hh>
+# include <scribo/primitive/link/with_single_right_link.hh>
+
+
+#endif // ! SCRIBO_PRIMITIVE_LINK_ALL_HH
diff --git a/scribo/primitive/link/merge_double_link.hh b/scribo/primitive/link/merge_double_link.hh
new file mode 100644
index 0000000..3181117
--- /dev/null
+++ b/scribo/primitive/link/merge_double_link.hh
@@ -0,0 +1,123 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_PRIMITIVE_LINK_MERGE_DOUBLE_LINK_HH
+# define SCRIBO_PRIMITIVE_LINK_MERGE_DOUBLE_LINK_HH
+
+
+/// \file
+///
+/// Validate and merge double link information. A link must exist in
+/// both ways to be validated.
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/site_set/box.hh>
+
+# include <mln/accu/shape/bbox.hh>
+
+# include <mln/data/compare.hh>
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/macros.hh>
+
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_image.hh>
+# include <scribo/primitive/internal/find_root.hh>
+# include <scribo/primitive/internal/is_link_valid.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+
+
+namespace scribo
+{
+
+ namespace primitive
+ {
+
+ namespace link
+ {
+
+ /*!
+ \brief Validate and merge double link information. A link
+ must exist in both ways to be validated.
+
+ \param[in] objects The Lines of text.
+ \param[in] left_link The left neighbor of each line of text.
+ \param[in] right_link The right neighbor of each line of text.
+
+ \return The merge of left_link and right_link.
+ */
+ template <typename L>
+ object_links<L>
+ merge_double_link(const object_image(L)& objects,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ inline
+ object_links<L>
+ merge_double_link(const object_image(L)& objects,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link)
+ {
+ trace::entering("scribo::primitive::link::merge_double_link");
+
+ mln_precondition(objects.is_valid());
+ mln_precondition(left_link.nelements() == right_link.nelements());
+ mln_precondition(left_link.objects_id_() == objects.id_());
+ mln_precondition(right_link.objects_id_() == objects.id_());
+
+
+ object_links<L> merge(left_link);
+
+ for_all_ncomponents(i, objects.nlabels())
+ {
+ mln::util::couple<bool, unsigned>
+ nbh = internal::is_link_valid(left_link, right_link, i);
+ if (!nbh.first())
+ merge[i] = i;
+ }
+
+ trace::exiting("scribo::primitive::link::merge_double_link");
+ return merge;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace scribo::primitive::link
+
+ } // end of namespace scribo::primitive
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_PRIMITIVE_LINK_MERGE_DOUBLE_LINK_HH
diff --git a/scribo/text/grouping/group_with_graph.hh b/scribo/primitive/link/with_graph.hh
similarity index 79%
rename from scribo/text/grouping/group_with_graph.hh
rename to scribo/primitive/link/with_graph.hh
index e13e2e9..5f16ec8 100644
--- a/scribo/text/grouping/group_with_graph.hh
+++ b/scribo/primitive/link/with_graph.hh
@@ -23,12 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_GRAPH_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_GRAPH_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_GRAPH_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_GRAPH_HH
/// \file
///
-/// Group character bounding boxes with a graph.
+/// Link character bounding boxes with a graph.
# include <mln/core/concept/image.hh>
@@ -43,18 +43,18 @@
# include <scribo/core/macros.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/find_graph_link.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_graph_link.hh>
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
/*!
@@ -70,7 +70,7 @@ namespace scribo
*/
template <typename L>
mln::util::graph
- group_with_graph(const object_image(L)& objects,
+ with_graph(const object_image(L)& objects,
unsigned neighb_max_distance);
@@ -79,10 +79,10 @@ namespace scribo
template <typename L>
inline
mln::util::graph
- group_with_graph(const object_image(L)& objects,
- unsigned neighb_max_distance)
+ with_graph(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
- trace::entering("scribo::text::grouping::group_with_graph");
+ trace::entering("scribo::primitive::link::with_graph");
mln_precondition(objects.is_valid());
@@ -107,7 +107,7 @@ namespace scribo
internal::find_graph_link(g, objects, i, dmax, mass_center[i]);
}
- trace::exiting("scribo::text::grouping::group_with_graph");
+ trace::exiting("scribo::primitive::link::with_graph");
return g;
}
@@ -115,11 +115,11 @@ namespace scribo
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_GRAPH_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_GRAPH_HH
diff --git a/scribo/text/grouping/group_with_rag.hh b/scribo/primitive/link/with_rag.hh
similarity index 80%
rename from scribo/text/grouping/group_with_rag.hh
rename to scribo/primitive/link/with_rag.hh
index c995335..3638ec7 100644
--- a/scribo/text/grouping/group_with_rag.hh
+++ b/scribo/primitive/link/with_rag.hh
@@ -23,13 +23,13 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_RAG_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_RAG_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_RAG_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_RAG_HH
/// \file
///
-/// Group objects with a region adjacency graph.
+/// Link objects with a region adjacency graph.
# include <mln/core/concept/neighborhood.hh>
@@ -48,10 +48,10 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
using namespace mln;
@@ -59,7 +59,7 @@ namespace scribo
template <typename L, typename N>
util::couple<mln::util::graph, mln_concrete(L)>
- group_with_rag(const object_image(L)& objects,
+ with_rag(const object_image(L)& objects,
const Neighborhood<N>& nbh);
@@ -68,10 +68,10 @@ namespace scribo
template <typename L, typename N>
util::couple<mln::util::graph, mln_concrete(L)>
- group_with_rag(const object_image(L)& objects,
+ with_rag(const object_image(L)& objects,
const Neighborhood<N>& nbh)
{
- trace::entering("scribo::text::grouping::group_with_rag");
+ trace::entering("scribo::primitive::link::with_rag");
mln_precondition(objects.is_valid());
@@ -83,17 +83,17 @@ namespace scribo
nbh,
objects.nlabels());
- trace::exiting("scribo::text::grouping::group_with_rag");
+ trace::exiting("scribo::primitive::link::with_rag");
return make::couple(g, iz);
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_RAG_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_RAG_HH
diff --git a/scribo/text/grouping/group_with_several_graphes.hh b/scribo/primitive/link/with_several_graphes.hh
similarity index 77%
rename from scribo/text/grouping/group_with_several_graphes.hh
rename to scribo/primitive/link/with_several_graphes.hh
index 24cea3d..148d3cc 100644
--- a/scribo/text/grouping/group_with_several_graphes.hh
+++ b/scribo/primitive/link/with_several_graphes.hh
@@ -23,12 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_GRAPHES_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_GRAPHES_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_GRAPHES_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_GRAPHES_HH
/// \file
///
-/// Group character bounding boxes with several graphes.
+/// Link character bounding boxes with several graphes.
# include <mln/core/concept/image.hh>
# include <mln/labeling/compute.hh>
@@ -41,34 +41,34 @@
# include <scribo/core/object_image.hh>
# include <scribo/core/macros.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/find_graph_link.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_graph_link.hh>
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
- /// Group character bounding boxes with several graphes.
+ /// Link character bounding boxes with several graphes.
/// Look up for neighbors on the left of each box.
template <typename L>
mln::util::graph
- group_with_several_graphes(const object_image(L)& objects,
- unsigned neighb_max_distance);
+ with_several_graphes(const object_image(L)& objects,
+ unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
mln::util::graph
- group_with_several_graphes(const object_image(L)& objects,
- unsigned neighb_max_distance)
+ with_several_graphes(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
- trace::entering("scribo::text::grouping::group_with_several_graphes");
+ trace::entering("scribo::primitive::link::with_several_graphes");
mln::util::graph g(objects.nlabels().next());
@@ -113,16 +113,16 @@ namespace scribo
}
- trace::exiting("scribo::text::grouping::group_with_several_graphes");
+ trace::exiting("scribo::primitive::link::with_several_graphes");
return g;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_GRAPHES_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_GRAPHES_HH
diff --git a/scribo/text/grouping/group_with_several_left_links.hh b/scribo/primitive/link/with_several_left_links.hh
similarity index 76%
rename from scribo/text/grouping/group_with_several_left_links.hh
rename to scribo/primitive/link/with_several_left_links.hh
index 8b9e9ff..c2c6c83 100644
--- a/scribo/text/grouping/group_with_several_left_links.hh
+++ b/scribo/primitive/link/with_several_left_links.hh
@@ -23,33 +23,34 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_LEFT_LINKS_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_LEFT_LINKS_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_LEFT_LINKS_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_LEFT_LINKS_HH
/// \file
///
/// Link text bounding boxes with their left neighbor.
///
-/// Merge code with text::grouping::group_with_single_right_link.hh
+/// Merge code with primitive::link::with_single_right_link.hh
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
# include <mln/util/array.hh>
+# include <scribo/core/object_links.hh>
# include <scribo/core/macros.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/find_left_link.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_left_link.hh>
# include <scribo/util/text.hh>
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
/// Map each character bounding box to its left bounding box neighbor
@@ -59,25 +60,28 @@ namespace scribo
/// \return an mln::util::array. Map a bounding box to its left neighbor.
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_several_left_links(const object_image(L)& objects,
- unsigned neighb_max_distance);
+ object_links<L>
+ with_several_left_links(const object_image(L)& objects,
+ unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_several_left_links(const object_image(L)& objects,
- unsigned neighb_max_distance)
+ object_links<L>
+ with_several_left_links(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
- trace::entering("scribo::text::grouping::group_with_several_left_links");
+ trace::entering("scribo::primitive::link::with_several_left_links");
mln_precondition(objects.is_valid());
- mln::util::array<unsigned>
- link_1(objects.nlabels().next()), link_2(objects.nlabels().next()),
- link_3(objects.nlabels().next()), final_link(objects.nlabels().next());
+ object_links<L>
+ link_1(objects, objects.nlabels().next()),
+ link_2(objects, objects.nlabels().next()),
+ link_3(objects, objects.nlabels().next()),
+ final_link(objects, objects.nlabels().next());
+
internal::init_link_array(link_1);
internal::init_link_array(link_2);
internal::init_link_array(link_3);
@@ -131,16 +135,16 @@ namespace scribo
final_link[i] = i;
}
- trace::exiting("scribo::text::grouping::group_with_several_left_links");
+ trace::exiting("scribo::primitive::link::with_several_left_links");
return final_link;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_LEFT_LINKS_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_LEFT_LINKS_HH
diff --git a/scribo/text/grouping/group_with_several_right_links.hh b/scribo/primitive/link/with_several_right_links.hh
similarity index 76%
rename from scribo/text/grouping/group_with_several_right_links.hh
rename to scribo/primitive/link/with_several_right_links.hh
index d0a5400..17e00cc 100644
--- a/scribo/text/grouping/group_with_several_right_links.hh
+++ b/scribo/primitive/link/with_several_right_links.hh
@@ -23,34 +23,35 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_RIGHT_LINKS_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_RIGHT_LINKS_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_RIGHT_LINKS_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_RIGHT_LINKS_HH
/// \file
///
/// Link text bounding boxes with their right neighbor.
///
-/// Merge code with text::grouping::group_with_single_right_link.hh
+/// Merge code with primitive::link::with_single_right_link.hh
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
# include <mln/util/array.hh>
+# include <scribo/core/object_links.hh>
# include <scribo/core/object_image.hh>
# include <scribo/core/macros.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/find_right_link.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_right_link.hh>
# include <scribo/util/text.hh>
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
using namespace mln;
@@ -62,25 +63,28 @@ namespace scribo
/// \return an mln::util::array. Map a bounding box to its right neighbor.
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_several_right_links(const object_image(L)& objects,
- unsigned neighb_max_distance);
+ object_links<L>
+ with_several_right_links(const object_image(L)& objects,
+ unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_several_right_links(const object_image(L)& objects,
- unsigned neighb_max_distance)
+ object_links<L>
+ with_several_right_links(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
- trace::entering("scribo::text::grouping::group_with_several_right_links");
+ trace::entering("scribo::primitive::link::with_several_right_links");
mln_precondition(objects.is_valid());
- mln::util::array<unsigned>
- link_1(objects.nlabels().next()), link_2(objects.nlabels().next()),
- link_3(objects.nlabels().next()), final_link(objects.nlabels().next());
+ object_links<L>
+ link_1(objects, objects.nlabels().next()),
+ link_2(objects, objects.nlabels().next()),
+ link_3(objects, objects.nlabels().next()),
+ final_link(objects, objects.nlabels().next());
+
internal::init_link_array(link_1);
internal::init_link_array(link_2);
internal::init_link_array(link_3);
@@ -135,16 +139,16 @@ namespace scribo
final_link[i] = i;
}
- trace::exiting("scribo::text::grouping::group_with_several_right_links");
+ trace::exiting("scribo::primitive::link::with_several_right_links");
return final_link;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_SEVERAL_RIGHT_LINKS_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_RIGHT_LINKS_HH
diff --git a/scribo/text/grouping/group_with_single_left_link.hh b/scribo/primitive/link/with_single_left_link.hh
similarity index 75%
rename from scribo/text/grouping/group_with_single_left_link.hh
rename to scribo/primitive/link/with_single_left_link.hh
index 19593c6..03cb870 100644
--- a/scribo/text/grouping/group_with_single_left_link.hh
+++ b/scribo/primitive/link/with_single_left_link.hh
@@ -23,14 +23,14 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_SINGLE_LEFT_LINK_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_SINGLE_LEFT_LINK_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_LEFT_LINK_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_LEFT_LINK_HH
/// \file
///
/// Link text objects with their left neighbor.
///
-/// Merge code with text::grouping::group_with_single_right_link.hh
+/// Merge code with primitive::link::with_single_right_link.hh
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
@@ -43,10 +43,11 @@
# include <mln/util/array.hh>
+# include <scribo/core/object_links.hh>
# include <scribo/core/macros.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/find_left_link.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_left_link.hh>
//FIXME: not generic.
# include <mln/core/alias/dpoint2d.hh>
@@ -54,10 +55,10 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
/// Map each text object to its left bounding box neighbor
@@ -71,23 +72,23 @@ namespace scribo
//
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_single_left_link(const object_image(L)& objects,
- unsigned neighb_max_distance);
+ object_links<L>
+ with_single_left_link(const object_image(L)& objects,
+ unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_single_left_link(const object_image(L)& objects,
- unsigned neighb_max_distance)
+ object_links<L>
+ with_single_left_link(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
- trace::entering("scribo::text::grouping::group_with_single_left_link");
+ trace::entering("scribo::primitive::link::with_single_left_link");
mln_precondition(objects.is_valid());
- mln::util::array<unsigned> left_link(objects.nlabels().next());
+ object_links<L> left_link(objects, objects.nlabels().next());
internal::init_link_array(left_link);
mln::util::array<mln_result(accu::center<mln_psite(L)>)>
@@ -105,16 +106,16 @@ namespace scribo
internal::find_left_link(objects, left_link, i, dmax, c);
}
- trace::exiting("scribo::text::grouping::group_with_single_left_link");
+ trace::exiting("scribo::primitive::link::with_single_left_link");
return left_link;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_SINGLE_LEFT_LINK_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_LEFT_LINK_HH
diff --git a/scribo/text/grouping/group_with_single_right_link.hh b/scribo/primitive/link/with_single_right_link.hh
similarity index 73%
rename from scribo/text/grouping/group_with_single_right_link.hh
rename to scribo/primitive/link/with_single_right_link.hh
index ae3fdf1..bd15698 100644
--- a/scribo/text/grouping/group_with_single_right_link.hh
+++ b/scribo/primitive/link/with_single_right_link.hh
@@ -23,14 +23,14 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_TEXT_GROUPING_GROUP_WITH_SINGLE_RIGHT_LINK_HH
-# define SCRIBO_TEXT_GROUPING_GROUP_WITH_SINGLE_RIGHT_LINK_HH
+#ifndef SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_RIGHT_LINK_HH
+# define SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_RIGHT_LINK_HH
/// \file
///
/// Link text objects with their right neighbor.
///
-/// \todo Merge code with text::grouping::group_with_single_right_link.hh
+/// \todo Merge code with primitive::link::with_single_right_link.hh
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
@@ -43,10 +43,11 @@
# include <mln/util/array.hh>
+# include <scribo/core/object_links.hh>
# include <scribo/core/macros.hh>
# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/find_right_link.hh>
+# include <scribo/primitive/internal/init_link_array.hh>
+# include <scribo/primitive/internal/find_right_link.hh>
//FIXME: not generic.
# include <mln/core/alias/dpoint2d.hh>
@@ -54,10 +55,10 @@
namespace scribo
{
- namespace text
+ namespace primitive
{
- namespace grouping
+ namespace link
{
/// Map each text object to its right bounding box neighbor
@@ -70,23 +71,23 @@ namespace scribo
/// \return an mln::util::array. Map a bounding box to its right neighbor.
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_single_right_link(const object_image(L)& objects,
- unsigned neighb_max_distance);
+ object_links<L>
+ with_single_right_link(const object_image(L)& objects,
+ unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
- mln::util::array<unsigned>
- group_with_single_right_link(const object_image(L)& objects,
- unsigned neighb_max_distance)
+ object_links<L>
+ with_single_right_link(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
- trace::entering("scribo::text::grouping::group_with_single_right_link");
+ trace::entering("scribo::primitive::link::with_single_right_link");
mln_precondition(objects.is_valid());
- mln::util::array<unsigned> right_link(objects.nlabels().next());
+ object_links<L> right_link(objects, objects.nlabels().next());
internal::init_link_array(right_link);
mln::util::array<mln_result(accu::center<mln_psite(L)>)>
@@ -104,16 +105,16 @@ namespace scribo
internal::find_right_link(objects, right_link, i, dmax, c);
}
- trace::exiting("scribo::text::grouping::group_with_single_right_link");
+ trace::exiting("scribo::primitive::link::with_single_right_link");
return right_link;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::text::grouping
+ } // end of namespace scribo::primitive::link
- } // end of namespace scribo::text
+ } // end of namespace scribo::primitive
} // end of namespace scribo
-#endif // ! SCRIBO_TEXT_GROUPING_GROUP_WITH_SINGLE_RIGHT_LINK_HH
+#endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_RIGHT_LINK_HH
diff --git a/scribo/src/extract/primitive/extract_discontinued_hlines.cc b/scribo/src/extract/primitive/extract_discontinued_hlines.cc
index 8d4c367..127ca0f 100644
--- a/scribo/src/extract/primitive/extract_discontinued_hlines.cc
+++ b/scribo/src/extract/primitive/extract_discontinued_hlines.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/data/convert.hh>
-#include <scribo/extract/primitive/lines_h_discontinued.hh>
+#include <scribo/primitive/extract/lines_h_discontinued.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
value::label_16 nlines;
image2d<bool> lines
= data::convert(bool(),
- scribo::extract::primitive::lines_h_discontinued(input,
+ scribo::primitive::extract::lines_h_discontinued(input,
c8(),
nlines,
atoi(argv[2]),
diff --git a/scribo/src/extract/primitive/extract_discontinued_lines.cc b/scribo/src/extract/primitive/extract_discontinued_lines.cc
index 6568928..da3faf9 100644
--- a/scribo/src/extract/primitive/extract_discontinued_lines.cc
+++ b/scribo/src/extract/primitive/extract_discontinued_lines.cc
@@ -29,8 +29,8 @@
#include <mln/io/pbm/all.hh>
#include <mln/data/convert.hh>
-#include <scribo/extract/primitive/lines_h_discontinued.hh>
-#include <scribo/extract/primitive/lines_v_discontinued.hh>
+#include <scribo/primitive/extract/lines_h_discontinued.hh>
+#include <scribo/primitive/extract/lines_v_discontinued.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
value::label_16 nhlines;
image2d<bool> hlines
= data::convert(bool(),
- scribo::extract::primitive::lines_h_discontinued(input,
+ scribo::primitive::extract::lines_h_discontinued(input,
c8(),
nhlines,
atoi(argv[2]),
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
value::label_16 nvlines;
image2d<bool> vlines
= data::convert(bool(),
- scribo::extract::primitive::lines_v_discontinued(input,
+ scribo::primitive::extract::lines_v_discontinued(input,
c8(),
nvlines,
atoi(argv[2]),
diff --git a/scribo/src/extract/primitive/extract_discontinued_vlines.cc b/scribo/src/extract/primitive/extract_discontinued_vlines.cc
index af1f079..5e71ec0 100644
--- a/scribo/src/extract/primitive/extract_discontinued_vlines.cc
+++ b/scribo/src/extract/primitive/extract_discontinued_vlines.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/data/convert.hh>
-#include <scribo/extract/primitive/lines_v_discontinued.hh>
+#include <scribo/primitive/extract/lines_v_discontinued.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
value::label_16 nlines;
image2d<bool> lines
= data::convert(bool(),
- scribo::extract::primitive::lines_v_discontinued(input,
+ scribo::primitive::extract::lines_v_discontinued(input,
c8(),
nlines,
atoi(argv[2]),
diff --git a/scribo/src/extract/primitive/extract_thick_hlines.cc b/scribo/src/extract/primitive/extract_thick_hlines.cc
index ae8cbd6..efa158a 100644
--- a/scribo/src/extract/primitive/extract_thick_hlines.cc
+++ b/scribo/src/extract/primitive/extract_thick_hlines.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/data/convert.hh>
-#include <scribo/extract/primitive/lines_h_thick.hh>
+#include <scribo/primitive/extract/lines_h_thick.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
value::label_16 nlines;
image2d<bool> lines
= data::convert(bool(),
- scribo::extract::primitive::lines_h_thick(input,
+ scribo::primitive::extract::lines_h_thick(input,
c8(),
nlines,
atoi(argv[2])));
diff --git a/scribo/src/extract/primitive/extract_thick_vlines.cc b/scribo/src/extract/primitive/extract_thick_vlines.cc
index 49bec1e..2a5f8ee 100644
--- a/scribo/src/extract/primitive/extract_thick_vlines.cc
+++ b/scribo/src/extract/primitive/extract_thick_vlines.cc
@@ -29,7 +29,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/data/convert.hh>
-#include <scribo/extract/primitive/lines_v_thick.hh>
+#include <scribo/primitive/extract/lines_v_thick.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
value::label_16 nlines;
image2d<bool> lines
= data::convert(bool(),
- scribo::extract::primitive::lines_v_thick(input,
+ scribo::primitive::extract::lines_v_thick(input,
c8(),
nlines,
atoi(argv[2])));
diff --git a/scribo/src/extract/primitive/find_discontinued_lines.cc b/scribo/src/extract/primitive/find_discontinued_lines.cc
index ac3725a..eaf2d59 100644
--- a/scribo/src/extract/primitive/find_discontinued_lines.cc
+++ b/scribo/src/extract/primitive/find_discontinued_lines.cc
@@ -35,8 +35,8 @@
#include <scribo/debug/usage.hh>
#include <scribo/core/object_image.hh>
-#include <scribo/extract/primitive/lines_h_pattern.hh>
-#include <scribo/extract/primitive/lines_v_pattern.hh>
+#include <scribo/primitive/extract/lines_h_pattern.hh>
+#include <scribo/primitive/extract/lines_v_pattern.hh>
const char *args_desc[][2] =
{
@@ -63,8 +63,8 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- I hlines = scribo::extract::primitive::lines_h_pattern(input, atoi(argv[2]));
- I vlines = scribo::extract::primitive::lines_v_pattern(input, atoi(argv[2]));
+ I hlines = scribo::primitive::extract::lines_h_pattern(input, atoi(argv[2]));
+ I vlines = scribo::primitive::extract::lines_v_pattern(input, atoi(argv[2]));
image2d<value::rgb8> out = debug::superpose(input, hlines, literal::red);
out = debug::superpose(out, vlines, literal::green);
diff --git a/scribo/src/extract/primitive/find_single_lines.cc b/scribo/src/extract/primitive/find_single_lines.cc
index bd7b559..afe518b 100644
--- a/scribo/src/extract/primitive/find_single_lines.cc
+++ b/scribo/src/extract/primitive/find_single_lines.cc
@@ -34,9 +34,9 @@
#include <scribo/debug/usage.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/extract/primitive/lines_h_single.hh>
-#include <scribo/extract/primitive/lines_v_single.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/lines_h_single.hh>
+#include <scribo/primitive/extract/lines_v_single.hh>
const char *args_desc[][2] =
{
@@ -71,16 +71,16 @@ int main(int argc, char *argv[])
value::label_16 nhlines;
object_image(L)
- objects = scribo::extract::primitive::objects(input, c8(), nhlines);
+ objects = scribo::primitive::extract::objects(input, c8(), nhlines);
object_image(L)
- hlines = scribo::extract::primitive::lines_h_single(objects,
+ hlines = scribo::primitive::extract::lines_h_single(objects,
atoi(argv[2]),
atof(argv[3]));
object_image(L)
- vlines = scribo::extract::primitive::lines_v_single(objects,
+ vlines = scribo::primitive::extract::lines_v_single(objects,
atoi(argv[4]),
atof(argv[5]));
diff --git a/scribo/src/extract/primitive/find_thick_lines.cc b/scribo/src/extract/primitive/find_thick_lines.cc
index ed5fb8c..993bf42 100644
--- a/scribo/src/extract/primitive/find_thick_lines.cc
+++ b/scribo/src/extract/primitive/find_thick_lines.cc
@@ -35,11 +35,11 @@
#include <scribo/debug/usage.hh>
#include <scribo/core/object_image.hh>
-#include <scribo/extract/primitive/lines_h_thick.hh>
-#include <scribo/extract/primitive/lines_v_thick.hh>
+#include <scribo/primitive/extract/lines_h_thick.hh>
+#include <scribo/primitive/extract/lines_v_thick.hh>
-#include <scribo/extract/primitive/lines_h_single.hh>
-#include <scribo/extract/primitive/lines_v_single.hh>
+#include <scribo/primitive/extract/lines_h_single.hh>
+#include <scribo/primitive/extract/lines_v_single.hh>
#include <mln/util/timer.hh>
@@ -85,20 +85,20 @@ int main(int argc, char *argv[])
t.start();
object_image(L)
- hlines = scribo::extract::primitive::lines_h_thick(input, c8(),
+ hlines = scribo::primitive::extract::lines_h_thick(input, c8(),
nhlines, atoi(argv[2])),
- vlines = scribo::extract::primitive::lines_v_thick(input, c8(),
+ vlines = scribo::primitive::extract::lines_v_thick(input, c8(),
nvlines, atoi(argv[2]));
std::cout << "lines thick done" << std::endl;
std::cout << t << std::endl;
t.restart();
- hlines = scribo::extract::primitive::lines_h_single(hlines,
+ hlines = scribo::primitive::extract::lines_h_single(hlines,
atoi(argv[2]),
10);
- vlines = scribo::extract::primitive::lines_v_single(vlines,
+ vlines = scribo::primitive::extract::lines_v_single(vlines,
atoi(argv[2]),
10);
diff --git a/scribo/src/filter/large_objects.cc b/scribo/src/filter/large_objects.cc
index 51ab029..d2e91c5 100644
--- a/scribo/src/filter/large_objects.cc
+++ b/scribo/src/filter/large_objects.cc
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
value::label_16 nobjects;
typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
obj_ima_t objects
- = scribo::extract::primitive::objects(input, c8(), nobjects);
+ = scribo::primitive::extract::objects(input, c8(), nobjects);
obj_ima_t filtered = scribo::filter::large_objects(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
diff --git a/scribo/src/filter/small_objects.cc b/scribo/src/filter/small_objects.cc
index fed6252..f9a318e 100644
--- a/scribo/src/filter/small_objects.cc
+++ b/scribo/src/filter/small_objects.cc
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
value::label_16 nobjects;
typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
obj_ima_t objects
- = scribo::extract::primitive::objects(input, c8(), nobjects);
+ = scribo::primitive::extract::objects(input, c8(), nobjects);
obj_ima_t filtered = scribo::filter::small_objects(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
diff --git a/scribo/src/filter/thick_objects.cc b/scribo/src/filter/thick_objects.cc
index 288402c..91fba14 100644
--- a/scribo/src/filter/thick_objects.cc
+++ b/scribo/src/filter/thick_objects.cc
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
value::label_16 nobjects;
typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
obj_ima_t objects
- = scribo::extract::primitive::objects(input, c8(), nobjects);
+ = scribo::primitive::extract::objects(input, c8(), nobjects);
obj_ima_t filtered = scribo::filter::thick_objects(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
diff --git a/scribo/src/filter/thin_objects.cc b/scribo/src/filter/thin_objects.cc
index 9129231..9da3981 100644
--- a/scribo/src/filter/thin_objects.cc
+++ b/scribo/src/filter/thin_objects.cc
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
value::label_16 nobjects;
typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
obj_ima_t objects
- = scribo::extract::primitive::objects(input, c8(), nobjects);
+ = scribo::primitive::extract::objects(input, c8(), nobjects);
obj_ima_t filtered = scribo::filter::thin_objects(objects, atoi(argv[2]));
io::pbm::save(data::convert(bool(), filtered), argv[3]);
diff --git a/scribo/src/recognition.cc b/scribo/src/recognition.cc
index 97f2880..f9ea901 100644
--- a/scribo/src/recognition.cc
+++ b/scribo/src/recognition.cc
@@ -36,11 +36,12 @@
#include <mln/core/alias/neighb2d.hh>
-#include <scribo/extract/primitive/objects.hh>
+#include <scribo/primitive/extract/objects.hh>
-#include <scribo/text/grouping/group_with_several_left_links.hh>
-#include <scribo/text/grouping/group_with_several_right_links.hh>
-#include <scribo/text/grouping/group_from_double_link.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_several_left_links.hh>
+#include <scribo/primitive/link/with_several_right_links.hh>
+#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/small_objects.hh>
#include <scribo/filter/thin_objects.hh>
#include <scribo/text/recognition.hh>
@@ -75,22 +76,24 @@ int main(int argc, char* argv[])
io::pbm::load(input, argv[1]);
/// Extract text.
- typedef mln_ch_value_(image2d<bool>,value::label_16) lbl_t;
+ typedef mln_ch_value_(image2d<bool>,value::label_16) L;
value::label_16 nbboxes;
- object_image(lbl_t)
- objects = scribo::extract::primitive::objects(input, c8(), nbboxes);
+ object_image(L)
+ objects = scribo::primitive::extract::objects(input, c8(), nbboxes);
/// Filter non interesting objects
objects = filter::small_objects(objects, 4);
- objects = filter::thin_objects<lbl_t>(objects, 2);
+ objects = filter::thin_objects<L>(objects, 2);
/// Group objects.
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_several_left_links<lbl_t>(objects, 30);
- mln::util::array<unsigned> right_link
- = text::grouping::group_with_several_right_links(objects, 30);
- objects = text::grouping::group_from_double_link(objects, left_link, right_link);
-
+ object_links<L> left_link
+ = primitive::link::with_several_left_links(objects, 30);
+ object_links<L> right_link
+ = primitive::link::with_several_right_links(objects, 30);
+ object_groups<L>
+ groups = primitive::group::from_double_link(objects, left_link, right_link);
+
+ objects = primitive::group::apply(objects, groups);
/// Try to recognize text in grouped objects.
scribo::text::recognition(objects, "fra", argv[2]);
diff --git a/scribo/src/table/erase.cc b/scribo/src/table/erase.cc
index 3cb441e..671296a 100644
--- a/scribo/src/table/erase.cc
+++ b/scribo/src/table/erase.cc
@@ -34,8 +34,8 @@
#include <scribo/table/erase.hh>
-#include <scribo/extract/primitive/lines_h_discontinued.hh>
-#include <scribo/extract/primitive/lines_v_discontinued.hh>
+#include <scribo/primitive/extract/lines_h_discontinued.hh>
+#include <scribo/primitive/extract/lines_v_discontinued.hh>
#include <scribo/debug/usage.hh>
@@ -70,10 +70,10 @@ int main(int argc, char* argv[])
label_16 nhlines, nvlines;
object_image(lbl_t)
- lbl_v = extract::primitive::lines_v_discontinued(input, c8(),
+ lbl_v = primitive::extract::lines_v_discontinued(input, c8(),
nvlines, 51, 8);
object_image(lbl_t)
- lbl_h = extract::primitive::lines_h_discontinued(input, c8(),
+ lbl_h = primitive::extract::lines_h_discontinued(input, c8(),
nhlines, 51, 6);
image2d<bool> input_notables
diff --git a/scribo/src/table_rebuild_opening.cc b/scribo/src/table_rebuild_opening.cc
index 8e12467..a13a00f 100644
--- a/scribo/src/table_rebuild_opening.cc
+++ b/scribo/src/table_rebuild_opening.cc
@@ -35,8 +35,8 @@
#include <scribo/table/rebuild.hh>
#include <scribo/table/erase.hh>
-#include <scribo/extract/primitive/lines_h_thick.hh>
-#include <scribo/extract/primitive/lines_v_thick.hh>
+#include <scribo/primitive/extract/lines_h_thick.hh>
+#include <scribo/primitive/extract/lines_v_thick.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -64,12 +64,12 @@ int main(int argc, char* argv[])
value::label_16 nbboxes;
lines_t hlines
- = scribo::extract::primitive::lines_h_thick(input,
+ = scribo::primitive::extract::lines_h_thick(input,
c8(),
nbboxes,
51);
lines_t vlines
- = scribo::extract::primitive::lines_v_thick(input,
+ = scribo::primitive::extract::lines_v_thick(input,
c8(),
nbboxes,
51);
diff --git a/scribo/src/table_rebuild_rank.cc b/scribo/src/table_rebuild_rank.cc
index 5e0d339..1c6b921 100644
--- a/scribo/src/table_rebuild_rank.cc
+++ b/scribo/src/table_rebuild_rank.cc
@@ -37,8 +37,8 @@
#include <scribo/table/rebuild.hh>
#include <scribo/table/erase.hh>
-#include <scribo/extract/primitive/lines_h_discontinued.hh>
-#include <scribo/extract/primitive/lines_v_discontinued.hh>
+#include <scribo/primitive/extract/lines_h_discontinued.hh>
+#include <scribo/primitive/extract/lines_v_discontinued.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -66,13 +66,13 @@ int main(int argc, char* argv[])
value::label_16 nbboxes;
lines_t hlines
- = scribo::extract::primitive::lines_h_discontinued(input,
+ = scribo::primitive::extract::lines_h_discontinued(input,
c8(),
nbboxes,
51,
6);
lines_t vlines
- = scribo::extract::primitive::lines_v_discontinued(input,
+ = scribo::primitive::extract::lines_v_discontinued(input,
c8(),
nbboxes,
51,
diff --git a/scribo/src/text/grouping/group_from_double_link.cc b/scribo/src/text/grouping/group_from_double_link.cc
index aa47ac6..bcd768f 100644
--- a/scribo/src/text/grouping/group_from_double_link.cc
+++ b/scribo/src/text/grouping/group_from_double_link.cc
@@ -32,14 +32,17 @@
#include <mln/literal/colors.hh>
#include <mln/io/pbm/load.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/label_16.hh>
+#include <scribo/core/object_links.hh>
#include <scribo/core/object_image.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_single_left_link.hh>
-#include <scribo/text/grouping/group_with_single_right_link.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
-#include <scribo/text/grouping/group_from_double_link.hh>
+#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/small_objects.hh>
#include <scribo/debug/save_bboxes_image.hh>
@@ -77,15 +80,16 @@ int main(int argc, char *argv[])
io::pbm::load(input, argv[1]);
value::label_16 nbboxes;
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = extract::primitive::objects(input, c8(), nbboxes);
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+ text_t text = primitive::extract::objects(input, c8(), nbboxes);
text = filter::small_objects(text, 4);
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_single_left_link(text, atoi(argv[2]));
- mln::util::array<unsigned> right_link
- = text::grouping::group_with_single_right_link(text, atoi(argv[3]));
+ object_links<L> left_link
+ = primitive::link::with_single_left_link(text, atoi(argv[2]));
+ object_links<L> right_link
+ = primitive::link::with_single_right_link(text, atoi(argv[3]));
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
@@ -110,8 +114,10 @@ int main(int argc, char *argv[])
// scribo::make::debug_filename("lbl_before.ppm"));
// With validation.
- text_t grouped_text
- = text::grouping::group_from_double_link(text, left_link, right_link);
+ object_groups<L> groups
+ = primitive::group::from_double_link(text, left_link, right_link);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
io::ppm::save(mln::labeling::colorize(value::rgb8(),
grouped_text,
diff --git a/scribo/src/text/grouping/group_from_double_several_links.cc b/scribo/src/text/grouping/group_from_double_several_links.cc
index e22239d..de9eb20 100644
--- a/scribo/src/text/grouping/group_from_double_several_links.cc
+++ b/scribo/src/text/grouping/group_from_double_several_links.cc
@@ -34,14 +34,14 @@
#include <mln/io/ppm/save.hh>
#include <mln/literal/colors.hh>
-#include <mln/util/timer.hh>
#include <mln/util/array.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_several_left_links.hh>
-#include <scribo/text/grouping/group_with_several_right_links.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_several_left_links.hh>
+#include <scribo/primitive/link/with_several_right_links.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
-#include <scribo/text/grouping/group_from_double_link.hh>
+#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/small_objects.hh>
#include <scribo/debug/save_bboxes_image.hh>
@@ -64,40 +64,27 @@ int main(int argc, char* argv[])
scribo::make::internal::debug_filename_prefix = "group_with_double_several_links";
- mln::util::timer t, t2;
image2d<bool> input;
- std::cout << "Loading" << std::endl;
- t.start();
io::pbm::load(input, argv[1]);
- std::cout << t << std::endl;
value::label_16 nbboxes;
+ typedef image2d<value::label_16> L;
std::cout << "extract bboxes" << std::endl;
- t.restart();
- t2.start();
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = scribo::extract::primitive::objects(input, c8(), nbboxes);
- std::cout << t << std::endl;
+ typedef object_image(L) text_t;
+ text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
+
- mln::util::timer t3;
std::cout << "Remove small components" << std::endl;
- t.restart();
- t3.start();
text = filter::small_objects(text,4);
- std::cout << t << std::endl;
std::cout << "Group with left link" << std::endl;
- t.restart();
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_several_left_links(text, 30);
- std::cout << t << std::endl;
+ object_links<L> left_link
+ = primitive::link::with_several_left_links(text, 30);
std::cout << "Group with right link" << std::endl;
- t.restart();
- mln::util::array<unsigned> right_link
- = text::grouping::group_with_several_right_links(text, 30);
- std::cout << t << std::endl;
+ object_links<L> right_link
+ = primitive::link::with_several_right_links(text, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
@@ -109,12 +96,11 @@ int main(int argc, char* argv[])
// With validation.
std::cout << "Group from double link" << std::endl;
- t.restart();
- text_t grouped_text
- = text::grouping::group_from_double_link(text, left_link, right_link);
- std::cout << t << std::endl;
- std::cout << "Full process: " << t2 << std::endl;
- std::cout << "Cleanup and grouping process: " << t3 << std::endl;
+
+ object_groups<L> groups
+ = primitive::group::from_double_link(text, left_link, right_link);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
io::ppm::save(mln::labeling::colorize(value::rgb8(),
grouped_text,
diff --git a/scribo/src/text/grouping/group_from_graph.cc b/scribo/src/text/grouping/group_from_graph.cc
index de98ff9..8b99c1b 100644
--- a/scribo/src/text/grouping/group_from_graph.cc
+++ b/scribo/src/text/grouping/group_from_graph.cc
@@ -33,9 +33,10 @@
#include <mln/literal/colors.hh>
#include <mln/labeling/colorize.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_graph.hh>
-#include <scribo/text/grouping/group_from_graph.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/link/with_graph.hh>
+#include <scribo/primitive/group/from_graph.hh>
+#include <scribo/primitive/group/apply.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
@@ -61,10 +62,11 @@ int main(int argc, char* argv[])
io::pbm::load(input, argv[1]);
value::label_16 nbboxes;
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = extract::primitive::objects(input, c8(), nbboxes);
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+ text_t text = primitive::extract::objects(input, c8(), nbboxes);
- mln::util::graph g = text::grouping::group_with_graph(text, 30);
+ mln::util::graph g = primitive::link::with_graph(text, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes.next() << std::endl;
scribo::debug::save_linked_bboxes_image(input,
@@ -76,8 +78,10 @@ int main(int argc, char* argv[])
// text.nlabels()),
// scribo::make::debug_filename("lbl_before.ppm"));
- text_t grouped_text
- = text::grouping::group_from_graph(text, g);
+ object_groups<L> groups
+ = primitive::group::from_graph(text, g);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
std::cout << "AFTER - nbboxes = " << grouped_text.bboxes().nelements() << std::endl;
diff --git a/scribo/src/text/grouping/group_from_rag.cc b/scribo/src/text/grouping/group_from_rag.cc
index 944624c..5bc8b86 100644
--- a/scribo/src/text/grouping/group_from_rag.cc
+++ b/scribo/src/text/grouping/group_from_rag.cc
@@ -44,9 +44,9 @@
#include <mln/util/graph.hh>
#include <mln/accu/center.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_rag.hh>
-//#include <scribo/text/grouping/group_from_rag.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/link/with_rag.hh>
+//#include <scribo/primitive/group/from_rag.hh>
#include <scribo/filter/small_objects.hh>
#include <scribo/filter/thin_objects.hh>
@@ -173,7 +173,7 @@ int main(int argc, char* argv[])
typedef image2d<value::label_16> L;
value::label_16 nbboxes;
typedef object_image(L) objects_t;
- objects_t objects = extract::primitive::objects(input, c8(), nbboxes);
+ objects_t objects = primitive::extract::objects(input, c8(), nbboxes);
/// First filtering.
objects_t filtered_objects
@@ -188,7 +188,7 @@ int main(int argc, char* argv[])
/// Getting objects links from a Region Adjacency graph.
- mln_VAR(rag_data, text::grouping::group_with_rag(filtered_objects, c8()));
+ mln_VAR(rag_data, primitive::link::with_rag(filtered_objects, c8()));
mln_VAR(v_ima, scribo::graph::compute_vertex(accu::center<point2d>(),
diff --git a/scribo/src/text/grouping/group_from_several_graph.cc b/scribo/src/text/grouping/group_from_several_graph.cc
index 1db26a7..946e80f 100644
--- a/scribo/src/text/grouping/group_from_several_graph.cc
+++ b/scribo/src/text/grouping/group_from_several_graph.cc
@@ -39,9 +39,11 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_several_graphes.hh>
-#include <scribo/text/grouping/group_from_graph.hh>
+#include <scribo/core/object_groups.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/link/with_several_graphes.hh>
+#include <scribo/primitive/group/from_graph.hh>
+#include <scribo/primitive/group/apply.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
@@ -67,10 +69,11 @@ int main(int argc, char* argv[])
io::pbm::load(input, argv[1]);
value::label_16 nbboxes;
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = scribo::extract::primitive::objects(input, c8(), nbboxes);
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+ text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
- mln::util::graph g = text::grouping::group_with_several_graphes(text, 30);
+ mln::util::graph g = primitive::link::with_several_graphes(text, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes.next() << std::endl;
scribo::debug::save_linked_bboxes_image(input,
@@ -78,7 +81,9 @@ int main(int argc, char* argv[])
literal::red, literal::cyan,
scribo::make::debug_filename("left_linked.ppm"));
- text_t grouped_text = text::grouping::group_from_graph(text, g);
+ object_groups<L> groups = primitive::group::from_graph(text, g);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
std::cout << "AFTER - nbboxes = " << grouped_text.bboxes().nelements() << std::endl;
diff --git a/scribo/src/text/grouping/group_from_several_left_links.cc b/scribo/src/text/grouping/group_from_several_left_links.cc
index cdc65ae..a153e0c 100644
--- a/scribo/src/text/grouping/group_from_several_left_links.cc
+++ b/scribo/src/text/grouping/group_from_several_left_links.cc
@@ -40,9 +40,10 @@
#include <mln/io/ppm/save.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_several_left_links.hh>
-#include <scribo/text/grouping/group_from_single_link.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_several_left_links.hh>
+#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
@@ -68,13 +69,14 @@ int main(int argc, char* argv[])
io::pbm::load(input, argv[1]);
value::label_16 nbboxes;
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = scribo::extract::primitive::objects(input, c8(), nbboxes);
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+ text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
{
std::cout << "* Left grouping" << std::endl;
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_several_left_links(text, 30);
+ object_links<L> left_link
+ = primitive::link::with_several_left_links(text, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
scribo::debug::save_linked_bboxes_image(input,
@@ -82,9 +84,11 @@ int main(int argc, char* argv[])
literal::red, literal::cyan,
scribo::make::debug_filename("left_links.ppm"));
- text_t grouped_text
- = text::grouping::group_from_single_link(text, left_link);
+ object_groups<L>
+ groups = primitive::group::from_single_link(text, left_link);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
std::cout << "AFTER - nbboxes = " << grouped_text.bboxes().nelements() << std::endl;
io::ppm::save(mln::labeling::colorize(value::rgb8(),
grouped_text,
diff --git a/scribo/src/text/grouping/group_from_single_link.cc b/scribo/src/text/grouping/group_from_single_link.cc
index 58a7f2f..f408d66 100644
--- a/scribo/src/text/grouping/group_from_single_link.cc
+++ b/scribo/src/text/grouping/group_from_single_link.cc
@@ -37,10 +37,11 @@
#include <mln/io/pbm/load.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_single_left_link.hh>
-#include <scribo/text/grouping/group_with_single_right_link.hh>
-#include <scribo/text/grouping/group_from_single_link.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/link/with_single_right_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/primitive/group/apply.hh>
#include <scribo/debug/save_bboxes_image.hh>
#include <scribo/debug/save_linked_bboxes_image.hh>
@@ -68,13 +69,14 @@ int main(int argc, char* argv[])
io::pbm::load(input, argv[1]);
value::label_16 nbboxes;
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = scribo::extract::primitive::objects(input, c8(), nbboxes);
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+ text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
{
std::cout << "* Left grouping" << std::endl;
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_single_left_link(text, 30);
+ object_links<L> left_link
+ = primitive::link::with_single_left_link(text, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
scribo::debug::save_linked_bboxes_image(input,
@@ -86,8 +88,10 @@ int main(int argc, char* argv[])
// text.nlabels()),
// scribo::make::debug_filename("lbl_before.ppm"));
- text_t grouped_text
- = text::grouping::group_from_single_link(text, left_link);
+ object_groups<L>
+ groups = primitive::group::from_single_link(text, left_link);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
std::cout << "AFTER - nbboxes = " << grouped_text.bboxes().nelements() << std::endl;
io::ppm::save(mln::labeling::colorize(value::rgb8(),
@@ -101,8 +105,8 @@ int main(int argc, char* argv[])
{
std::cout << "* Left grouping" << std::endl;
- mln::util::array<unsigned> right_link
- = text::grouping::group_with_single_right_link(text, 30);
+ object_links<L> right_link
+ = primitive::link::with_single_right_link(text, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
scribo::debug::save_linked_bboxes_image(input,
@@ -114,8 +118,10 @@ int main(int argc, char* argv[])
// text.nlabels()),
// scribo::make::debug_filename("lbl_before.ppm"));
- text_t grouped_text
- = text::grouping::group_from_single_link(text, right_link);
+ object_groups<L>
+ groups = primitive::group::from_single_link(text, right_link);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
io::ppm::save(mln::labeling::colorize(value::rgb8(),
grouped_text,
diff --git a/scribo/src/text_in_photo.cc b/scribo/src/text_in_photo.cc
index d51ba37..b18825e 100644
--- a/scribo/src/text_in_photo.cc
+++ b/scribo/src/text_in_photo.cc
@@ -38,15 +38,16 @@
#include <mln/literal/colors.hh>
#include <mln/value/rgb8.hh>
+#include <mln/value/label_16.hh>
#include <mln/draw/box.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_single_left_link.hh>
-#include <scribo/text/grouping/group_with_single_right_link.hh>
-#include <scribo/text/grouping/group_from_double_link.hh>
-#include <scribo/text/grouping/group_from_single_link.hh>
-#include <scribo/text/grouping/internal/have_link_valid.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/link/with_single_right_link.hh>
+#include <scribo/primitive/group/from_double_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/small_objects.hh>
#include <scribo/filter/thin_objects.hh>
#include <scribo/filter/thick_objects.hh>
@@ -91,7 +92,7 @@ highlighted.");
/// Finding objects.
value::label_16 nobjects;
object_image(L)
- objects = scribo::extract::primitive::objects(input, c8(), nobjects);
+ objects = scribo::primitive::extract::objects(input, c8(), nobjects);
/// First filtering.
@@ -106,10 +107,10 @@ highlighted.");
math::min(input.ncols(), input.nrows()) / 5);
/// Grouping potential objects
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_single_left_link(filtered_objects, 30);
- mln::util::array<unsigned> right_link
- = text::grouping::group_with_single_right_link(filtered_objects, 30);
+ object_links<L> left_link
+ = primitive::link::with_single_left_link(filtered_objects, 30);
+ object_links<L> right_link
+ = primitive::link::with_single_right_link(filtered_objects, 30);
#ifndef NOUT
@@ -124,14 +125,13 @@ highlighted.");
#endif
// Trying to group objects
- mln::util::array<unsigned> parent_link;
- text::grouping::group_from_double_link(filtered_objects,
- left_link, right_link,
- parent_link);
+ object_groups<L>
+ groups = primitive::group::from_double_link(filtered_objects,
+ left_link, right_link);
// Remove objects part of groups with less than 3 objects.
mln::util::array<bool>
- to_be_kept = filter::small_object_groups(parent_link, 3);
+ to_be_kept = filter::small_object_groups(groups, 3);
// FOR DEBUGGING PURPOSE.
@@ -155,17 +155,19 @@ highlighted.");
/// This time a single link is enough since non-wanted objects have
/// been removed.
left_link
- = text::grouping::group_with_single_left_link(filtered_objects, 30);
+ = primitive::link::with_single_left_link(filtered_objects, 30);
/// Grouping objects again.
- object_image(L) grouped_objects
- = text::grouping::group_from_single_link(filtered_objects, left_link);
+ groups = primitive::group::from_single_link(filtered_objects, left_link);
+
+ object_image(L)
+ grouped_objects = primitive::group::apply(filtered_objects, groups);
#ifndef NOUT
/// FOR DEBUG PURPOSE.
- for (unsigned i = 1; i < grouped_objects.nlabels(); ++i)
+ for (unsigned i = 1; i <= grouped_objects.nlabels(); ++i)
mln::draw::box(decision_image, grouped_objects.bbox(i), literal::blue);
io::ppm::save(decision_image, scribo::make::debug_filename("decision_image.ppm"));
diff --git a/scribo/table/extract.hh b/scribo/table/extract.hh
index a553ccc..2e652d2 100644
--- a/scribo/table/extract.hh
+++ b/scribo/table/extract.hh
@@ -41,9 +41,9 @@
# include <scribo/core/object_image.hh>
# include <scribo/table/rebuild.hh>
# include <scribo/table/erase.hh>
-# include <scribo/extract/primitive/lines_h_pattern.hh>
-# include <scribo/extract/primitive/lines_v_pattern.hh>
-# include <scribo/extract/primitive/objects.hh>
+# include <scribo/primitive/extract/lines_h_pattern.hh>
+# include <scribo/primitive/extract/lines_v_pattern.hh>
+# include <scribo/primitive/extract/objects.hh>
# include <scribo/debug/save_bboxes_image.hh>
@@ -87,13 +87,13 @@ namespace scribo
mlc_equal(mln_value(I), bool)::check();
image2d<bool>
- bhlines = scribo::extract::primitive::lines_h_pattern(input, 51),
- bvlines = scribo::extract::primitive::lines_v_pattern(input, 51);
+ bhlines = scribo::primitive::extract::lines_h_pattern(input, 51),
+ bvlines = scribo::primitive::extract::lines_v_pattern(input, 51);
V nhlines, nvlines;
object_image(mln_ch_value(I,V))
- hlines = scribo::extract::primitive::objects(bhlines, c8(), nhlines),
- vlines = scribo::extract::primitive::objects(bvlines, c8(), nvlines);
+ hlines = scribo::primitive::extract::objects(bhlines, c8(), nhlines),
+ vlines = scribo::primitive::extract::objects(bvlines, c8(), nvlines);
typedef mln::util::couple<mln_ch_value(I,V),
mln::util::couple<mln::util::array<box<mln_site(I)> >,
diff --git a/scribo/table/internal/repair_lines.hh b/scribo/table/internal/repair_lines.hh
index 7c307e8..f197979 100644
--- a/scribo/table/internal/repair_lines.hh
+++ b/scribo/table/internal/repair_lines.hh
@@ -74,6 +74,8 @@ namespace scribo
namespace internal
{
+ using namespace mln;
+
/// Repair lines which have small discontinuities.
/// FIXME: buggy. Sometimes few lines move or shrink!
///
@@ -127,7 +129,7 @@ namespace scribo
typedef
extension_ima<
const image_if<L,
- fun::neq_v2b_expr_<pw::value_<L>,
+ mln::fun::neq_v2b_expr_<pw::value_<L>,
pw::cst_<literal::zero_t> > >, const L> tbb_ima_t;
tbb_ima_t tbb_ima = extend(l | (pw::value(l) != pw::cst(literal::zero)), l);
diff --git a/scribo/tests/filter/small_and_large_bboxes.cc b/scribo/tests/filter/small_and_large_bboxes.cc
index 38aa85e..2d765df 100644
--- a/scribo/tests/filter/small_and_large_bboxes.cc
+++ b/scribo/tests/filter/small_and_large_bboxes.cc
@@ -34,9 +34,10 @@
#include <scribo/core/object_image.hh>
-#include <scribo/extract/primitive/objects.hh>
-#include <scribo/text/grouping/group_with_graph.hh>
-#include <scribo/text/grouping/group_from_graph.hh>
+#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/group/apply.hh>
+#include <scribo/primitive/link/with_graph.hh>
+#include <scribo/primitive/group/from_graph.hh>
#include <scribo/filter/small_objects.hh>
#include <scribo/util/text.hh>
@@ -72,10 +73,11 @@ int main(int argc, char* argv[])
io::pbm::load(input, img.c_str());
value::label_16 nbboxes;
- typedef object_image(image2d<value::label_16>) text_t;
- text_t text = extract::primitive::objects(input, c8(), nbboxes);
+ typedef image2d<value::label_16> L;
+ typedef object_image(L) text_t;
+ text_t text = primitive::extract::objects(input, c8(), nbboxes);
- mln::util::graph g = text::grouping::group_with_graph(text, 30);
+ mln::util::graph g = primitive::link::with_graph(text, 30);
mln_assertion(nbboxes == 12u);
@@ -85,21 +87,21 @@ int main(int argc, char* argv[])
// literal::red, literal::cyan,
// "test_graph_left_linked.ppm");
- text_t grouped_text
- = text::grouping::group_from_graph(text, g);
+ object_groups<L> groups = primitive::group::from_graph(text, g);
+ text_t grouped_text = primitive::group::apply(text, groups);
// std::cout << "AFTER - nbboxes = " << grouped_text.nbboxes().next() << std::endl;
//
// scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
// literal::red,
// "test_graph_grouped_text.ppm");
- mln_assertion(grouped_text.nbboxes() == 6u);
+ mln_assertion(grouped_text.nlabels() == 6u);
text_t
filtered_text = scribo::filter::small_objects(grouped_text, 20);
- mln_assertion(filtered_text.nbboxes() == 2u);
+ mln_assertion(filtered_text.nlabels() == 2u);
// scribo::debug::save_bboxes_image(input, filtered_text.bboxes(),
// literal::red,
diff --git a/scribo/tests/table/extract_lines_with_rank.cc b/scribo/tests/table/extract_lines_with_rank.cc
index 4ff6d89..e7f13df 100644
--- a/scribo/tests/table/extract_lines_with_rank.cc
+++ b/scribo/tests/table/extract_lines_with_rank.cc
@@ -38,10 +38,8 @@
#include <mln/io/pgm/save.hh>
-#include <scribo/extract/primitive/lines_h_discontinued.hh>
-#include <scribo/extract/primitive/lines_v_discontinued.hh>
-
-#include <scribo/debug/save_table_image.hh>
+#include <scribo/primitive/extract/lines_h_discontinued.hh>
+#include <scribo/primitive/extract/lines_v_discontinued.hh>
#include <scribo/tests/data.hh>
@@ -76,11 +74,16 @@ int main(int argc, char *argv[])
typedef object_image(image2d<value::label_8>) lbl_t;
lbl_t
- hlbl = scribo::extract::primitive::lines_h_discontinued(input, c8(),
+ hlbl = scribo::primitive::extract::lines_h_discontinued(input, c8(),
nbboxes, 11, 2);
lbl_t
- vlbl = scribo::extract::primitive::lines_v_discontinued(input, c8(),
+ vlbl = scribo::primitive::extract::lines_v_discontinued(input, c8(),
nbboxes, 11, 2);
+
+ // Background values are meaningless, we set them to an arbitrary value.
+ hboxes(0) = hlbl.bbox(0);
+ vboxes(0) = vlbl.bbox(0);
+
mln_assertion(hlbl.bboxes() == hboxes);
mln_assertion(vlbl.bboxes() == vboxes);
}
diff --git a/scribo/tests/unit_test/unit-tests.mk b/scribo/tests/unit_test/unit-tests.mk
index 6fdb4d8..237581f 100644
--- a/scribo/tests/unit_test/unit-tests.mk
+++ b/scribo/tests/unit_test/unit-tests.mk
@@ -7,7 +7,9 @@ scribo_core_all \
scribo_core_central_sites \
scribo_core_erase_objects \
scribo_core_macros \
+scribo_core_object_groups \
scribo_core_object_image \
+scribo_core_object_links \
scribo_debug_all \
scribo_debug_save_bboxes_image \
scribo_debug_save_label_image \
@@ -17,29 +19,62 @@ scribo_debug_usage \
scribo_draw_all \
scribo_draw_bounding_box_links \
scribo_draw_bounding_boxes \
-scribo_extract_primitive_canvas \
-scribo_extract_primitive_cells \
-scribo_extract_primitive_lines_discontinued \
-scribo_extract_primitive_lines_h_discontinued \
-scribo_extract_primitive_lines_h_pattern \
-scribo_extract_primitive_lines_h_thick \
-scribo_extract_primitive_lines_pattern \
-scribo_extract_primitive_lines_thick \
-scribo_extract_primitive_lines_v_discontinued \
-scribo_extract_primitive_lines_v_pattern \
-scribo_extract_primitive_lines_v_thick \
-scribo_extract_primitive_objects \
scribo_filter_all \
scribo_filter_large_objects \
+scribo_filter_small_object_groups \
scribo_filter_small_objects \
scribo_filter_thick_objects \
scribo_filter_thin_objects \
+scribo_fun_v2b_small_objects_filter \
scribo_make_all \
scribo_make_debug_filename \
scribo_make_influence_zone_graph \
scribo_make_text \
scribo_preprocessing_all \
scribo_preprocessing_unskew \
+scribo_primitive_all \
+scribo_primitive_extract_all \
+scribo_primitive_extract_canvas \
+scribo_primitive_extract_cells \
+scribo_primitive_extract_lines_discontinued \
+scribo_primitive_extract_lines_h_discontinued \
+scribo_primitive_extract_lines_h_pattern \
+scribo_primitive_extract_lines_h_single \
+scribo_primitive_extract_lines_h_thick \
+scribo_primitive_extract_lines_pattern \
+scribo_primitive_extract_lines_thick \
+scribo_primitive_extract_lines_v_discontinued \
+scribo_primitive_extract_lines_v_pattern \
+scribo_primitive_extract_lines_v_single \
+scribo_primitive_extract_lines_v_thick \
+scribo_primitive_extract_objects \
+scribo_primitive_group_all \
+scribo_primitive_group_apply \
+scribo_primitive_group_filter_non_aligned \
+scribo_primitive_group_filter_non_h_aligned \
+scribo_primitive_group_filter_non_v_aligned \
+scribo_primitive_group_from_double_link \
+scribo_primitive_group_from_graph \
+scribo_primitive_group_from_single_link \
+scribo_primitive_internal_all \
+scribo_primitive_internal_find_graph_link \
+scribo_primitive_internal_find_left_link \
+scribo_primitive_internal_find_right_link \
+scribo_primitive_internal_find_root \
+scribo_primitive_internal_have_link_valid \
+scribo_primitive_internal_init_link_array \
+scribo_primitive_internal_is_link_valid \
+scribo_primitive_internal_update_graph_link \
+scribo_primitive_internal_update_link_array \
+scribo_primitive_link_all \
+scribo_primitive_link_merge_double_link \
+scribo_primitive_link_with_graph \
+scribo_primitive_link_with_rag \
+scribo_primitive_link_with_several_graphes \
+scribo_primitive_link_with_several_left_links \
+scribo_primitive_link_with_several_right_links \
+scribo_primitive_link_with_single_left_link \
+scribo_primitive_link_with_single_right_link \
scribo_table_align_lines_horizontaly \
scribo_table_align_lines_verticaly \
scribo_table_all \
@@ -57,25 +92,6 @@ scribo_table_repair_vertical_lines \
scribo_text_all \
scribo_text_clean \
scribo_text_extract_lines \
-scribo_text_grouping_all \
-scribo_text_grouping_group_from_double_link \
-scribo_text_grouping_group_from_graph \
-scribo_text_grouping_group_from_single_link \
-scribo_text_grouping_group_with_graph \
-scribo_text_grouping_group_with_several_graphes \
-scribo_text_grouping_group_with_several_left_links \
-scribo_text_grouping_group_with_several_right_links \
-scribo_text_grouping_group_with_single_left_link \
-scribo_text_grouping_group_with_single_right_link \
-scribo_text_grouping_internal_all \
-scribo_text_grouping_internal_find_graph_link \
-scribo_text_grouping_internal_find_left_link \
-scribo_text_grouping_internal_find_right_link \
-scribo_text_grouping_internal_find_root \
-scribo_text_grouping_internal_init_link_array \
-scribo_text_grouping_internal_is_link_valid \
-scribo_text_grouping_internal_update_graph_link \
-scribo_text_grouping_internal_update_link_array \
scribo_util_all \
scribo_util_text
@@ -85,7 +101,9 @@ scribo_core_all_SOURCES = scribo_core_all.cc
scribo_core_central_sites_SOURCES = scribo_core_central_sites.cc
scribo_core_erase_objects_SOURCES = scribo_core_erase_objects.cc
scribo_core_macros_SOURCES = scribo_core_macros.cc
+scribo_core_object_groups_SOURCES = scribo_core_object_groups.cc
scribo_core_object_image_SOURCES = scribo_core_object_image.cc
+scribo_core_object_links_SOURCES = scribo_core_object_links.cc
scribo_debug_all_SOURCES = scribo_debug_all.cc
scribo_debug_save_bboxes_image_SOURCES = scribo_debug_save_bboxes_image.cc
scribo_debug_save_label_image_SOURCES = scribo_debug_save_label_image.cc
@@ -95,29 +113,62 @@ scribo_debug_usage_SOURCES = scribo_debug_usage.cc
scribo_draw_all_SOURCES = scribo_draw_all.cc
scribo_draw_bounding_box_links_SOURCES = scribo_draw_bounding_box_links.cc
scribo_draw_bounding_boxes_SOURCES = scribo_draw_bounding_boxes.cc
-scribo_extract_primitive_canvas_SOURCES = scribo_extract_primitive_canvas.cc
-scribo_extract_primitive_cells_SOURCES = scribo_extract_primitive_cells.cc
-scribo_extract_primitive_lines_discontinued_SOURCES = scribo_extract_primitive_lines_discontinued.cc
-scribo_extract_primitive_lines_h_discontinued_SOURCES = scribo_extract_primitive_lines_h_discontinued.cc
-scribo_extract_primitive_lines_h_pattern_SOURCES = scribo_extract_primitive_lines_h_pattern.cc
-scribo_extract_primitive_lines_h_thick_SOURCES = scribo_extract_primitive_lines_h_thick.cc
-scribo_extract_primitive_lines_pattern_SOURCES = scribo_extract_primitive_lines_pattern.cc
-scribo_extract_primitive_lines_thick_SOURCES = scribo_extract_primitive_lines_thick.cc
-scribo_extract_primitive_lines_v_discontinued_SOURCES = scribo_extract_primitive_lines_v_discontinued.cc
-scribo_extract_primitive_lines_v_pattern_SOURCES = scribo_extract_primitive_lines_v_pattern.cc
-scribo_extract_primitive_lines_v_thick_SOURCES = scribo_extract_primitive_lines_v_thick.cc
-scribo_extract_primitive_objects_SOURCES = scribo_extract_primitive_objects.cc
scribo_filter_all_SOURCES = scribo_filter_all.cc
scribo_filter_large_objects_SOURCES = scribo_filter_large_objects.cc
+scribo_filter_small_object_groups_SOURCES = scribo_filter_small_object_groups.cc
scribo_filter_small_objects_SOURCES = scribo_filter_small_objects.cc
scribo_filter_thick_objects_SOURCES = scribo_filter_thick_objects.cc
scribo_filter_thin_objects_SOURCES = scribo_filter_thin_objects.cc
+scribo_fun_v2b_small_objects_filter_SOURCES = scribo_fun_v2b_small_objects_filter.cc
scribo_make_all_SOURCES = scribo_make_all.cc
scribo_make_debug_filename_SOURCES = scribo_make_debug_filename.cc
scribo_make_influence_zone_graph_SOURCES = scribo_make_influence_zone_graph.cc
scribo_make_text_SOURCES = scribo_make_text.cc
scribo_preprocessing_all_SOURCES = scribo_preprocessing_all.cc
scribo_preprocessing_unskew_SOURCES = scribo_preprocessing_unskew.cc
+scribo_primitive_all_SOURCES = scribo_primitive_all.cc
+scribo_primitive_extract_all_SOURCES = scribo_primitive_extract_all.cc
+scribo_primitive_extract_canvas_SOURCES = scribo_primitive_extract_canvas.cc
+scribo_primitive_extract_cells_SOURCES = scribo_primitive_extract_cells.cc
+scribo_primitive_extract_lines_discontinued_SOURCES = scribo_primitive_extract_lines_discontinued.cc
+scribo_primitive_extract_lines_h_discontinued_SOURCES = scribo_primitive_extract_lines_h_discontinued.cc
+scribo_primitive_extract_lines_h_pattern_SOURCES = scribo_primitive_extract_lines_h_pattern.cc
+scribo_primitive_extract_lines_h_single_SOURCES = scribo_primitive_extract_lines_h_single.cc
+scribo_primitive_extract_lines_h_thick_SOURCES = scribo_primitive_extract_lines_h_thick.cc
+scribo_primitive_extract_lines_pattern_SOURCES = scribo_primitive_extract_lines_pattern.cc
+scribo_primitive_extract_lines_thick_SOURCES = scribo_primitive_extract_lines_thick.cc
+scribo_primitive_extract_lines_v_discontinued_SOURCES = scribo_primitive_extract_lines_v_discontinued.cc
+scribo_primitive_extract_lines_v_pattern_SOURCES = scribo_primitive_extract_lines_v_pattern.cc
+scribo_primitive_extract_lines_v_single_SOURCES = scribo_primitive_extract_lines_v_single.cc
+scribo_primitive_extract_lines_v_thick_SOURCES = scribo_primitive_extract_lines_v_thick.cc
+scribo_primitive_extract_objects_SOURCES = scribo_primitive_extract_objects.cc
+scribo_primitive_group_all_SOURCES = scribo_primitive_group_all.cc
+scribo_primitive_group_apply_SOURCES = scribo_primitive_group_apply.cc
+scribo_primitive_group_filter_non_aligned_SOURCES = scribo_primitive_group_filter_non_aligned.cc
+scribo_primitive_group_filter_non_h_aligned_SOURCES = scribo_primitive_group_filter_non_h_aligned.cc
+scribo_primitive_group_filter_non_v_aligned_SOURCES = scribo_primitive_group_filter_non_v_aligned.cc
+scribo_primitive_group_from_double_link_SOURCES = scribo_primitive_group_from_double_link.cc
+scribo_primitive_group_from_graph_SOURCES = scribo_primitive_group_from_graph.cc
+scribo_primitive_group_from_single_link_SOURCES = scribo_primitive_group_from_single_link.cc
+scribo_primitive_internal_all_SOURCES = scribo_primitive_internal_all.cc
+scribo_primitive_internal_find_graph_link_SOURCES = scribo_primitive_internal_find_graph_link.cc
+scribo_primitive_internal_find_left_link_SOURCES = scribo_primitive_internal_find_left_link.cc
+scribo_primitive_internal_find_right_link_SOURCES = scribo_primitive_internal_find_right_link.cc
+scribo_primitive_internal_find_root_SOURCES = scribo_primitive_internal_find_root.cc
+scribo_primitive_internal_have_link_valid_SOURCES = scribo_primitive_internal_have_link_valid.cc
+scribo_primitive_internal_init_link_array_SOURCES = scribo_primitive_internal_init_link_array.cc
+scribo_primitive_internal_is_link_valid_SOURCES = scribo_primitive_internal_is_link_valid.cc
+scribo_primitive_internal_update_graph_link_SOURCES = scribo_primitive_internal_update_graph_link.cc
+scribo_primitive_internal_update_link_array_SOURCES = scribo_primitive_internal_update_link_array.cc
+scribo_primitive_link_all_SOURCES = scribo_primitive_link_all.cc
+scribo_primitive_link_merge_double_link_SOURCES = scribo_primitive_link_merge_double_link.cc
+scribo_primitive_link_with_graph_SOURCES = scribo_primitive_link_with_graph.cc
+scribo_primitive_link_with_rag_SOURCES = scribo_primitive_link_with_rag.cc
+scribo_primitive_link_with_several_graphes_SOURCES = scribo_primitive_link_with_several_graphes.cc
+scribo_primitive_link_with_several_left_links_SOURCES = scribo_primitive_link_with_several_left_links.cc
+scribo_primitive_link_with_several_right_links_SOURCES = scribo_primitive_link_with_several_right_links.cc
+scribo_primitive_link_with_single_left_link_SOURCES = scribo_primitive_link_with_single_left_link.cc
+scribo_primitive_link_with_single_right_link_SOURCES = scribo_primitive_link_with_single_right_link.cc
scribo_table_align_lines_horizontaly_SOURCES = scribo_table_align_lines_horizontaly.cc
scribo_table_align_lines_verticaly_SOURCES = scribo_table_align_lines_verticaly.cc
scribo_table_all_SOURCES = scribo_table_all.cc
@@ -135,24 +186,5 @@ scribo_table_repair_vertical_lines_SOURCES = scribo_table_repair_vertical_lines.
scribo_text_all_SOURCES = scribo_text_all.cc
scribo_text_clean_SOURCES = scribo_text_clean.cc
scribo_text_extract_lines_SOURCES = scribo_text_extract_lines.cc
-scribo_text_grouping_all_SOURCES = scribo_text_grouping_all.cc
-scribo_text_grouping_group_from_double_link_SOURCES = scribo_text_grouping_group_from_double_link.cc
-scribo_text_grouping_group_from_graph_SOURCES = scribo_text_grouping_group_from_graph.cc
-scribo_text_grouping_group_from_single_link_SOURCES = scribo_text_grouping_group_from_single_link.cc
-scribo_text_grouping_group_with_graph_SOURCES = scribo_text_grouping_group_with_graph.cc
-scribo_text_grouping_group_with_several_graphes_SOURCES = scribo_text_grouping_group_with_several_graphes.cc
-scribo_text_grouping_group_with_several_left_links_SOURCES = scribo_text_grouping_group_with_several_left_links.cc
-scribo_text_grouping_group_with_several_right_links_SOURCES = scribo_text_grouping_group_with_several_right_links.cc
-scribo_text_grouping_group_with_single_left_link_SOURCES = scribo_text_grouping_group_with_single_left_link.cc
-scribo_text_grouping_group_with_single_right_link_SOURCES = scribo_text_grouping_group_with_single_right_link.cc
-scribo_text_grouping_internal_all_SOURCES = scribo_text_grouping_internal_all.cc
-scribo_text_grouping_internal_find_graph_link_SOURCES = scribo_text_grouping_internal_find_graph_link.cc
-scribo_text_grouping_internal_find_left_link_SOURCES = scribo_text_grouping_internal_find_left_link.cc
-scribo_text_grouping_internal_find_right_link_SOURCES = scribo_text_grouping_internal_find_right_link.cc
-scribo_text_grouping_internal_find_root_SOURCES = scribo_text_grouping_internal_find_root.cc
-scribo_text_grouping_internal_init_link_array_SOURCES = scribo_text_grouping_internal_init_link_array.cc
-scribo_text_grouping_internal_is_link_valid_SOURCES = scribo_text_grouping_internal_is_link_valid.cc
-scribo_text_grouping_internal_update_graph_link_SOURCES = scribo_text_grouping_internal_update_graph_link.cc
-scribo_text_grouping_internal_update_link_array_SOURCES = scribo_text_grouping_internal_update_link_array.cc
scribo_util_all_SOURCES = scribo_util_all.cc
scribo_util_text_SOURCES = scribo_util_text.cc
diff --git a/scribo/text/all.hh b/scribo/text/all.hh
index 000d5b9..d28510c 100644
--- a/scribo/text/all.hh
+++ b/scribo/text/all.hh
@@ -44,6 +44,5 @@ namespace scribo
# include <scribo/text/extract_lines.hh>
//# include <scribo/text/recognition.hh>
# include <scribo/text/clean.hh>
-# include <scribo/text/grouping/all.hh>
#endif // ! SCRIBO_TEXT_ALL_HH
diff --git a/scribo/text/extract_lines.hh b/scribo/text/extract_lines.hh
index 1d70f85..44dca50 100644
--- a/scribo/text/extract_lines.hh
+++ b/scribo/text/extract_lines.hh
@@ -47,10 +47,11 @@
# include <mln/util/graph.hh>
# include <mln/value/label_16.hh>
-# include <scribo/extract/primitive/objects.hh>
-# include <scribo/text/grouping/group_with_several_left_links.hh>
-# include <scribo/text/grouping/group_with_several_right_links.hh>
-# include <scribo/text/grouping/group_from_double_link.hh>
+# include <scribo/primitive/extract/objects.hh>
+# include <scribo/primitive/group/apply.hh>
+# include <scribo/primitive/link/with_several_left_links.hh>
+# include <scribo/primitive/link/with_several_right_links.hh>
+# include <scribo/primitive/group/from_double_link.hh>
# ifndef SCRIBO_NDEBUG
# include <mln/literal/colors.hh>
@@ -100,8 +101,9 @@ namespace scribo
mln_precondition(input.is_valid());
mln_precondition(nbh.is_valid());
- typedef object_image(mln_ch_value(I,V)) text_t;
- text_t text = scribo::extract::primitive::objects(input, nbh, nbboxes);
+ typedef mln_ch_value(I,V) L;
+ typedef object_image(L) text_t;
+ text_t text = scribo::primitive::extract::objects(input, nbh, nbboxes);
# ifndef SCRIBO_NDEBUG
debug::save_bboxes_image(input, text.bboxes(), literal::red,
@@ -109,10 +111,10 @@ namespace scribo
# endif // ! SCRIBO_NDEBUG
//Link character bboxes to their left neighboor if possible.
- mln::util::array<unsigned> left_link
- = text::grouping::group_with_several_left_links(text, 30);
- mln::util::array<unsigned> right_link
- = text::grouping::group_with_several_right_links(text, 30);
+ object_links<L> left_link
+ = primitive::link::with_several_left_links(text, 30);
+ object_links<L> right_link
+ = primitive::link::with_several_right_links(text, 30);
# ifndef SCRIBO_NDEBUG
scribo::debug::save_linked_bboxes_image(input,
@@ -123,8 +125,12 @@ namespace scribo
# endif // ! SCRIBO_NDEBUG
//Merge character bboxes through a graph.
- text_t grouped_text
- = text::grouping::group_from_double_link(text, left_link, right_link);
+
+ object_groups<L>
+ groups = primitive::group::from_double_link(text,
+ left_link, right_link);
+
+ text_t grouped_text = primitive::group::apply(text, groups);
# ifndef SCRIBO_NDEBUG
debug::save_bboxes_image(input, grouped_text.bboxes(),
diff --git a/scribo/text/grouping/internal/all.hh b/scribo/text/grouping/internal/all.hh
deleted file mode 100644
index 257d524..0000000
--- a/scribo/text/grouping/internal/all.hh
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_ALL_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_ALL_HH
-
-/// \file
-///
-/// Include all headers located in scribo/text/grouping/internal.
-
-namespace scribo
-{
-
- namespace text
- {
-
- namespace grouping
- {
-
- /// Namespace of internal routines grouping text components.
- namespace internal
- {
-
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
-
- } // end of namespace scribo::text
-
-} // end of namespace scribo
-
-
-# include <scribo/text/grouping/internal/init_link_array.hh>
-# include <scribo/text/grouping/internal/is_link_valid.hh>
-# include <scribo/text/grouping/internal/find_root.hh>
-# include <scribo/text/grouping/internal/find_graph_link.hh>
-# include <scribo/text/grouping/internal/find_right_link.hh>
-# include <scribo/text/grouping/internal/update_graph_link.hh>
-# include <scribo/text/grouping/internal/update_link_array.hh>
-# include <scribo/text/grouping/internal/find_left_link.hh>
-
-
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_ALL_HH
diff --git a/scribo/text/grouping/internal/find_left_link.hh b/scribo/text/grouping/internal/find_left_link.hh
deleted file mode 100644
index 93d4b95..0000000
--- a/scribo/text/grouping/internal/find_left_link.hh
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_FIND_LEFT_LINK_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_FIND_LEFT_LINK_HH
-
-/// \file
-///
-/// Find the left neighbor of a line of text if exists.
-
-# include <mln/core/concept/image.hh>
-
-# include <mln/math/abs.hh>
-
-# include <mln/util/array.hh>
-
-# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/update_link_array.hh>
-
-//FIXME: not generic.
-# include <mln/core/alias/dpoint2d.hh>
-
-namespace scribo
-{
-
- namespace text
- {
-
- namespace grouping
- {
-
- namespace internal
- {
-
- /// Find the left neighbor of a line of text if exists.
- ///
- /// \param objects An image of objects.
- /// \param left_link The left neighbors.
- /// \param current_comp A text line id.
- /// \param dmax The maximum lookup distance.
- /// \param c The lookup start point.
- template <typename L>
- void
- find_left_link(const object_image(L)& objects,
- mln::util::array<unsigned>& left_link,
- unsigned current_comp,
- int dmax,
- const mln_site(L)& c);
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename L>
- void
- find_left_link(const object_image(L)& objects,
- mln::util::array<unsigned>& left_link,
- unsigned current_comp,
- int dmax,
- const mln_site(L)& c)
- {
- ///FIXME: the following code is not generic...
- /// First site on the right of the central site
- mln_site(L) p = c + mln::left;
-
- while (objects.domain().has(p) // Not outside image domain
- && (objects(p) == literal::zero // Is the background
- || objects(p) == current_comp // Is the current component
- || left_link[objects(p)] == current_comp) // Creates a loop
- && math::abs(p.col() - c.col()) < dmax) // Not to far
- --p.col();
-
- update_link_array(objects, left_link, p, c, current_comp, dmax);
- }
-
-# endif // MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
-
- } // end of namespace scribo::text
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_FIND_LEFT_LINK_HH
diff --git a/scribo/text/grouping/internal/find_right_link.hh b/scribo/text/grouping/internal/find_right_link.hh
deleted file mode 100644
index 5ef0853..0000000
--- a/scribo/text/grouping/internal/find_right_link.hh
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_FIND_RIGHT_LINK_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_FIND_RIGHT_LINK_HH
-
-/// \file
-///
-/// Find the right neighbor of a line of text if exists.
-
-# include <mln/core/concept/image.hh>
-
-# include <mln/math/abs.hh>
-
-# include <mln/util/array.hh>
-
-# include <scribo/core/object_image.hh>
-# include <scribo/text/grouping/internal/update_link_array.hh>
-
-//FIXME: not generic.
-# include <mln/core/alias/dpoint2d.hh>
-
-namespace scribo
-{
-
- namespace text
- {
-
- namespace grouping
- {
-
- namespace internal
- {
-
- using namespace mln;
-
- /// Find the right neighbor of a line of text if exists.
- ///
- /// \param text The lines of text.
- /// \param right_link The right neighbors.
- /// \param current_comp A text line id.
- /// \param dmax The maximum lookup distance.
- /// \param c The lookup start point.
- //
- template <typename L>
- void
- find_right_link(const object_image(L)& text,
- mln::util::array<unsigned>& right_link,
- unsigned current_comp,
- int dmax,
- const mln_site(L)& c);
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename L>
- void
- find_right_link(const object_image(L)& objects,
- mln::util::array<unsigned>& right_link,
- unsigned current_comp,
- int dmax,
- const mln_site(L)& c)
- {
- ///FIXME: the following code is not generic...
- /// First site on the right of the central site
- mln_site(L) p = c + mln::right;
-
- while (objects.domain().has(p) // Not outside image domain
- && (objects(p) == literal::zero // Is the background
- || objects(p) == current_comp // Is the current component
- || right_link[objects(p)] == current_comp) // Creates a loop
- && math::abs(p.col() - c.col()) < dmax) // Not too far
- ++p.col();
-
- update_link_array(objects, right_link, p, c, current_comp, dmax);
- }
-
-# endif // MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
-
- } // end of namespace scribo::text
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_FIND_RIGHT_LINK_HH
diff --git a/scribo/text/grouping/internal/update_graph_link.hh b/scribo/text/grouping/internal/update_graph_link.hh
deleted file mode 100644
index 3f5c199..0000000
--- a/scribo/text/grouping/internal/update_graph_link.hh
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef SCRIBO_TEXT_GROUPING_INTERNAL_UPDATE_GRAPH_LINK_HH
-# define SCRIBO_TEXT_GROUPING_INTERNAL_UPDATE_GRAPH_LINK_HH
-
-/// \file
-///
-/// Update graph edges if a valid neighbor is found.
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/graph.hh>
-# include <mln/math/abs.hh>
-
-namespace scribo
-{
-
- namespace text
- {
-
- namespace grouping
- {
-
- namespace internal
- {
-
- using namespace mln;
-
-
- /// Update graph edges if a valid neighbor is found.
- ///
- /// \param[in] lbl_ A label image.
- /// \param[in] g_ A graph.
- /// \param[in] p A site of \p lbl_.
- /// \param[in] c A site of \p lbl_.
- /// \param[in] i A vertex id.
- /// \param[in] dmax The maximum distance allowed to look for a
- /// neighbor.
- //
- template <typename I, typename G>
- void
- update_graph_link(const Image<I>& lbl_, Graph<G>& g_,
- const mln_site(I)& p, const mln_site(I)& c,
- unsigned i, int dmax);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- template <typename I, typename G>
- inline
- void
- update_graph_link(const Image<I>& lbl_, Graph<G>& g_,
- const mln_site(I)& p, const mln_site(I)& c,
- unsigned i, int dmax)
- {
- trace::entering("scribo::text::grouping::internal::update_graph_link");
-
- const I& lbl = exact(lbl_);
- G& g = exact(g_);
-
- mlc_is_a(mln_value(I), mln::value::Symbolic)::check();
- mln_precondition(exact(lbl).is_valid());
- mln_precondition(g.is_valid());
-
- if (lbl.domain().has(p) && lbl(p) != literal::zero && lbl(p) != i
- && (math::abs(p.col() - c.col())) < dmax)
- g.add_edge(lbl(p), i);
-
- trace::exiting("scribo::text::grouping::internal::update_graph_link");
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::text::grouping::internal
-
- } // end of namespace scribo::text::grouping
-
- } // end of namespace scribo::text
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_TEXT_GROUPING_INTERNAL_UPDATE_GRAPH_LINK_HH
--
1.5.6.5
1
0
* scribo.mk: Set optimization flags in AM_CXXFLAGS.
* tests/tests.mk: New. Set AM_CXXFLAGS with debug flags.
* tests/Makefile.am,
* tests/filter/Makefile.am,
* tests/preprocessing/Makefile.am,
* tests/table/Makefile.am,
* tests/text/Makefile.am,
* tests/unit_test/Makefile.am: Include tests.mk.
---
scribo/ChangeLog | 14 ++++++++++++++
scribo/scribo.mk | 4 ++--
scribo/tests/Makefile.am | 3 ++-
scribo/tests/filter/Makefile.am | 2 +-
scribo/tests/preprocessing/Makefile.am | 2 +-
scribo/tests/table/Makefile.am | 4 ++--
scribo/{scribo.mk => tests/tests.mk} | 6 ++----
scribo/tests/text/Makefile.am | 2 +-
scribo/tests/unit_test/Makefile.am | 2 +-
9 files changed, 26 insertions(+), 13 deletions(-)
copy scribo/{scribo.mk => tests/tests.mk} (85%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 24f7305..0aae996 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,19 @@
2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Set specific cxxflags for tests in Scribo.
+
+ * scribo.mk: Set optimization flags in AM_CXXFLAGS.
+ * tests/tests.mk: New. Set AM_CXXFLAGS with debug flags.
+
+ * tests/Makefile.am,
+ * tests/filter/Makefile.am,
+ * tests/preprocessing/Makefile.am,
+ * tests/table/Makefile.am,
+ * tests/text/Makefile.am,
+ * tests/unit_test/Makefile.am: Include tests.mk.
+
+2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Introduce new structures for objects links and groups.
* core/object_groups.hh,
diff --git a/scribo/scribo.mk b/scribo/scribo.mk
index 2984fb4..62ffcad 100644
--- a/scribo/scribo.mk
+++ b/scribo/scribo.mk
@@ -14,8 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-#include $(top_srcdir)/milena/tests/tests.mk
# Add path to Scribo's headers
-AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top_builddir)/milena -DNDEBUG -O2
+AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top_builddir)/milena
+AM_CXXFLAGS = -DNDEBUG -O2
\ No newline at end of file
diff --git a/scribo/tests/Makefile.am b/scribo/tests/Makefile.am
index 2351ce9..e36d250 100644
--- a/scribo/tests/Makefile.am
+++ b/scribo/tests/Makefile.am
@@ -13,7 +13,8 @@
#
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-#
+
+include $(srcdir)/tests.mk
## Process this file through Automake to create Makefile.in.
diff --git a/scribo/tests/filter/Makefile.am b/scribo/tests/filter/Makefile.am
index 465c42f..fd3299e 100644
--- a/scribo/tests/filter/Makefile.am
+++ b/scribo/tests/filter/Makefile.am
@@ -17,7 +17,7 @@
## Process this file through Automake to create Makefile.in.
-include $(top_srcdir)/scribo/scribo.mk
+include $(top_srcdir)/scribo/tests/tests.mk
check_PROGRAMS = \
small_and_large_bboxes
diff --git a/scribo/tests/preprocessing/Makefile.am b/scribo/tests/preprocessing/Makefile.am
index e0ee097..4666033 100644
--- a/scribo/tests/preprocessing/Makefile.am
+++ b/scribo/tests/preprocessing/Makefile.am
@@ -17,7 +17,7 @@
## Process this file through Automake to create Makefile.in.
-include $(top_srcdir)/scribo/scribo.mk
+include $(top_srcdir)/scribo/tests/tests.mk
check_PROGRAMS = \
unskew
diff --git a/scribo/tests/table/Makefile.am b/scribo/tests/table/Makefile.am
index 8016c9b..0c15a63 100644
--- a/scribo/tests/table/Makefile.am
+++ b/scribo/tests/table/Makefile.am
@@ -17,12 +17,12 @@
## Process this file through Automake to create Makefile.in.
-include $(top_srcdir)/scribo/scribo.mk
+include $(top_srcdir)/scribo/tests/tests.mk
check_PROGRAMS = \
extract_lines_with_rank \
repair_lines
-
+
extract_lines_with_rank_SOURCES = extract_lines_with_rank.cc
repair_lines_SOURCES = repair_lines.cc
diff --git a/scribo/scribo.mk b/scribo/tests/tests.mk
similarity index 85%
copy from scribo/scribo.mk
copy to scribo/tests/tests.mk
index 2984fb4..bc9b2d9 100644
--- a/scribo/scribo.mk
+++ b/scribo/tests/tests.mk
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-#include $(top_srcdir)/milena/tests/tests.mk
-
-# Add path to Scribo's headers
-AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top_builddir)/milena -DNDEBUG -O2
+AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top_builddir)/milena
+AM_CXXFLAGS = -g -O0
diff --git a/scribo/tests/text/Makefile.am b/scribo/tests/text/Makefile.am
index c478091..f6cb0e5 100644
--- a/scribo/tests/text/Makefile.am
+++ b/scribo/tests/text/Makefile.am
@@ -17,7 +17,7 @@
## Process this file through Automake to create Makefile.in.
-include $(top_srcdir)/scribo/scribo.mk
+include $(top_srcdir)/scribo/tests/tests.mk
check_PROGRAMS =
diff --git a/scribo/tests/unit_test/Makefile.am b/scribo/tests/unit_test/Makefile.am
index 79b3830..7202de6 100644
--- a/scribo/tests/unit_test/Makefile.am
+++ b/scribo/tests/unit_test/Makefile.am
@@ -17,7 +17,7 @@
## Process this file through Automake to create Makefile.in.
-include $(top_srcdir)/scribo/scribo.mk
+include $(top_srcdir)/scribo/tests/tests.mk
# Regen files.
include $(top_srcdir)/build-aux/regen-recursive.mk
--
1.5.6.5
1
0
25 Aug '09
* core/object_groups.hh,
* core/object_links.hh: New.
---
scribo/ChangeLog | 7 ++
scribo/core/object_groups.hh | 125 ++++++++++++++++++++++++++++++++++++++++++
scribo/core/object_links.hh | 114 ++++++++++++++++++++++++++++++++++++++
3 files changed, 246 insertions(+), 0 deletions(-)
create mode 100644 scribo/core/object_groups.hh
create mode 100644 scribo/core/object_links.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 23c8c0d..24f7305 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Introduce new structures for objects links and groups.
+
+ * core/object_groups.hh,
+ * core/object_links.hh: New.
+
2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
New object grouping routine based on a rag.
diff --git a/scribo/core/object_groups.hh b/scribo/core/object_groups.hh
new file mode 100644
index 0000000..3e49942
--- /dev/null
+++ b/scribo/core/object_groups.hh
@@ -0,0 +1,125 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_CORE_OBJECT_GROUPS_HH
+# define SCRIBO_CORE_OBJECT_GROUPS_HH
+
+/// \file
+///
+/// \brief Object groups representation.
+///
+/// \fixme Should not inherit from util::array.
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_links.hh>
+# include <scribo/core/object_image.hh>
+
+namespace scribo
+{
+
+ using namespace mln;
+
+
+ /// \brief Object group representation.
+ //
+ template <typename L>
+ class object_groups
+ : public mln::util::array<unsigned>
+ {
+ typedef mln::util::array<unsigned> super_t;
+
+ public:
+ object_groups(const object_image(L)& objects);
+ object_groups(const object_image(L)& objects, unsigned n);
+ object_groups(const object_image(L)& objects, unsigned n, unsigned value);
+
+ const void* objects_id_() const;
+ const object_image(L)& object_image_() const;
+
+ void init_(const object_links<L>& links);
+
+ private:
+ object_image(L) objects_;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ object_groups<L>::object_groups(const object_image(L)& objects)
+ : objects_(objects)
+ {
+
+ }
+
+
+ template <typename L>
+ object_groups<L>::object_groups(const object_image(L)& objects, unsigned n)
+ : super_t(n), objects_(objects)
+ {
+
+ }
+
+
+ template <typename L>
+ object_groups<L>::object_groups(const object_image(L)& objects,
+ unsigned n, unsigned value)
+ : super_t(n, value), objects_(objects)
+ {
+
+ }
+
+ template <typename L>
+ const void*
+ object_groups<L>::objects_id_() const
+ {
+ return objects_.id_();
+ }
+
+ template <typename L>
+ const object_image(L)&
+ object_groups<L>::object_image_() const
+ {
+ return objects_;
+ }
+
+
+ template <typename L>
+ void
+ object_groups<L>::init_(const object_links<L>& links)
+ {
+ objects_ = links.object_image_();
+ this->hook_std_vector_() = links.std_vector();
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_CORE_OBJECT_GROUPS_HH
diff --git a/scribo/core/object_links.hh b/scribo/core/object_links.hh
new file mode 100644
index 0000000..aa70bf8
--- /dev/null
+++ b/scribo/core/object_links.hh
@@ -0,0 +1,114 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_CORE_OBJECT_LINKS_HH
+# define SCRIBO_CORE_OBJECT_LINKS_HH
+
+/// \file
+///
+/// \brief Object links representation.
+///
+/// \fixme Should not inherit from util::array.
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_image.hh>
+
+
+namespace scribo
+{
+
+ using namespace mln;
+
+ /// \brief Object group representation.
+ //
+ template <typename L>
+ class object_links
+ : public mln::util::array<unsigned>
+ {
+ typedef mln::util::array<unsigned> super_t;
+
+ public:
+ object_links(const object_image(L)& objects);
+ object_links(const object_image(L)& objects, unsigned n);
+ object_links(const object_image(L)& objects, unsigned n, unsigned value);
+
+
+ const void* objects_id_() const;
+ const object_image(L)& object_image_() const;
+
+ private:
+ object_image(L) objects_;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ object_links<L>::object_links(const object_image(L)& objects)
+ : objects_(objects)
+ {
+
+ }
+
+ template <typename L>
+ object_links<L>::object_links(const object_image(L)& objects, unsigned n)
+ : super_t(n), objects_(objects)
+ {
+
+ }
+
+
+ template <typename L>
+ object_links<L>::object_links(const object_image(L)& objects,
+ unsigned n, unsigned value)
+ : super_t(n, value), objects_(objects)
+ {
+
+ }
+
+
+ template <typename L>
+ const void *
+ object_links<L>::objects_id_() const
+ {
+ return objects_.id_();
+ }
+
+ template <typename L>
+ const object_image(L)&
+ object_links<L>::object_image_() const
+ {
+ return objects_;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_CORE_OBJECT_LINKS_HH
--
1.5.6.5
1
0
* headers.mk,
* tests/unit_test/unit-tests.mk: Regen.
---
milena/ChangeLog | 7 +++++++
milena/headers.mk | 17 ++++++++++++++++-
milena/tests/unit_test/unit-tests.mk | 32 ++++++++++++++++++++++++++++++--
3 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 97a4b48..4a7d67e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Regen mk files.
+
+ * headers.mk,
+ * tests/unit_test/unit-tests.mk: Regen.
+
+2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* tests/tools/pretty_check.sh: Change data base url.
2009-08-24 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
diff --git a/milena/headers.mk b/milena/headers.mk
index bdc488f..76c9755 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -129,7 +129,14 @@ mln/canvas/chamfer.hh \
mln/canvas/distance_front.hh \
mln/canvas/distance_geodesic.hh \
mln/canvas/essential.hh \
-mln/canvas/labeling.hh \
+mln/canvas/labeling/all.hh \
+mln/canvas/labeling/blobs.hh \
+mln/canvas/labeling/essential.hh \
+mln/canvas/labeling/generic.hh \
+mln/canvas/labeling/internal/find_root_fastest.hh \
+mln/canvas/labeling/internal/tests.hh \
+mln/canvas/labeling/sorted.hh \
+mln/canvas/labeling/video.hh \
mln/canvas/morpho/all.hh \
mln/canvas/morpho/attribute_filter.hh \
mln/canvas/morpho/essential.hh \
@@ -278,6 +285,8 @@ mln/core/image/dmorph/unproject_image.hh \
mln/core/image/edge_image.hh \
mln/core/image/essential.hh \
mln/core/image/flat_image.hh \
+mln/core/image/graph_elt_mixed_neighborhood.hh \
+mln/core/image/graph_elt_mixed_window.hh \
mln/core/image/graph_elt_neighborhood.hh \
mln/core/image/graph_elt_neighborhood_if.hh \
mln/core/image/graph_elt_window.hh \
@@ -323,6 +332,8 @@ mln/core/internal/image_primary.hh \
mln/core/internal/image_value_morpher.hh \
mln/core/internal/is_masked_impl_selector.hh \
mln/core/internal/morpher_lvalue.hh \
+mln/core/internal/neighb_base.hh \
+mln/core/internal/neighb_niter_base.hh \
mln/core/internal/neighb_niter_impl.hh \
mln/core/internal/neighborhood_base.hh \
mln/core/internal/p_complex_piter_base.hh \
@@ -341,6 +352,7 @@ mln/core/internal/site_set_iterator_base.hh \
mln/core/internal/weighted_window_base.hh \
mln/core/internal/window_base.hh \
mln/core/macros.hh \
+mln/core/mixed_neighb.hh \
mln/core/neighb.hh \
mln/core/pixel.hh \
mln/core/pixter1d.hh \
@@ -665,6 +677,7 @@ mln/io/txt/save.hh \
mln/labeling/all.hh \
mln/labeling/background.hh \
mln/labeling/blobs.hh \
+mln/labeling/blobs_and_compute.hh \
mln/labeling/colorize.hh \
mln/labeling/compute.hh \
mln/labeling/compute_image.hh \
@@ -678,6 +691,7 @@ mln/labeling/pack.hh \
mln/labeling/regional_maxima.hh \
mln/labeling/regional_minima.hh \
mln/labeling/relabel.hh \
+mln/labeling/superpose.hh \
mln/labeling/value.hh \
mln/labeling/value.spe.hh \
mln/labeling/wrap.hh \
@@ -1222,6 +1236,7 @@ mln/world/inter_pixel/is_pixel.hh \
mln/world/inter_pixel/is_separator.hh \
mln/world/inter_pixel/neighb2d.hh \
mln/world/inter_pixel/separator_to_pixels.hh
+
#<<lrde
nobase_include_HEADERS += \
mln/accu/math/inf.hh \
diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk
index 00d39de..0475d0c 100644
--- a/milena/tests/unit_test/unit-tests.mk
+++ b/milena/tests/unit_test/unit-tests.mk
@@ -127,7 +127,14 @@ mln_canvas_chamfer \
mln_canvas_distance_front \
mln_canvas_distance_geodesic \
mln_canvas_essential \
-mln_canvas_labeling \
+mln_canvas_labeling_all \
+mln_canvas_labeling_blobs \
+mln_canvas_labeling_essential \
+mln_canvas_labeling_generic \
+mln_canvas_labeling_internal_find_root_fastest \
+mln_canvas_labeling_internal_tests \
+mln_canvas_labeling_sorted \
+mln_canvas_labeling_video \
mln_canvas_morpho_all \
mln_canvas_morpho_attribute_filter \
mln_canvas_morpho_essential \
@@ -257,6 +264,8 @@ mln_core_image_dmorph_unproject_image \
mln_core_image_edge_image \
mln_core_image_essential \
mln_core_image_flat_image \
+mln_core_image_graph_elt_mixed_neighborhood \
+mln_core_image_graph_elt_mixed_window \
mln_core_image_graph_elt_neighborhood \
mln_core_image_graph_elt_neighborhood_if \
mln_core_image_graph_elt_window \
@@ -304,6 +313,8 @@ mln_core_internal_image_primary \
mln_core_internal_image_value_morpher \
mln_core_internal_is_masked_impl_selector \
mln_core_internal_morpher_lvalue \
+mln_core_internal_neighb_base \
+mln_core_internal_neighb_niter_base \
mln_core_internal_neighb_niter_impl \
mln_core_internal_neighborhood_base \
mln_core_internal_p_complex_piter_base \
@@ -322,6 +333,7 @@ mln_core_internal_site_set_iterator_base \
mln_core_internal_weighted_window_base \
mln_core_internal_window_base \
mln_core_macros \
+mln_core_mixed_neighb \
mln_core_neighb \
mln_core_pixel \
mln_core_pixter1d \
@@ -681,6 +693,7 @@ mln_io_txt_save \
mln_labeling_all \
mln_labeling_background \
mln_labeling_blobs \
+mln_labeling_blobs_and_compute \
mln_labeling_colorize \
mln_labeling_compute \
mln_labeling_compute_image \
@@ -694,6 +707,7 @@ mln_labeling_pack \
mln_labeling_regional_maxima \
mln_labeling_regional_minima \
mln_labeling_relabel \
+mln_labeling_superpose \
mln_labeling_value \
mln_labeling_wrap \
mln_linear_all \
@@ -1388,7 +1402,14 @@ mln_canvas_chamfer_SOURCES = mln_canvas_chamfer.cc
mln_canvas_distance_front_SOURCES = mln_canvas_distance_front.cc
mln_canvas_distance_geodesic_SOURCES = mln_canvas_distance_geodesic.cc
mln_canvas_essential_SOURCES = mln_canvas_essential.cc
-mln_canvas_labeling_SOURCES = mln_canvas_labeling.cc
+mln_canvas_labeling_all_SOURCES = mln_canvas_labeling_all.cc
+mln_canvas_labeling_blobs_SOURCES = mln_canvas_labeling_blobs.cc
+mln_canvas_labeling_essential_SOURCES = mln_canvas_labeling_essential.cc
+mln_canvas_labeling_generic_SOURCES = mln_canvas_labeling_generic.cc
+mln_canvas_labeling_internal_find_root_fastest_SOURCES = mln_canvas_labeling_internal_find_root_fastest.cc
+mln_canvas_labeling_internal_tests_SOURCES = mln_canvas_labeling_internal_tests.cc
+mln_canvas_labeling_sorted_SOURCES = mln_canvas_labeling_sorted.cc
+mln_canvas_labeling_video_SOURCES = mln_canvas_labeling_video.cc
mln_canvas_morpho_all_SOURCES = mln_canvas_morpho_all.cc
mln_canvas_morpho_attribute_filter_SOURCES = mln_canvas_morpho_attribute_filter.cc
mln_canvas_morpho_essential_SOURCES = mln_canvas_morpho_essential.cc
@@ -1518,6 +1539,8 @@ mln_core_image_dmorph_unproject_image_SOURCES = mln_core_image_dmorph_unproject_
mln_core_image_edge_image_SOURCES = mln_core_image_edge_image.cc
mln_core_image_essential_SOURCES = mln_core_image_essential.cc
mln_core_image_flat_image_SOURCES = mln_core_image_flat_image.cc
+mln_core_image_graph_elt_mixed_neighborhood_SOURCES = mln_core_image_graph_elt_mixed_neighborhood.cc
+mln_core_image_graph_elt_mixed_window_SOURCES = mln_core_image_graph_elt_mixed_window.cc
mln_core_image_graph_elt_neighborhood_SOURCES = mln_core_image_graph_elt_neighborhood.cc
mln_core_image_graph_elt_neighborhood_if_SOURCES = mln_core_image_graph_elt_neighborhood_if.cc
mln_core_image_graph_elt_window_SOURCES = mln_core_image_graph_elt_window.cc
@@ -1565,6 +1588,8 @@ mln_core_internal_image_primary_SOURCES = mln_core_internal_image_primary.cc
mln_core_internal_image_value_morpher_SOURCES = mln_core_internal_image_value_morpher.cc
mln_core_internal_is_masked_impl_selector_SOURCES = mln_core_internal_is_masked_impl_selector.cc
mln_core_internal_morpher_lvalue_SOURCES = mln_core_internal_morpher_lvalue.cc
+mln_core_internal_neighb_base_SOURCES = mln_core_internal_neighb_base.cc
+mln_core_internal_neighb_niter_base_SOURCES = mln_core_internal_neighb_niter_base.cc
mln_core_internal_neighb_niter_impl_SOURCES = mln_core_internal_neighb_niter_impl.cc
mln_core_internal_neighborhood_base_SOURCES = mln_core_internal_neighborhood_base.cc
mln_core_internal_p_complex_piter_base_SOURCES = mln_core_internal_p_complex_piter_base.cc
@@ -1583,6 +1608,7 @@ mln_core_internal_site_set_iterator_base_SOURCES = mln_core_internal_site_set_it
mln_core_internal_weighted_window_base_SOURCES = mln_core_internal_weighted_window_base.cc
mln_core_internal_window_base_SOURCES = mln_core_internal_window_base.cc
mln_core_macros_SOURCES = mln_core_macros.cc
+mln_core_mixed_neighb_SOURCES = mln_core_mixed_neighb.cc
mln_core_neighb_SOURCES = mln_core_neighb.cc
mln_core_pixel_SOURCES = mln_core_pixel.cc
mln_core_pixter1d_SOURCES = mln_core_pixter1d.cc
@@ -1942,6 +1968,7 @@ mln_io_txt_save_SOURCES = mln_io_txt_save.cc
mln_labeling_all_SOURCES = mln_labeling_all.cc
mln_labeling_background_SOURCES = mln_labeling_background.cc
mln_labeling_blobs_SOURCES = mln_labeling_blobs.cc
+mln_labeling_blobs_and_compute_SOURCES = mln_labeling_blobs_and_compute.cc
mln_labeling_colorize_SOURCES = mln_labeling_colorize.cc
mln_labeling_compute_SOURCES = mln_labeling_compute.cc
mln_labeling_compute_image_SOURCES = mln_labeling_compute_image.cc
@@ -1955,6 +1982,7 @@ mln_labeling_pack_SOURCES = mln_labeling_pack.cc
mln_labeling_regional_maxima_SOURCES = mln_labeling_regional_maxima.cc
mln_labeling_regional_minima_SOURCES = mln_labeling_regional_minima.cc
mln_labeling_relabel_SOURCES = mln_labeling_relabel.cc
+mln_labeling_superpose_SOURCES = mln_labeling_superpose.cc
mln_labeling_value_SOURCES = mln_labeling_value.cc
mln_labeling_wrap_SOURCES = mln_labeling_wrap.cc
mln_linear_all_SOURCES = mln_linear_all.cc
--
1.5.6.5
1
0