This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch julien_temp_paragraphs has been created
at 8bae0713f5a4e26137e59a5cc6a3f2e947592f7d (commit)
- Log -----------------------------------------------------------------
8bae071 Paragraphs extraction
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
* tests/filter/Makefile.am: Add new targets.
* tests/filter/object_groups_mean_width.cc,
* tests/filter/object_groups_size_ratio.cc,
* tests/filter/object_groups_small.cc,
* tests/filter/object_groups_with_holes.cc,
* tests/filter/object_links_bbox_h_ratio.cc,
* tests/filter/object_links_bbox_overlap.cc,
* tests/filter/object_links_bbox_w_ratio.cc,
* tests/filter/object_links_bottom_aligned.cc,
* tests/filter/object_links_center_aligned.cc,
* tests/filter/object_links_left_aligned.cc,
* tests/filter/object_links_right_aligned.cc,
* tests/filter/object_links_top_aligned.cc: New.
* scribo/tests/img/the_valleys.pbm: New test data.
---
scribo/ChangeLog | 21 +++++
scribo/tests/filter/Makefile.am | 28 ++++++-
scribo/tests/filter/object_groups_mean_width.cc | 72 ++++++++++++++++
scribo/tests/filter/object_groups_size_ratio.cc | 71 ++++++++++++++++
scribo/tests/filter/object_groups_small.cc | 87 ++++++++++++++++++++
scribo/tests/filter/object_groups_with_holes.cc | 71 ++++++++++++++++
scribo/tests/filter/object_links_bbox_h_ratio.cc | 69 ++++++++++++++++
scribo/tests/filter/object_links_bbox_overlap.cc | 69 ++++++++++++++++
scribo/tests/filter/object_links_bbox_w_ratio.cc | 69 ++++++++++++++++
scribo/tests/filter/object_links_bottom_aligned.cc | 69 ++++++++++++++++
scribo/tests/filter/object_links_center_aligned.cc | 70 ++++++++++++++++
scribo/tests/filter/object_links_left_aligned.cc | 69 ++++++++++++++++
scribo/tests/filter/object_links_right_aligned.cc | 69 ++++++++++++++++
scribo/tests/filter/object_links_top_aligned.cc | 69 ++++++++++++++++
scribo/tests/img/the_valleys.pbm | Bin 0 -> 1724 bytes
15 files changed, 901 insertions(+), 2 deletions(-)
create mode 100644 scribo/tests/filter/object_groups_mean_width.cc
create mode 100644 scribo/tests/filter/object_groups_size_ratio.cc
create mode 100644 scribo/tests/filter/object_groups_small.cc
create mode 100644 scribo/tests/filter/object_groups_with_holes.cc
create mode 100644 scribo/tests/filter/object_links_bbox_h_ratio.cc
create mode 100644 scribo/tests/filter/object_links_bbox_overlap.cc
create mode 100644 scribo/tests/filter/object_links_bbox_w_ratio.cc
create mode 100644 scribo/tests/filter/object_links_bottom_aligned.cc
create mode 100644 scribo/tests/filter/object_links_center_aligned.cc
create mode 100644 scribo/tests/filter/object_links_left_aligned.cc
create mode 100644 scribo/tests/filter/object_links_right_aligned.cc
create mode 100644 scribo/tests/filter/object_links_top_aligned.cc
create mode 100644 scribo/tests/img/the_valleys.pbm
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index a0d4937..e7ac031 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,26 @@
2011-04-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add more tests.
+
+ * tests/filter/Makefile.am: Add new targets.
+
+ * tests/filter/object_groups_mean_width.cc,
+ * tests/filter/object_groups_size_ratio.cc,
+ * tests/filter/object_groups_small.cc,
+ * tests/filter/object_groups_with_holes.cc,
+ * tests/filter/object_links_bbox_h_ratio.cc,
+ * tests/filter/object_links_bbox_overlap.cc,
+ * tests/filter/object_links_bbox_w_ratio.cc,
+ * tests/filter/object_links_bottom_aligned.cc,
+ * tests/filter/object_links_center_aligned.cc,
+ * tests/filter/object_links_left_aligned.cc,
+ * tests/filter/object_links_right_aligned.cc,
+ * tests/filter/object_links_top_aligned.cc: New.
+
+ * scribo/tests/img/the_valleys.pbm: New test data.
+
+2011-04-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Small fixes in Scribo.
* scribo/core/component_features_data.hh: Fix default
diff --git a/scribo/tests/filter/Makefile.am b/scribo/tests/filter/Makefile.am
index 8064646..8a27f91 100644
--- a/scribo/tests/filter/Makefile.am
+++ b/scribo/tests/filter/Makefile.am
@@ -1,5 +1,5 @@
-# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-# (LRDE).
+# Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+# Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -19,11 +19,35 @@ include $(top_srcdir)/scribo/tests/tests.mk
check_PROGRAMS = \
objects_with_holes \
+ object_links_bbox_h_ratio \
+ object_links_bbox_w_ratio \
+ object_links_bbox_overlap \
+ object_links_bottom_aligned \
+ object_links_center_aligned \
+ object_links_left_aligned \
+ object_links_right_aligned \
+ object_links_top_aligned \
+ object_groups_mean_width \
+ object_groups_size_ratio \
+ object_groups_small \
+ object_groups_with_holes \
components_small \
components_large
objects_with_holes_SOURCES = objects_with_holes.cc
+object_links_bbox_h_ratio_SOURCES = object_links_bbox_h_ratio.cc
+object_links_bbox_w_ratio_SOURCES = object_links_bbox_w_ratio.cc
+object_links_bbox_overlap_SOURCES = object_links_bbox_overlap.cc
+object_links_bottom_aligned_SOURCES = object_links_bottom_aligned.cc
+object_links_center_aligned_SOURCES = object_links_center_aligned.cc
+object_links_left_aligned_SOURCES = object_links_left_aligned.cc
+object_links_right_aligned_SOURCES = object_links_right_aligned.cc
+object_links_top_aligned_SOURCES = object_links_top_aligned.cc
+object_groups_mean_width_SOURCES = object_groups_mean_width.cc
+object_groups_size_ratio_SOURCES = object_groups_size_ratio.cc
+object_groups_small_SOURCES = object_groups_small.cc
+object_groups_with_holes_SOURCES = object_groups_with_holes.cc
components_small_SOURCES = components_small.cc
components_large_SOURCES = components_large.cc
diff --git a/scribo/tests/filter/object_groups_mean_width.cc b/scribo/tests/filter/object_groups_mean_width.cc
new file mode 100644
index 0000000..81da661
--- /dev/null
+++ b/scribo/tests/filter/object_groups_mean_width.cc
@@ -0,0 +1,72 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/filter/object_groups_mean_width.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
+
+ const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
+ const unsigned filtered_ref[] = { 0, 0, 7, 3, 0, 3, 3, 7, 7, 3, 3, 3, 3 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ object_groups<L> groups = primitive::group::from_single_link(links);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == ref[g]);
+
+ groups = filter::object_groups_mean_width(groups, 10);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == filtered_ref[g]);
+
+}
diff --git a/scribo/tests/filter/object_groups_size_ratio.cc b/scribo/tests/filter/object_groups_size_ratio.cc
new file mode 100644
index 0000000..90e353a
--- /dev/null
+++ b/scribo/tests/filter/object_groups_size_ratio.cc
@@ -0,0 +1,71 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/filter/object_groups_size_ratio.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
+
+ const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
+ const unsigned filtered_ref[] = { 0, 1, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ object_groups<L> groups = primitive::group::from_single_link(links);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == ref[g]);
+
+ groups = filter::object_groups_size_ratio(groups, 1.2, 0.3);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == filtered_ref[g]);
+}
diff --git a/scribo/tests/filter/object_groups_small.cc b/scribo/tests/filter/object_groups_small.cc
new file mode 100644
index 0000000..165634d
--- /dev/null
+++ b/scribo/tests/filter/object_groups_small.cc
@@ -0,0 +1,87 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/filter/object_groups_small.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
+
+ const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
+ const unsigned filtered_ref[] = { 0, 0, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3 };
+ const unsigned size_ref[] = { 0, 1, 0, 7, 1, 0, 0, 3, 0, 0, 0, 0, 0 };
+
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ object_groups<L> groups = primitive::group::from_single_link(links);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == ref[g]);
+
+ {
+ object_groups<L> groups2 = filter::object_groups_small(groups, 4);
+
+ for_all_groups(g, groups2)
+ mln_assertion(groups2(g) == filtered_ref[g]);
+ }
+
+ {
+ mln::util::array<unsigned> group_size;
+ object_groups<L> groups2 = filter::object_groups_small(groups, 4, group_size);
+
+ for_all_groups(g, groups2)
+ {
+ mln_assertion(groups2(g) == filtered_ref[g]);
+ mln_assertion(group_size(g) == size_ref[g]);
+ }
+ }
+
+}
diff --git a/scribo/tests/filter/object_groups_with_holes.cc b/scribo/tests/filter/object_groups_with_holes.cc
new file mode 100644
index 0000000..3b5b29f
--- /dev/null
+++ b/scribo/tests/filter/object_groups_with_holes.cc
@@ -0,0 +1,71 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/primitive/group/from_single_link.hh>
+#include <scribo/filter/object_groups_with_holes.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
+
+ const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
+ const unsigned filtered_ref[] = { 0, 0, 7, 3, 0, 3, 3, 7, 7, 3, 3, 3, 3 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ object_groups<L> groups = primitive::group::from_single_link(links);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == ref[g]);
+
+ groups = filter::object_groups_with_holes(groups, 3);
+
+ for_all_groups(g, groups)
+ mln_assertion(groups(g) == filtered_ref[g]);
+}
diff --git a/scribo/tests/filter/object_links_bbox_h_ratio.cc b/scribo/tests/filter/object_links_bbox_h_ratio.cc
new file mode 100644
index 0000000..38be9b7
--- /dev/null
+++ b/scribo/tests/filter/object_links_bbox_h_ratio.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_bbox_h_ratio.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 1, 6, 3, 3, 5, 6, 7, 8, 9 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_bbox_h_ratio(links, 1.2f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_bbox_overlap.cc b/scribo/tests/filter/object_links_bbox_overlap.cc
new file mode 100644
index 0000000..a548e47
--- /dev/null
+++ b/scribo/tests/filter/object_links_bbox_overlap.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_bbox_overlap.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/wildly.pbm";
+
+ const unsigned ref[] = { 0, 1, 1 };
+ const unsigned filtered_ref[] = { 0, 1, 2 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_bbox_overlap(links, 0.1f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_bbox_w_ratio.cc b/scribo/tests/filter/object_links_bbox_w_ratio.cc
new file mode 100644
index 0000000..9ea699a
--- /dev/null
+++ b/scribo/tests/filter/object_links_bbox_w_ratio.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_bbox_w_ratio.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 1, 6, 8, 3, 5, 6, 7, 8, 4 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_bbox_w_ratio(links, 1.2f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_bottom_aligned.cc b/scribo/tests/filter/object_links_bottom_aligned.cc
new file mode 100644
index 0000000..2fe783f
--- /dev/null
+++ b/scribo/tests/filter/object_links_bottom_aligned.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_bottom_aligned.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 1, 6, 3, 3, 5, 6, 7, 2, 9 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_bottom_aligned(links, 1.f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_center_aligned.cc b/scribo/tests/filter/object_links_center_aligned.cc
new file mode 100644
index 0000000..9c9e8cc
--- /dev/null
+++ b/scribo/tests/filter/object_links_center_aligned.cc
@@ -0,0 +1,70 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_center_aligned.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 1, 2, 3, 3, 5, 6, 7, 8, 9 };
+
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_center_aligned(links, 1.f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_left_aligned.cc b/scribo/tests/filter/object_links_left_aligned.cc
new file mode 100644
index 0000000..ce630f5
--- /dev/null
+++ b/scribo/tests/filter/object_links_left_aligned.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_left_aligned.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 2, 2, 8, 4, 4, 6, 9, 2, 4 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_left_aligned(links, 80.f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_right_aligned.cc b/scribo/tests/filter/object_links_right_aligned.cc
new file mode 100644
index 0000000..375ef9c
--- /dev/null
+++ b/scribo/tests/filter/object_links_right_aligned.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_right_aligned.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 2, 2, 8, 4, 4, 6, 9, 2, 4 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_right_aligned(links, 80.f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/filter/object_links_top_aligned.cc b/scribo/tests/filter/object_links_top_aligned.cc
new file mode 100644
index 0000000..fe6730d
--- /dev/null
+++ b/scribo/tests/filter/object_links_top_aligned.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2011 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.
+
+/// \file
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <scribo/core/def/lbl_type.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link.hh>
+#include <scribo/filter/object_links_top_aligned.hh>
+
+#include "tests/data.hh"
+
+int main()
+{
+ using namespace scribo;
+ using namespace mln;
+
+ std::string img = SCRIBO_IMG_DIR "/phillip.pbm";
+
+ const unsigned ref[] = { 0, 2, 6, 8, 3, 4, 6, 9, 2, 4 };
+ const unsigned filtered_ref[] = { 0, 1, 2, 3, 3, 4, 6, 7, 8, 9 };
+
+ image2d<bool> input;
+ io::pbm::load(input, img.c_str());
+
+ typedef scribo::def::lbl_type V;
+ typedef image2d<V> L;
+
+ V nbboxes;
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
+
+ object_links<L> links = primitive::link::with_single_left_link(text, 30);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == ref[l]);
+
+ links = scribo::filter::object_links_top_aligned(links, 1.f);
+
+ for_all_links(l, links)
+ mln_assertion(links(l) == filtered_ref[l]);
+}
diff --git a/scribo/tests/img/the_valleys.pbm b/scribo/tests/img/the_valleys.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..3d40b8417a9c971de4352f791618f2c7727e0d92
GIT binary patch
literal 1724
zcmd_oKZ_GV6aerITLe<LtwMAMY_!Q;{vgRA8ALQ#+!=x#wueMK5dWNqAOt3$kaE9)
z@snsmij?^Xmt~8TH_H~8gJGZV?PRk-bLqvYCiB}jdGF0@*9v#p<Ia;uFP?V}*vn&f
z+&%kr`u-iOmdg7ljCH!74_LXfS841uYV2P7sKq{<oWFX*%B9Nv|24Gr?6A$+M~Cd`
z>D%+}*}7-tQn^s6R$1*q0kXBowyRx#<K%K<Z?>EI7s9`)u`sp7mTU2KSsHg#(Oj4#
zqnZzrp9)V=d8#mi9|B}EpQz+UHGY*WAAA7K?c~Q6jR0ak+0dA;V<jw6U88i`$8R?j
zA2C&`1Xb)(ov9M|#IZX~{@2tiZCwX&=|qWHcJmb;^g-tIKG#W&sM4XFziNBb&_z_u
z^=mi8QmEA7$d36Ga;Q~h8Fie1?jfD{n6vJQfrLmJb-h3(>i(L9c(cOzD~MF8)0OgZ
zh_R#*M4D7+?o8=Luo&)>VmxY?s+Xz&qi(PSDa_5>>01;FHv~{t_ywthN`3Y+weZ%t
z<@yUyxmBz;ph$pk*c<F5YIq6ps$P-l{3G6sGZ11=M*?$h_Jn5|k2hgOJV2E*Sg2IZ
zgTojoqe+MlaskUYQOqhZQ#*zMsYD$@l;}fLKTfj3*BO7uUcpegSUJYVmgaf+CD8yT
zqo1gPYYvhWa`QX3Hd7kF{ASY~>mqg+WDihhvS^#xz>!q-dfoyHFb_%H_;aZi6+l^D
mY*F(yDb3aP)f9AojpD@Z(%U=r)=sVN(m0v^>#_pR#Qp{`{Oqm(
literal 0
HcmV?d00001
--
1.5.6.5