* src/debug/show_links_bbox_overlap.cc,
* src/debug/show_links_center_aligned.cc,
* src/debug/show_links_non_h_aligned.cc,
* src/debug/show_links_several_right.cc,
* src/debug/show_links_several_right_overlap.cc,
* src/debug/show_links_single_down.cc,
* src/debug/show_links_single_down_left_aligned.cc,
* src/debug/show_links_single_down_right_aligned.cc,
* src/debug/show_links_single_left.cc,
* src/debug/show_links_single_left_dmax_ratio.cc,
* src/debug/show_links_single_right.cc,
* src/debug/show_links_single_right_dmax_ratio.cc,
* src/debug/show_links_single_up.cc,
* src/debug/show_links_single_up_left_aligned.cc,
* src/debug/show_links_single_up_right_aligned.cc,
* src/debug/show_objects_large.cc,
* src/debug/show_objects_large_small.cc,
* src/debug/show_objects_small.cc,
* src/debug/show_objects_thick.cc,
* src/debug/show_objects_thin.cc,
* src/filter/objects_large.cc,
* src/filter/objects_small.cc,
* src/filter/objects_thick.cc,
* src/filter/objects_thin.cc,
* src/filter/objects_with_holes.cc,
* src/filter/objects_with_holes_pgm.cc,
* src/preprocessing/preprocess.cc,
* src/preprocessing/split_bg_fg.cc,
* src/preprocessing/unskew.cc,
* src/primitive/extract/extract_discontinued_hlines.cc,
* src/primitive/extract/extract_discontinued_lines.cc,
* src/primitive/extract/extract_discontinued_vlines.cc,
* src/primitive/extract/extract_thick_hlines.cc,
* src/primitive/extract/extract_thick_vlines.cc,
* src/primitive/find/find_discontinued_lines.cc,
* src/primitive/find/find_single_lines.cc,
* src/primitive/find/find_thick_and_single_lines.cc,
* src/primitive/find/find_thick_lines.cc,
* src/primitive/group/Makefile.am,
* src/primitive/group/group_from_double_link.cc,
* src/primitive/group/group_from_double_several_links.cc,
* src/primitive/group/group_from_several_left_links.cc,
* src/primitive/group/group_from_single_link.cc,
* src/table/erase.cc,
* src/text/cleantxt.cc: Here.
---
scribo/ChangeLog | 50 ++++++++++++++++
scribo/src/debug/show_links_bbox_overlap.cc | 19 +++---
scribo/src/debug/show_links_center_aligned.cc | 19 +++---
scribo/src/debug/show_links_non_h_aligned.cc | 25 +++++----
scribo/src/debug/show_links_several_right.cc | 27 ++++-----
.../src/debug/show_links_several_right_overlap.cc | 36 ++++++-----
scribo/src/debug/show_links_single_down.cc | 31 +++++-----
.../debug/show_links_single_down_left_aligned.cc | 24 ++++----
.../debug/show_links_single_down_right_aligned.cc | 27 +++++----
scribo/src/debug/show_links_single_left.cc | 31 +++++-----
.../src/debug/show_links_single_left_dmax_ratio.cc | 44 ++++++++------
scribo/src/debug/show_links_single_right.cc | 35 ++++++-----
.../debug/show_links_single_right_dmax_ratio.cc | 36 ++++++-----
scribo/src/debug/show_links_single_up.cc | 37 ++++++-----
.../src/debug/show_links_single_up_left_aligned.cc | 27 +++++----
.../debug/show_links_single_up_right_aligned.cc | 27 +++++----
scribo/src/debug/show_objects_large.cc | 27 +++++----
scribo/src/debug/show_objects_large_small.cc | 41 +++++--------
scribo/src/debug/show_objects_small.cc | 27 +++++----
scribo/src/debug/show_objects_thick.cc | 26 +++++----
scribo/src/debug/show_objects_thin.cc | 24 ++++----
scribo/src/filter/objects_large.cc | 30 +++++----
scribo/src/filter/objects_small.cc | 22 ++++---
scribo/src/filter/objects_thick.cc | 30 +++++----
scribo/src/filter/objects_thin.cc | 30 +++++----
scribo/src/filter/objects_with_holes.cc | 27 +++++----
scribo/src/filter/objects_with_holes_pgm.cc | 23 +++++---
scribo/src/preprocessing/preprocess.cc | 27 ++++++---
scribo/src/preprocessing/split_bg_fg.cc | 14 +++--
scribo/src/preprocessing/unskew.cc | 22 ++++---
.../extract/extract_discontinued_hlines.cc | 26 +++++----
.../extract/extract_discontinued_lines.cc | 47 ++++++++-------
.../extract/extract_discontinued_vlines.cc | 27 +++++----
.../src/primitive/extract/extract_thick_hlines.cc | 25 +++++----
.../src/primitive/extract/extract_thick_vlines.cc | 25 +++++----
.../src/primitive/find/find_discontinued_lines.cc | 17 +++--
scribo/src/primitive/find/find_single_lines.cc | 35 ++++++-----
.../primitive/find/find_thick_and_single_lines.cc | 29 +++++-----
scribo/src/primitive/find/find_thick_lines.cc | 20 +++---
scribo/src/primitive/group/Makefile.am | 15 ++---
.../src/primitive/group/group_from_double_link.cc | 61 ++++++++-----------
.../group/group_from_double_several_links.cc | 34 ++++++-----
.../group/group_from_several_left_links.cc | 32 +++++-----
.../src/primitive/group/group_from_single_link.cc | 62 ++++++++++----------
scribo/src/table/erase.cc | 15 +++--
scribo/src/text/cleantxt.cc | 45 ++++++++++-----
46 files changed, 769 insertions(+), 611 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index b186c47..4865134 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,55 @@
2010-08-09 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix compilation of Scribo tools.
+
+ * src/debug/show_links_bbox_overlap.cc,
+ * src/debug/show_links_center_aligned.cc,
+ * src/debug/show_links_non_h_aligned.cc,
+ * src/debug/show_links_several_right.cc,
+ * src/debug/show_links_several_right_overlap.cc,
+ * src/debug/show_links_single_down.cc,
+ * src/debug/show_links_single_down_left_aligned.cc,
+ * src/debug/show_links_single_down_right_aligned.cc,
+ * src/debug/show_links_single_left.cc,
+ * src/debug/show_links_single_left_dmax_ratio.cc,
+ * src/debug/show_links_single_right.cc,
+ * src/debug/show_links_single_right_dmax_ratio.cc,
+ * src/debug/show_links_single_up.cc,
+ * src/debug/show_links_single_up_left_aligned.cc,
+ * src/debug/show_links_single_up_right_aligned.cc,
+ * src/debug/show_objects_large.cc,
+ * src/debug/show_objects_large_small.cc,
+ * src/debug/show_objects_small.cc,
+ * src/debug/show_objects_thick.cc,
+ * src/debug/show_objects_thin.cc,
+ * src/filter/objects_large.cc,
+ * src/filter/objects_small.cc,
+ * src/filter/objects_thick.cc,
+ * src/filter/objects_thin.cc,
+ * src/filter/objects_with_holes.cc,
+ * src/filter/objects_with_holes_pgm.cc,
+ * src/preprocessing/preprocess.cc,
+ * src/preprocessing/split_bg_fg.cc,
+ * src/preprocessing/unskew.cc,
+ * src/primitive/extract/extract_discontinued_hlines.cc,
+ * src/primitive/extract/extract_discontinued_lines.cc,
+ * src/primitive/extract/extract_discontinued_vlines.cc,
+ * src/primitive/extract/extract_thick_hlines.cc,
+ * src/primitive/extract/extract_thick_vlines.cc,
+ * src/primitive/find/find_discontinued_lines.cc,
+ * src/primitive/find/find_single_lines.cc,
+ * src/primitive/find/find_thick_and_single_lines.cc,
+ * src/primitive/find/find_thick_lines.cc,
+ * src/primitive/group/Makefile.am,
+ * src/primitive/group/group_from_double_link.cc,
+ * src/primitive/group/group_from_double_several_links.cc,
+ * src/primitive/group/group_from_several_left_links.cc,
+ * src/primitive/group/group_from_single_link.cc,
+ * src/table/erase.cc,
+ * src/text/cleantxt.cc: Here.
+
+2010-08-09 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Catch up with the current interface of scribo::debug::usage.
* src/debug/show_links_bottom_aligned.cc,
diff --git a/scribo/src/debug/show_links_bbox_overlap.cc
b/scribo/src/debug/show_links_bbox_overlap.cc
index eae1cd3..477720d 100644
--- a/scribo/src/debug/show_links_bbox_overlap.cc
+++ b/scribo/src/debug/show_links_bbox_overlap.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/filter/object_links_bbox_overlap.hh>
@@ -64,10 +65,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show valid or invalid links according the bboxes overlap.",
+ "Show valid or invalid links according"
+ " the bboxes overlap.",
"input.pbm ratio output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
@@ -75,17 +76,17 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_links
- = primitive::link::with_single_right_link(objects);
+ = primitive::link::with_single_right_link(comps);
// Filtering.
object_links<L> hratio_filtered_links
- = filter::object_links_bbox_overlap(objects, right_links, atof(argv[2]));
+ = filter::object_links_bbox_overlap(right_links, atof(argv[2]));
// Debug image.
diff --git a/scribo/src/debug/show_links_center_aligned.cc
b/scribo/src/debug/show_links_center_aligned.cc
index dfcb775..727e7e9 100644
--- a/scribo/src/debug/show_links_center_aligned.cc
+++ b/scribo/src/debug/show_links_center_aligned.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/filter/object_links_center_aligned.hh>
@@ -62,10 +63,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show valid or invalid links according the horizontal alignment (based on center
line).",
+ "Show valid or invalid links according the "
+ "horizontal alignment (based on center line).",
"input.pbm max_alpha output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
@@ -73,17 +74,17 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_links
- = primitive::link::with_single_right_link(objects);
+ = primitive::link::with_single_right_link(comps);
// Filtering.
object_links<L> filtered_links
- = filter::object_links_center_aligned(objects, right_links, atof(argv[2]));
+ = filter::object_links_center_aligned(right_links, atof(argv[2]));
// Debug image.
image2d<value::rgb8> decision_image
diff --git a/scribo/src/debug/show_links_non_h_aligned.cc
b/scribo/src/debug/show_links_non_h_aligned.cc
index 04d3de5..89ddf62 100644
--- a/scribo/src/debug/show_links_non_h_aligned.cc
+++ b/scribo/src/debug/show_links_non_h_aligned.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,10 +38,10 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
-#include <scribo/filter/object_links_non_h_aligned.hh>
+#include <scribo/filter/object_links_non_aligned_simple.hh>
#include <scribo/debug/decision_image.hh>
#include <scribo/debug/links_decision_image.hh>
@@ -64,10 +65,11 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show valid or invalid links according the horizontal alignment (based on top
and bottom lines).",
+ "Show valid or invalid links according the "
+ "horizontal alignment (based on top and "
+ "bottom lines).",
"input.pbm delta output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
@@ -75,17 +77,18 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
-
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_links
- = primitive::link::with_single_right_link(objects);
+ = primitive::link::with_single_right_link(comps);
// Filtering.
object_links<L> filtered_links
- = filter::object_links_non_h_aligned(objects, right_links, atoi(argv[2]));
+ = filter::object_links_non_aligned_simple(right_links,
+ anchor::MassCenter,
+ atoi(argv[2]));
// Debug image.
diff --git a/scribo/src/debug/show_links_several_right.cc
b/scribo/src/debug/show_links_several_right.cc
index 05e4a74..a70b2fb 100644
--- a/scribo/src/debug/show_links_several_right.cc
+++ b/scribo/src/debug/show_links_several_right.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -28,8 +29,6 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/data/convert.hh>
-
#include <mln/value/rgb8.hh>
#include <mln/value/label_16.hh>
#include <mln/literal/colors.hh>
@@ -37,7 +36,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_several_right_links.hh>
#include <scribo/draw/bounding_boxes.hh>
@@ -49,8 +48,10 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
- { "max_nbh_dist", " Maximum distance for neighborhood search. (common
value : 30)" },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
+ { "max_nbh_dist", " Maximum distance for neighborhood search."
+ "(common value : 30)" },
{0, 0}
};
@@ -65,8 +66,7 @@ int main(int argc, char* argv[])
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful right links between components.",
"input.pbm max_nbh_dist output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
@@ -74,17 +74,12 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_link
- = primitive::link::with_several_right_links(objects, atoi(argv[2]));
-
- // Drawing links.
- mln::util::array<mln_result_(accu::center<mln_psite_(L)>)>
- mass_centers = labeling::compute(accu::meta::center(),
- objects, objects.nlabels());
+ = primitive::link::with_several_right_links(comps, atoi(argv[2]));
image2d<value::rgb8> decision_image
= scribo::debug::several_links_decision_image(input,
diff --git a/scribo/src/debug/show_links_several_right_overlap.cc
b/scribo/src/debug/show_links_several_right_overlap.cc
index f2824f3..05eb72e 100644
--- a/scribo/src/debug/show_links_several_right_overlap.cc
+++ b/scribo/src/debug/show_links_several_right_overlap.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/internal/link_several_dmax_base.hh>
#include <scribo/primitive/link/internal/compute_anchor.hh>
#include <scribo/primitive/link/compute_several.hh>
@@ -67,12 +68,16 @@ namespace scribo
typedef mln_site(L) P;
several_right_overlap_debug_functor(const I& input,
- const object_image(L)& objects,
+ const component_set<L>& comps,
float dmax)
- : super_(objects, dmax, 3)
+ : super_(comps, dmax)
{
+ this->anchors_.append(anchor::Top);
+ this->anchors_.append(anchor::Bottom);
+ this->anchors_.append(anchor::Center);
+
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, comps, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -86,8 +91,7 @@ namespace scribo
if (c.first() != anchor::Invalid)
{
mln_site(L)
- p = primitive::link::internal::compute_anchor(this->objects_,
- this->mass_centers_,
+ p = primitive::link::internal::compute_anchor(this->components_,
current_object,
c.first());
mln::draw::line(output_, p, c.second(), literal::green);
@@ -99,9 +103,9 @@ namespace scribo
mln_site(L)
start_point_(unsigned current_object, anchor::Type anchor)
{
- return primitive::link::internal::compute_anchor(this->objects_,
- this->mass_centers_,
- current_object, anchor);
+ return primitive::link::internal::compute_anchor(this->components_,
+ current_object,
+ anchor);
}
@@ -134,10 +138,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful right links between components.",
+ "Show sucessful/unsuccessful right links "
+ "between components.",
"input.pbm max_nbh_dist output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -146,12 +150,12 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
several_right_overlap_debug_functor<I, L> functor(input,
- objects, atof(argv[2]));
+ comps, atof(argv[2]));
primitive::link::compute_several(functor);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_down.cc
b/scribo/src/debug/show_links_single_down.cc
index 37325d2..342a08f 100644
--- a/scribo/src/debug/show_links_single_down.cc
+++ b/scribo/src/debug/show_links_single_down.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,8 +40,8 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
-#include <scribo/primitive/link/internal/link_ms_dmax_base.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/internal/link_single_dmax_base.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/draw/bounding_boxes.hh>
@@ -54,23 +55,23 @@ namespace scribo
template <typename I, typename L>
struct single_down_link_debug_functor
- : primitive::link::internal::link_ms_dmax_base<L,
- single_down_link_debug_functor<I, L> >
+ : primitive::link::internal::link_single_dmax_base<L,
+ single_down_link_debug_functor<I, L> >
{
typedef single_down_link_debug_functor<I, L> self_t;
typedef
- primitive::link::internal::link_ms_dmax_base<L, self_t> super_;
+ primitive::link::internal::link_single_dmax_base<L, self_t> super_;
public:
typedef mln_site(L) P;
single_down_link_debug_functor(const I& input,
- const object_image(L)& objects,
+ const component_set<L>& comps,
float dmax)
- : super_(objects, dmax, 0)
+ : super_(comps, dmax, anchor::Vertical)
{
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, comps, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -134,10 +135,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful down links between components.",
+ "Show sucessful/unsuccessful down links "
+ "between components.",
"input.pbm max_nbh_dist output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -146,11 +147,11 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_down_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
+ single_down_link_debug_functor<I, L> functor(input, comps, atof(argv[2]));
primitive::link::compute(functor);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_down_left_aligned.cc
b/scribo/src/debug/show_links_single_down_left_aligned.cc
index b094d6e..18eb04e 100644
--- a/scribo/src/debug/show_links_single_down_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_left_aligned.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_down_link.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/filter/object_links_left_aligned.hh>
@@ -54,7 +55,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "dmax", "The maximum lookup distance. (common value : 300)" },
{0, 0}
};
@@ -70,8 +72,7 @@ int main(int argc, char* argv[])
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful down links between components.",
"input.pbm dmax output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -80,20 +81,21 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
object_links<L>
- down_links = primitive::link::with_single_down_link(objects,
+ down_links = primitive::link::with_single_down_link(comps,
atof(argv[2]),
anchor::Left);
// Filtering.
- down_links = filter::object_links_left_aligned(objects, down_links, 5);
+ down_links = filter::object_links_left_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, objects, down_links,
+ scribo::debug::save_linked_bboxes_image(input, down_links,
literal::blue, literal::green,
- argv[3], anchor::ActualLeft);
+ anchor::ActualLeft,
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_down_right_aligned.cc
b/scribo/src/debug/show_links_single_down_right_aligned.cc
index 9a12c0d..6c53711 100644
--- a/scribo/src/debug/show_links_single_down_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_right_aligned.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_down_link.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/filter/object_links_right_aligned.hh>
@@ -54,7 +55,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "dmax", "The maximum lookup distance. (common value : 300)" },
{0, 0}
};
@@ -68,10 +70,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful down links between components.",
+ "Show sucessful/unsuccessful down links "
+ "between components.",
"input.pbm dmax output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -80,20 +82,21 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
object_links<L>
- down_links = primitive::link::with_single_down_link(objects,
+ down_links = primitive::link::with_single_down_link(comps,
atof(argv[2]),
anchor::Right);
// Filtering.
- down_links = filter::object_links_right_aligned(objects, down_links, 5);
+ down_links = filter::object_links_right_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, objects, down_links,
+ scribo::debug::save_linked_bboxes_image(input, down_links,
literal::blue, literal::green,
- argv[3], anchor::ActualRight);
+ anchor::ActualRight,
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_left.cc
b/scribo/src/debug/show_links_single_left.cc
index 8c55afc..bd79bbb 100644
--- a/scribo/src/debug/show_links_single_left.cc
+++ b/scribo/src/debug/show_links_single_left.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,7 +40,7 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/primitive/link/internal/link_single_dmax_base.hh>
#include <scribo/primitive/link/compute.hh>
@@ -55,23 +56,23 @@ namespace scribo
template <typename I, typename L>
struct single_left_link_debug_functor
- : primitive::link::internal::link_ms_dmax_base<L,
- single_left_link_debug_functor<I, L> >
+ : primitive::link::internal::link_single_dmax_base<L,
+ single_left_link_debug_functor<I, L> >
{
typedef single_left_link_debug_functor<I, L> self_t;
typedef
- primitive::link::internal::link_ms_dmax_base<L, self_t> super_;
+ primitive::link::internal::link_single_dmax_base<L, self_t> super_;
public:
typedef mln_site(L) P;
single_left_link_debug_functor(const I& input,
- const object_image(L)& objects,
+ const component_set<L>& components,
float dmax)
- : super_(objects, dmax)
+ : super_(components, dmax, anchor::Horizontal)
{
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, components, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -135,10 +136,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful left links between components.",
+ "Show sucessful/unsuccessful left links "
+ "between components.",
"input.pbm max_nbh_dist output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -147,12 +148,12 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> components
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_left_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
- primitive::link::compute(functor);
+ single_left_link_debug_functor<I, L> functor(input, components, atof(argv[2]));
+ primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_left_dmax_ratio.cc
b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
index e133507..9b48a42 100644
--- a/scribo/src/debug/show_links_single_left_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,9 +40,9 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_left_link_dmax_ratio.hh>
-#include <scribo/primitive/link/internal/link_ms_dmax_ratio_base.hh>
+#include <scribo/primitive/link/internal/link_single_dmax_ratio_base.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/draw/bounding_boxes.hh>
@@ -55,23 +56,27 @@ namespace scribo
template <typename I, typename L>
struct single_left_link_debug_functor
- : primitive::link::internal::link_ms_dmax_ratio_base<L,
- single_left_link_debug_functor<I, L> >
+ : primitive::link::internal::link_single_dmax_ratio_base<L,
+ primitive::link::internal::dmax_default,
+ single_left_link_debug_functor<I, L> >
{
typedef single_left_link_debug_functor<I, L> self_t;
+ typedef primitive::link::internal::dmax_default dmax_fun_t;
typedef
- primitive::link::internal::link_ms_dmax_ratio_base<L, self_t> super_;
+ primitive::link::internal::link_single_dmax_ratio_base<L,
+ dmax_fun_t,
+ self_t> super_;
public:
typedef mln_site(L) P;
single_left_link_debug_functor(const I& input,
- const object_image(L)& objects,
+ const component_set<L>& components,
float dmax_ratio)
- : super_(objects, dmax_ratio)
+ : super_(components, anchor::Horizontal, dmax_fun_t(dmax_ratio))
{
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, components, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -121,8 +126,10 @@ namespace scribo
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
- { "max_nbh_dist_ratio", "Size ratio defining the maximum lookup
distance. (common value : 3)" },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
+ { "max_nbh_dist_ratio", "Size ratio defining the maximum lookup
distance."
+ "(common value : 3)" },
{0, 0}
};
@@ -135,10 +142,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful left links between components.",
+ "Show sucessful/unsuccessful left links "
+ "between components.",
"input.pbm max_nbh_dist_ratio output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -147,12 +154,13 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> components
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_left_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
- primitive::link::compute(functor);
+ single_left_link_debug_functor<I, L>
+ functor(input, components, atof(argv[2]));
+ primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_right.cc
b/scribo/src/debug/show_links_single_right.cc
index 7a25306..0dd2ea3 100644
--- a/scribo/src/debug/show_links_single_right.cc
+++ b/scribo/src/debug/show_links_single_right.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,9 +40,9 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
-#include <scribo/primitive/link/internal/link_ms_dmax_base.hh>
+#include <scribo/primitive/link/internal/link_single_dmax_base.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/draw/bounding_boxes.hh>
@@ -55,23 +56,23 @@ namespace scribo
template <typename I, typename L>
struct single_right_link_debug_functor
- : primitive::link::internal::link_ms_dmax_base<L,
+ : primitive::link::internal::link_single_dmax_base<L,
single_right_link_debug_functor<I, L> >
{
typedef single_right_link_debug_functor<I, L> self_t;
typedef
- primitive::link::internal::link_ms_dmax_base<L, self_t> super_;
+ primitive::link::internal::link_single_dmax_base<L, self_t> super_;
public:
typedef mln_site(L) P;
single_right_link_debug_functor(const I& input,
- const object_image(L)& objects,
+ const component_set<L>& components,
float dmax)
- : super_(objects, dmax)
+ : super_(components, dmax, anchor::Horizontal)
{
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, components, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -121,7 +122,8 @@ namespace scribo
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "max_nbh_dist", "The maximum lookup distance. (common value :
30)" },
{0, 0}
};
@@ -135,10 +137,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful right links between components.",
+ "Show sucessful/unsuccessful right links "
+ "between components.",
"input.pbm max_nbh_dist output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -147,12 +149,13 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> components
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_right_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
- primitive::link::compute(functor);
+ single_right_link_debug_functor<I, L>
+ functor(input, components, atof(argv[2]));
+ primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_right_dmax_ratio.cc
b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
index 806114c..5b292ed 100644
--- a/scribo/src/debug/show_links_single_right_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,9 +40,9 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link_dmax_ratio.hh>
-#include <scribo/primitive/link/internal/link_ms_dmax_ratio_base.hh>
+#include <scribo/primitive/link/internal/link_single_dmax_ratio_base.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/draw/bounding_boxes.hh>
@@ -55,23 +56,25 @@ namespace scribo
template <typename I, typename L>
struct single_right_link_debug_functor
- : primitive::link::internal::link_ms_dmax_ratio_base<L,
- single_right_link_debug_functor<I, L> >
+ : primitive::link::internal::link_single_dmax_ratio_base<L,
+ primitive::link::internal::dmax_default,
+ single_right_link_debug_functor<I, L> >
{
typedef single_right_link_debug_functor<I, L> self_t;
+ typedef primitive::link::internal::dmax_default dmax_fun_t;
typedef
- primitive::link::internal::link_ms_dmax_ratio_base<L, self_t> super_;
+ primitive::link::internal::link_single_dmax_ratio_base<L, dmax_fun_t, self_t>
super_;
public:
typedef mln_site(L) P;
single_right_link_debug_functor(const I& input,
- const object_image(L)& objects,
+ const component_set<L>& components,
float dmax_ratio)
- : super_(objects, dmax_ratio)
+ : super_(components, anchor::Horizontal, dmax_fun_t(dmax_ratio))
{
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, components, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -135,10 +138,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful right links between components.",
+ "Show sucessful/unsuccessful right links "
+ "between components.",
"input.pbm max_nbh_dist_ratio output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -147,12 +150,13 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> components
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_right_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
- primitive::link::compute(functor);
+ single_right_link_debug_functor<I, L>
+ functor(input, components, atof(argv[2]));
+ primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_up.cc
b/scribo/src/debug/show_links_single_up.cc
index 59c8ce5..d71b1fe 100644
--- a/scribo/src/debug/show_links_single_up.cc
+++ b/scribo/src/debug/show_links_single_up.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,8 +40,8 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
-#include <scribo/primitive/link/internal/link_ms_dmax_base.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/internal/link_single_dmax_base.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/draw/bounding_boxes.hh>
@@ -54,23 +55,23 @@ namespace scribo
template <typename I, typename L>
struct single_up_link_debug_functor
- : primitive::link::internal::link_ms_dmax_base<L,
+ : primitive::link::internal::link_single_dmax_base<L,
single_up_link_debug_functor<I, L> >
{
typedef single_up_link_debug_functor<I, L> self_t;
typedef
- primitive::link::internal::link_ms_dmax_base<L, self_t> super_;
+ primitive::link::internal::link_single_dmax_base<L, self_t> super_;
public:
typedef mln_site(L) P;
single_up_link_debug_functor(const I& input,
- const object_image(L)& objects,
- float dmax)
- : super_(objects, dmax)
+ const component_set<L>& components,
+ float dmax)
+ : super_(components, dmax, anchor::Vertical)
{
output_ = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output_, objects, literal::blue);
+ scribo::draw::bounding_boxes(output_, components, literal::blue);
mln_postcondition(output_.is_valid());
}
@@ -120,7 +121,8 @@ namespace scribo
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "max_nbh_dist", "The maximum lookup distance. (common value :
30)" },
{0, 0}
};
@@ -134,10 +136,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful up links between components.",
+ "Show sucessful/unsuccessful up links "
+ "between components.",
"input.pbm max_nbh_dist output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -146,12 +148,13 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> components
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_up_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
- primitive::link::compute(functor);
+ single_up_link_debug_functor<I, L>
+ functor(input, components, atof(argv[2]));
+ primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_up_left_aligned.cc
b/scribo/src/debug/show_links_single_up_left_aligned.cc
index 5239619..2bb865f 100644
--- a/scribo/src/debug/show_links_single_up_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_left_aligned.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_up_link.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/filter/object_links_left_aligned.hh>
@@ -54,7 +55,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "dmax", "The maximum lookup distance. (common value : 300)" },
{0, 0}
};
@@ -68,10 +70,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful up links between components.",
+ "Show sucessful/unsuccessful up links "
+ "between components.",
"input.pbm dmax output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -80,21 +82,22 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
object_links<L>
- up_links = primitive::link::with_single_up_link(objects,
+ up_links = primitive::link::with_single_up_link(comps,
atof(argv[2]),
anchor::Left);
// Filtering.
- up_links = filter::object_links_left_aligned(objects, up_links, 5);
+ up_links = filter::object_links_left_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, objects, up_links,
+ scribo::debug::save_linked_bboxes_image(input, up_links,
literal::blue, literal::green,
- argv[3], anchor::ActualLeft);
+ anchor::ActualLeft,
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_up_right_aligned.cc
b/scribo/src/debug/show_links_single_up_right_aligned.cc
index 8c1841e..5cba3b4 100644
--- a/scribo/src/debug/show_links_single_up_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_right_aligned.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_up_link.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/filter/object_links_right_aligned.hh>
@@ -54,7 +55,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "dmax", "The maximum lookup distance. (common value : 300)" },
{0, 0}
};
@@ -68,10 +70,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
- "Show sucessful/unsuccessful up links between components.",
+ "Show sucessful/unsuccessful up links "
+ "between components.",
"input.pbm dmax output.ppm",
- args_desc,
- "A color image. Valid links are drawn in green, invalid ones in red.");
+ args_desc);
typedef image2d<bool> I;
I input;
@@ -80,19 +82,20 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
object_links<L>
- up_links = primitive::link::with_single_up_link(objects,
+ up_links = primitive::link::with_single_up_link(comps,
atof(argv[2]),
anchor::Right);
// Filtering.
- up_links = filter::object_links_right_aligned(objects, up_links, 5);
+ up_links = filter::object_links_right_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, objects, up_links,
+ scribo::debug::save_linked_bboxes_image(input, up_links,
literal::blue, literal::green,
- argv[3], anchor::ActualRight);
+ anchor::ActualRight,
+ argv[3]);
}
diff --git a/scribo/src/debug/show_objects_large.cc
b/scribo/src/debug/show_objects_large.cc
index aac7a9f..a09ea78 100644
--- a/scribo/src/debug/show_objects_large.cc
+++ b/scribo/src/debug/show_objects_large.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_large.hh>
#include <scribo/draw/bounding_boxes.hh>
#include <scribo/debug/usage.hh>
@@ -45,7 +46,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "max_card", " Maximum cardinality in a component." },
{0, 0}
};
@@ -54,13 +56,14 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
- "Show components having a too high cardinality.",
+ "Show components having a too high "
+ "cardinality.",
"input.pbm min_card output.ppm",
- args_desc,
- "A color image. Components with high cardinality have their bounding boxes drawn
in red, others in green.");
+ args_desc);
trace::entering("main");
@@ -69,16 +72,16 @@ int main(int argc, char *argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
image2d<value::rgb8> output = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output, objects, literal::red);
+ scribo::draw::bounding_boxes(output, comps, literal::red);
- object_image(L) filtered_objects
- = scribo::filter::objects_large(objects, atoi(argv[2]));
- scribo::draw::bounding_boxes(output, filtered_objects, literal::green);
+ component_set<L> filtered_comps
+ = scribo::filter::components_large(comps, atoi(argv[2]));
+ scribo::draw::bounding_boxes(output, filtered_comps, literal::green);
io::ppm::save(output, argv[3]);
}
diff --git a/scribo/src/debug/show_objects_large_small.cc
b/scribo/src/debug/show_objects_large_small.cc
index e72e5e1..35062d3 100644
--- a/scribo/src/debug/show_objects_large_small.cc
+++ b/scribo/src/debug/show_objects_large_small.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,17 +38,18 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_large.hh>
#include <scribo/filter/objects_small.hh>
#include <scribo/draw/bounding_boxes.hh>
#include <scribo/debug/usage.hh>
-#include <scribo/debug/save_object_diff.hh>
+#include <scribo/debug/save_comp_diff.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "min_card", " Minimum cardinality in a component." },
{ "max_card", " Maximum cardinality in a component." },
{0, 0}
@@ -57,13 +59,14 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 5)
return scribo::debug::usage(argv,
- "Show components not being too small nor too large.",
+ "Show components not being too small nor too"
+ "large.",
"input.pbm min_card max_card output.ppm",
- args_desc,
- "A color image. Too small components are drawn in red, too large components in
orange and others in green.");
+ args_desc);
trace::entering("main");
@@ -72,29 +75,17 @@ int main(int argc, char *argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
- object_image(L) filter(objects);
+ component_set<L> filter(comps);
if (atoi(argv[2]) != 0)
- filter = scribo::filter::objects_small(filter, atoi(argv[2]));
+ filter = scribo::filter::components_small(filter, atoi(argv[2]));
if (atoi(argv[3]) != 0)
- filter = scribo::filter::objects_large(filter, atoi(argv[3]));
+ filter = scribo::filter::components_large(filter, atoi(argv[3]));
- image2d<value::rgb8> output;
- initialize(output, objects);
- data::fill(output, literal::black);
-
- for_all_components(i, objects.bboxes())
- data::fill(((output | objects.bbox(i)).rw() | (pw::value(objects) == i)).rw(),
literal::red);
-
- for_all_components(i, filter.bboxes())
- data::fill(((output | filter.bbox(i)).rw() | (pw::value(filter) == i)).rw(),
literal::green);
-
-
-
- io::ppm::save(output, argv[4]);
+ scribo::debug::save_comp_diff(comps, filter, argv[4]);
}
diff --git a/scribo/src/debug/show_objects_small.cc
b/scribo/src/debug/show_objects_small.cc
index a5afb26..ce6ee18 100644
--- a/scribo/src/debug/show_objects_small.cc
+++ b/scribo/src/debug/show_objects_small.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_small.hh>
#include <scribo/draw/bounding_boxes.hh>
#include <scribo/debug/usage.hh>
@@ -45,7 +46,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. True for objects and False for the
background." },
+ { "input.pbm", "A binary image. True for objects and False for the
"
+ "background." },
{ "min_card", " Minimum cardinality in a component.. (Common value :
6)" },
{0, 0}
};
@@ -54,13 +56,14 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
- "Show components having a too low cardinality.",
+ "Show components having a too low "
+ "cardinality.",
"input.pbm min_card output.ppm",
- args_desc,
- "A color image. Components with low cardinality have their bounding boxes drawn
in red, others in green.");
+ args_desc);
trace::entering("main");
@@ -69,16 +72,16 @@ int main(int argc, char *argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
image2d<value::rgb8> output = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output, objects, literal::red);
+ scribo::draw::bounding_boxes(output, comps, literal::red);
- object_image(L) filtered_objects
- = scribo::filter::objects_small(objects, atoi(argv[2]));
- scribo::draw::bounding_boxes(output, filtered_objects, literal::green);
+ component_set<L> filtered_comps
+ = scribo::filter::components_small(comps, atoi(argv[2]));
+ scribo::draw::bounding_boxes(output, filtered_comps, literal::green);
io::ppm::save(output, argv[3]);
}
diff --git a/scribo/src/debug/show_objects_thick.cc
b/scribo/src/debug/show_objects_thick.cc
index 4157ac3..728e55f 100644
--- a/scribo/src/debug/show_objects_thick.cc
+++ b/scribo/src/debug/show_objects_thick.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,15 +38,16 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
-#include <scribo/filter/objects_thin.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/filter/objects_thick.hh>
#include <scribo/draw/bounding_boxes.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
- { "input.pbm", " A binary image. True for objects and False for the
background." },
+ { "input.pbm", " A binary image. True for objects and False for the
"
+ "background." },
{ "max_thickness", "Maximum bounding box thickness. (common value:
300)" },
{0, 0}
};
@@ -54,13 +56,13 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Show components being to thick.",
"input.pbm max_thickness output.ppm",
- args_desc,
- "A color image. Too thick components have their bounding boxes drawn in
red.");
+ args_desc);
trace::entering("main");
@@ -69,16 +71,16 @@ int main(int argc, char *argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
image2d<value::rgb8> output = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output, objects, literal::red);
+ scribo::draw::bounding_boxes(output, comps, literal::red);
- object_image(L) filtered_objects
- = scribo::filter::objects_thin(objects, atoi(argv[2]));
- scribo::draw::bounding_boxes(output, filtered_objects, literal::green);
+ component_set<L> filtered_comps
+ = scribo::filter::objects_thick(comps, atoi(argv[2]));
+ scribo::draw::bounding_boxes(output, filtered_comps, literal::green);
io::ppm::save(output, argv[3]);
}
diff --git a/scribo/src/debug/show_objects_thin.cc
b/scribo/src/debug/show_objects_thin.cc
index 4223fef..3479fd6 100644
--- a/scribo/src/debug/show_objects_thin.cc
+++ b/scribo/src/debug/show_objects_thin.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_thin.hh>
#include <scribo/draw/bounding_boxes.hh>
#include <scribo/debug/usage.hh>
@@ -45,7 +46,8 @@
const char *args_desc[][2] =
{
- { "input.pbm", " A binary image. True for objects and False for the
background." },
+ { "input.pbm", " A binary image. True for objects and False for the
"
+ "background." },
{ "min_thickness", "Minimum bounding box thickness. (common value:
1)" },
{0, 0}
};
@@ -54,13 +56,13 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Show components being to thin.",
"input.pbm min_thickness output.ppm",
- args_desc,
- "A color image. Too thin components have their bounding boxes drawn in
red.");
+ args_desc);
trace::entering("main");
@@ -69,16 +71,16 @@ int main(int argc, char *argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- object_image(L) objects
- = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nbboxes);
image2d<value::rgb8> output = data::convert(value::rgb8(), input);
- scribo::draw::bounding_boxes(output, objects, literal::red);
+ scribo::draw::bounding_boxes(output, comps, literal::red);
- object_image(L) filtered_objects
- = scribo::filter::objects_thin(objects, atoi(argv[2]));
- scribo::draw::bounding_boxes(output, filtered_objects, literal::green);
+ component_set<L> filtered_comps
+ = scribo::filter::components_thin(comps, atoi(argv[2]));
+ scribo::draw::bounding_boxes(output, filtered_comps, literal::green);
io::ppm::save(output, argv[3]);
}
diff --git a/scribo/src/filter/objects_large.cc b/scribo/src/filter/objects_large.cc
index a665032..a017467 100644
--- a/scribo/src/filter/objects_large.cc
+++ b/scribo/src/filter/objects_large.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -30,28 +31,29 @@
#include <mln/value/label_16.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_large.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. 'True' for objects,
'False'\
-for the background." },
- { "max_area", "The maximum object area value. Objects with an area
greater\
-than this value are removed." },
+ { "input.pbm", "A binary image. 'True' for objects,
'False' for the "
+ "background." },
+ { "max_area", "The maximum object area value. Objects with an area
greater"
+ " than this value are removed." },
{0, 0}
};
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Filter too large objects",
"input.pbm max_area output.pbm",
- args_desc,
- "A binary image.");
+ args_desc);
trace::entering("main");
@@ -59,13 +61,15 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- value::label_16 nobjects;
- typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
- obj_ima_t objects
- = scribo::primitive::extract::objects(input, c8(), nobjects);
+ typedef value::label_16 V;
+ V nobjects;
+ typedef image2d<V> L;
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::objects_large(objects, atoi(argv[2]));
- io::pbm::save(data::convert(bool(), filtered), argv[3]);
+ component_set<L>
+ filtered = scribo::filter::components_large(comps, atoi(argv[2]));
+ io::pbm::save(data::convert(bool(), filtered.labeled_image()), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/objects_small.cc b/scribo/src/filter/objects_small.cc
index ce57f00..977c7b1 100644
--- a/scribo/src/filter/objects_small.cc
+++ b/scribo/src/filter/objects_small.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -29,6 +30,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_small.hh>
#include <scribo/debug/usage.hh>
@@ -44,13 +46,13 @@ or equal to this value are removed." },
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Filter too small objects",
"input.pbm min_area output.pbm",
- args_desc,
- "A binary image.");
+ args_desc);
trace::entering("main");
@@ -58,13 +60,15 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- value::label_16 nobjects;
- typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
- obj_ima_t objects
- = scribo::primitive::extract::objects(input, c8(), nobjects);
+ typedef value::label_16 V;
+ V nobjects;
+ typedef image2d<V> L;
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::objects_small(objects, atoi(argv[2]));
- io::pbm::save(data::convert(bool(), filtered), argv[3]);
+ component_set<L>
+ filtered = scribo::filter::components_small(comps, atoi(argv[2]));
+ io::pbm::save(data::convert(bool(), filtered.labeled_image()), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/objects_thick.cc b/scribo/src/filter/objects_thick.cc
index 495c9e0..2b0a235 100644
--- a/scribo/src/filter/objects_thick.cc
+++ b/scribo/src/filter/objects_thick.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -29,28 +30,29 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_thick.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. 'True' for objects,
'False'\
-for the background." },
- { "max_thick", "The maximum object thickness value. Objects with
bounding\
-box hight or width higher than this value are removed." },
+ { "input.pbm", "A binary image. 'True' for objects,
'False' for the "
+ "background." },
+ { "max_thick", "The maximum object thickness value. Objects with
bounding"
+ " box hight or width higher than this value are removed." },
{0, 0}
};
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Filter too thick objects",
"input.pbm max_thick output.pbm",
- args_desc,
- "A binary image.");
+ args_desc);
trace::entering("main");
@@ -58,13 +60,15 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- value::label_16 nobjects;
- typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
- obj_ima_t objects
- = scribo::primitive::extract::objects(input, c8(), nobjects);
+ typedef value::label_16 V;
+ V nobjects;
+ typedef image2d<V> L;
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::objects_thick(objects, atoi(argv[2]));
- io::pbm::save(data::convert(bool(), filtered), argv[3]);
+ component_set<L>
+ filtered = scribo::filter::objects_thick(comps, atoi(argv[2]));
+ io::pbm::save(data::convert(bool(), filtered.labeled_image()), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/objects_thin.cc b/scribo/src/filter/objects_thin.cc
index d1be415..b537184 100644
--- a/scribo/src/filter/objects_thin.cc
+++ b/scribo/src/filter/objects_thin.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -29,28 +30,29 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_thin.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. 'True' for objects,
'False'\
-for the background." },
- { "min_thin", "The minimum object thinness value. Objects with
bounding\
-box hight or width less than or equal to this value are removed." },
+ { "input.pbm", "A binary image. 'True' for objects,
'False' for the "
+ "background." },
+ { "min_thin", "The minimum object thinness value. Objects with bounding
"
+ "box hight or width less than or equal to this value are removed." },
{0, 0}
};
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Filter too thin objects",
"input.pbm min_thin output.pbm",
- args_desc,
- "A binary image.");
+ args_desc);
trace::entering("main");
@@ -58,13 +60,15 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- value::label_16 nobjects;
- typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
- obj_ima_t objects
- = scribo::primitive::extract::objects(input, c8(), nobjects);
+ typedef value::label_16 V;
+ V nobjects;
+ typedef image2d<V> L;
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::objects_thin(objects, atoi(argv[2]));
- io::pbm::save(data::convert(bool(), filtered), argv[3]);
+ component_set<L>
+ filtered = scribo::filter::components_thin(comps, atoi(argv[2]));
+ io::pbm::save(data::convert(bool(), filtered.labeled_image()), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/objects_with_holes.cc
b/scribo/src/filter/objects_with_holes.cc
index 0ebf89f..20fe839 100644
--- a/scribo/src/filter/objects_with_holes.cc
+++ b/scribo/src/filter/objects_with_holes.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -29,13 +30,14 @@
#include <mln/io/pbm/all.hh>
#include <mln/value/label_16.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/filter/objects_with_holes.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. 'True' for objects,
'False'\
-for the background." },
+ { "input.pbm", "A binary image. 'True' for objects,
'False' for the "
+ "background." },
{ "min_holes_count", "The minimum holes per objects." },
{0, 0}
};
@@ -43,13 +45,13 @@ for the background." },
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Filter objects with holes",
"input.pbm min_holes_count output.pbm",
- args_desc,
- "A binary image.");
+ args_desc);
trace::entering("main");
@@ -57,13 +59,16 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- value::label_16 nobjects;
- typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
- obj_ima_t objects
- = scribo::primitive::extract::objects(input, c8(), nobjects);
+ typedef value::label_16 V;
+ V nobjects;
+ typedef image2d<V> L;
+ component_set<L> comps
+ = scribo::primitive::extract::components(input, c8(), nobjects);
- obj_ima_t filtered = scribo::filter::objects_with_holes(objects, atoi(argv[2]));
- io::pbm::save(data::convert(bool(), filtered), argv[3]);
+ component_set<L>
+ filtered = scribo::filter::objects_with_holes(comps, atoi(argv[2]), 0);
+
+ io::pbm::save(data::convert(bool(), filtered.valid_comps_image_()), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/filter/objects_with_holes_pgm.cc
b/scribo/src/filter/objects_with_holes_pgm.cc
index c834538..40988c8 100644
--- a/scribo/src/filter/objects_with_holes_pgm.cc
+++ b/scribo/src/filter/objects_with_holes_pgm.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,8 +38,8 @@
const char *args_desc[][2] =
{
- { "input.pgm", "A label image. 'True' for objects,
'False'\
-for the background." },
+ { "input.pgm", "A labeled image. 'True' for objects,
'False' for the "
+ "background." },
{ "min_holes_count", "The minimum holes per objects." },
{0, 0}
};
@@ -46,13 +47,13 @@ for the background." },
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Filter objects with holes",
"input.pgm min_holes_count output.pbm",
- args_desc,
- "A binary image.");
+ args_desc);
trace::entering("main");
@@ -60,11 +61,15 @@ int main(int argc, char *argv[])
I input;
io::pgm::load(input, argv[1]);
- value::label_8 nobjects = data::compute(accu::meta::stat::max(), input);
- object_image(I) objects(input, nobjects);
+ typedef value::label_8 V;
+ typedef image2d<V> L;
- object_image(I) filtered = scribo::filter::objects_with_holes(objects, atoi(argv[2]));
- io::pbm::save(data::convert(bool(), filtered), argv[3]);
+ V nobjects = data::compute(accu::meta::stat::max(), input);
+ component_set<L> comps(input, nobjects);
+
+ component_set<L>
+ filtered = scribo::filter::objects_with_holes(comps, atoi(argv[2]), 0);
+ io::pbm::save(data::convert(bool(), filtered.valid_comps_image_()), argv[3]);
trace::exiting("main");
diff --git a/scribo/src/preprocessing/preprocess.cc
b/scribo/src/preprocessing/preprocess.cc
index 8c34930..322bfef 100644
--- a/scribo/src/preprocessing/preprocess.cc
+++ b/scribo/src/preprocessing/preprocess.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -25,6 +26,8 @@
#include <mln/core/image/image2d.hh>
+#include <mln/data/convert.hh>
+
#include <mln/value/int_u8.hh>
#include <mln/value/label_16.hh>
@@ -33,8 +36,8 @@
#include <mln/logical/not.hh>
-#include <scribo/binarization/simple.hh>
-#include <scribo/preprocessing/unskew.hh>
+#include <scribo/binarization/global_threshold_auto.hh>
+#include <scribo/preprocessing/deskew.hh>
#include <scribo/filter/objects_small.hh>
#include <scribo/filter/objects_thin.hh>
@@ -54,7 +57,7 @@ int main(int argc, char *argv[])
return scribo::debug::usage(argv,
"Generic image preprocessing",
"input.pgm output.pbm",
- args_desc, "A binary image.");
+ args_desc);
trace::entering("main");
@@ -62,13 +65,19 @@ int main(int argc, char *argv[])
I input;
io::pgm::load(input, argv[1]);
- image2d<bool> input_bw = scribo::binarization::simple(input);
+ image2d<bool>
+ input_bw = scribo::binarization::global_threshold_auto(input);
logical::not_inplace(input_bw);
- 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();
+ input_bw = scribo::filter::components_small(input_bw, c8(),
+ value::label_16(), 3);
+ input_bw = scribo::filter::components_thin(input_bw, c8(),
+ value::label_16(), 1);
+
+ image2d<value::int_u8>
+ input_gl = data::convert(value::int_u8(), input_bw);
+ input_gl = scribo::preprocessing::deskew(input_gl);
+ input_bw = data::convert(bool(), input_gl);
logical::not_inplace(input_bw);
io::pbm::save(input_bw, argv[2]);
diff --git a/scribo/src/preprocessing/split_bg_fg.cc
b/scribo/src/preprocessing/split_bg_fg.cc
index de7bd02..270093c 100644
--- a/scribo/src/preprocessing/split_bg_fg.cc
+++ b/scribo/src/preprocessing/split_bg_fg.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -24,7 +25,8 @@
// executable file might be covered by the GNU General Public License.
#include <mln/core/image/image2d.hh>
-#include <mln/io/ppm/all.hh>
+#include <mln/io/magick/load.hh>
+#include <mln/io/ppm/save.hh>
#include <scribo/preprocessing/split_bg_fg.hh>
#include <scribo/debug/usage.hh>
@@ -32,7 +34,7 @@
const char *args_desc[][2] =
{
- { "input.pbm", "A color image." },
+ { "input.*", "An image." },
{ "lambda", "Lambda value. (FIX Description)" },
{ "delta", "Delta value. (FIX Description)" },
{ "fg.ppm", "The foreground image (1st output)." },
@@ -50,12 +52,12 @@ int main(int argc, char *argv[])
if (argc != 6)
return scribo::debug::usage(argv,
"Split background and foreground.",
- "input.pbm lambda delta fg.ppm bg.ppm",
- args_desc, "The foreground image.");
+ "input.* lambda delta fg.ppm bg.ppm",
+ args_desc);
typedef image2d<value::rgb8> I;
I input;
- io::ppm::load(input, argv[1]);
+ io::magick::load(input, argv[1]);
util::couple<I,I>
bg_fg = scribo::preprocessing::split_bg_fg(input,
diff --git a/scribo/src/preprocessing/unskew.cc b/scribo/src/preprocessing/unskew.cc
index b8c1979..9ac32ec 100644
--- a/scribo/src/preprocessing/unskew.cc
+++ b/scribo/src/preprocessing/unskew.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -24,15 +25,16 @@
// executable file might be covered by the GNU General Public License.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/all.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/all.hh>
-#include <scribo/preprocessing/unskew.hh>
+#include <scribo/preprocessing/deskew.hh>
#include <scribo/debug/usage.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. 'True' for objects,
'false' for background." },
+ { "input.pgm", "A gray level image." },
{0, 0}
};
@@ -45,14 +47,14 @@ int main(int argc, char *argv[])
if (argc != 3)
return scribo::debug::usage(argv,
- "Unskew a binary image",
- "input.pbm output.pbm",
- args_desc, "A binary image.");
+ "Unskew a gray level image",
+ "input.pgm output.pgm",
+ args_desc);
- image2d<bool> input;
- io::pbm::load(input, argv[1]);
+ image2d<value::int_u8> input;
+ io::pgm::load(input, argv[1]);
- io::pbm::save(scribo::preprocessing::unskew(input).first(), argv[2]);
+ io::pgm::save(scribo::preprocessing::deskew(input), argv[2]);
mln::trace::exiting("main");
}
diff --git a/scribo/src/primitive/extract/extract_discontinued_hlines.cc
b/scribo/src/primitive/extract/extract_discontinued_hlines.cc
index 127ca0f..67498af 100644
--- a/scribo/src/primitive/extract/extract_discontinued_hlines.cc
+++ b/scribo/src/primitive/extract/extract_discontinued_hlines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -44,28 +45,29 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 5)
return scribo::debug::usage(argv,
"Extract discontinued horizontal lines",
"input.pbm length rank output.pbm",
- args_desc,
- "A binary image of horizontal lines.");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- value::label_16 nlines;
- image2d<bool> lines
- = data::convert(bool(),
- scribo::primitive::extract::lines_h_discontinued(input,
- c8(),
- nlines,
- atoi(argv[2]),
- atoi(argv[3])));
- io::pbm::save(lines, argv[4]);
+ typedef value::label_16 V;
+ typedef image2d<V> L;
+ V nlines;
+ component_set<L>
+ lines = scribo::primitive::extract::lines_h_discontinued(input,
+ c8(),
+ nlines,
+ atoi(argv[2]),
+ atoi(argv[3]));
+ io::pbm::save(data::convert(bool(), lines.labeled_image()), argv[4]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/extract/extract_discontinued_lines.cc
b/scribo/src/primitive/extract/extract_discontinued_lines.cc
index da3faf9..e5f1483 100644
--- a/scribo/src/primitive/extract/extract_discontinued_lines.cc
+++ b/scribo/src/primitive/extract/extract_discontinued_lines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -45,38 +46,42 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 5)
return scribo::debug::usage(argv,
"Extract discontinued horizontal and vertical lines",
"input.pbm length rank output.pbm",
- args_desc,
- "A binary image of horizontal and vertical lines.");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- value::label_16 nhlines;
- image2d<bool> hlines
- = data::convert(bool(),
- scribo::primitive::extract::lines_h_discontinued(input,
- c8(),
- nhlines,
- atoi(argv[2]),
- atoi(argv[3])));
- value::label_16 nvlines;
- image2d<bool> vlines
- = data::convert(bool(),
- scribo::primitive::extract::lines_v_discontinued(input,
- c8(),
- nvlines,
- atoi(argv[2]),
- atoi(argv[3])));
+ typedef value::label_16 V;
+ typedef image2d<V> L;
- data::fill((hlines | pw::value(vlines)).rw(), true);
- io::pbm::save(hlines, argv[4]);
+ V nhlines;
+ component_set<L>
+ hlines = scribo::primitive::extract::lines_h_discontinued(input,
+ c8(),
+ nhlines,
+ atoi(argv[2]),
+ atoi(argv[3]));
+
+ V nvlines;
+ component_set<L> vlines
+ = scribo::primitive::extract::lines_v_discontinued(input,
+ c8(),
+ nvlines,
+ atoi(argv[2]),
+ atoi(argv[3]));
+
+ L& hlines_ima = hlines.labeled_image_();
+ image2d<bool> output = data::convert(bool(), hlines_ima);
+ data::fill((output | (pw::value(vlines.labeled_image()) != 0u)).rw(), true);
+ io::pbm::save(output, argv[4]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/extract/extract_discontinued_vlines.cc
b/scribo/src/primitive/extract/extract_discontinued_vlines.cc
index 5e71ec0..68cd7d9 100644
--- a/scribo/src/primitive/extract/extract_discontinued_vlines.cc
+++ b/scribo/src/primitive/extract/extract_discontinued_vlines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -44,28 +45,30 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 5)
return scribo::debug::usage(argv,
"Extract discontinued vertical lines",
"input.pbm length rank output.pbm",
- args_desc,
- "A binary image of vertical lines.");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- value::label_16 nlines;
- image2d<bool> lines
- = data::convert(bool(),
- scribo::primitive::extract::lines_v_discontinued(input,
- c8(),
- nlines,
- atoi(argv[2]),
- atoi(argv[3])));
- io::pbm::save(lines, argv[4]);
+ typedef value::label_16 V;
+ V nlines;
+ typedef image2d<V> L;
+
+ component_set<L>
+ vlines = scribo::primitive::extract::lines_v_discontinued(input,
+ c8(),
+ nlines,
+ atoi(argv[2]),
+ atoi(argv[3]));
+ io::pbm::save(data::convert(bool(), vlines.labeled_image()), argv[4]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/extract/extract_thick_hlines.cc
b/scribo/src/primitive/extract/extract_thick_hlines.cc
index efa158a..136c2f9 100644
--- a/scribo/src/primitive/extract/extract_thick_hlines.cc
+++ b/scribo/src/primitive/extract/extract_thick_hlines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -43,27 +44,29 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Extract thick horizontal lines",
"input.pbm length output.pbm",
- args_desc,
- "A binary image of horizontal lines.");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- value::label_16 nlines;
- image2d<bool> lines
- = data::convert(bool(),
- scribo::primitive::extract::lines_h_thick(input,
- c8(),
- nlines,
- atoi(argv[2])));
- io::pbm::save(lines, argv[3]);
+ typedef value::label_16 V;
+ V nlines;
+ typedef image2d<V> L;
+
+ component_set<L>
+ lines = scribo::primitive::extract::lines_h_thick(input,
+ c8(),
+ nlines,
+ atoi(argv[2]));
+ io::pbm::save(data::convert(bool(), lines.labeled_image()), argv[3]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/extract/extract_thick_vlines.cc
b/scribo/src/primitive/extract/extract_thick_vlines.cc
index 2a5f8ee..7c38268 100644
--- a/scribo/src/primitive/extract/extract_thick_vlines.cc
+++ b/scribo/src/primitive/extract/extract_thick_vlines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -43,27 +44,29 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
"Extract thick vertical lines",
"input.pbm length output.pbm",
- args_desc,
- "A binary image of vertical lines.");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- value::label_16 nlines;
- image2d<bool> lines
- = data::convert(bool(),
- scribo::primitive::extract::lines_v_thick(input,
- c8(),
- nlines,
- atoi(argv[2])));
- io::pbm::save(lines, argv[3]);
+ typedef value::label_16 V;
+ V nlines;
+ typedef image2d<V> L;
+
+ component_set<L>
+ lines = scribo::primitive::extract::lines_v_thick(input,
+ c8(),
+ nlines,
+ atoi(argv[2]));
+ io::pbm::save(data::convert(bool(), lines.labeled_image()), argv[3]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/find/find_discontinued_lines.cc
b/scribo/src/primitive/find/find_discontinued_lines.cc
index 1ed77e3..244cae5 100644
--- a/scribo/src/primitive/find/find_discontinued_lines.cc
+++ b/scribo/src/primitive/find/find_discontinued_lines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -49,13 +50,14 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 4)
return scribo::debug::usage(argv,
- "Extract discontinued horizontal and vertical lines",
+ "Extract discontinued horizontal and "
+ "vertical lines",
"input.pbm length output.ppm",
- args_desc,
- "A color image. Horizontal lines are in red and vertical lines in
green.");
+ args_desc);
trace::entering("main");
@@ -68,7 +70,7 @@ int main(int argc, char *argv[])
nvlines;
typedef image2d<value::label_16> L;
- object_image(L)
+ component_set<L>
hlines = scribo::primitive::extract::lines_h_discontinued(input,
c8(),
nhlines,
@@ -80,8 +82,9 @@ int main(int argc, char *argv[])
atoi(argv[2]),
8);
- image2d<value::rgb8> out = debug::superpose(input, hlines, literal::red);
- out = debug::superpose(out, vlines, literal::green);
+ image2d<value::rgb8>
+ out = mln::debug::superpose(input, hlines.labeled_image(), literal::red);
+ out = mln::debug::superpose(out, vlines.labeled_image(), literal::green);
io::ppm::save(out, argv[3]);
diff --git a/scribo/src/primitive/find/find_single_lines.cc
b/scribo/src/primitive/find/find_single_lines.cc
index afe518b..16e216f 100644
--- a/scribo/src/primitive/find/find_single_lines.cc
+++ b/scribo/src/primitive/find/find_single_lines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009,2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -34,7 +35,7 @@
#include <scribo/debug/usage.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/extract/lines_h_single.hh>
#include <scribo/primitive/extract/lines_v_single.hh>
@@ -52,15 +53,16 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 7)
return scribo::debug::usage(argv,
- "Extract single horizontal and vertical lines. \
-\n Common argument values: 100 10 100 10",
- "<input.pbm> <length> <hbratio> <vbratio>\
- <output.pbm>",
- args_desc,
- "A binary image of horizontal and vertical single lines.");
+ "Extract single horizontal and vertical "
+ "lines.\n Common argument values: 100 10 "
+ "100 10",
+ "<input.pbm> <length> <hbratio> <vbratio> "
+ "<output.pbm>",
+ args_desc);
trace::entering("main");
@@ -70,22 +72,23 @@ int main(int argc, char *argv[])
typedef image2d<value::label_16> L;
value::label_16 nhlines;
- object_image(L)
- objects = scribo::primitive::extract::objects(input, c8(), nhlines);
+ component_set<L>
+ comps = scribo::primitive::extract::components(input, c8(), nhlines);
- object_image(L)
- hlines = scribo::primitive::extract::lines_h_single(objects,
+ component_set<L>
+ hlines = scribo::primitive::extract::lines_h_single(comps,
atoi(argv[2]),
atof(argv[3]));
- object_image(L)
- vlines = scribo::primitive::extract::lines_v_single(objects,
+ component_set<L>
+ vlines = scribo::primitive::extract::lines_v_single(comps,
atoi(argv[4]),
atof(argv[5]));
- image2d<value::rgb8> out = debug::superpose(input, hlines, literal::red);
- out = debug::superpose(out, vlines, literal::green);
+ image2d<value::rgb8>
+ out = mln::debug::superpose(input, hlines.labeled_image(), literal::red);
+ out = mln::debug::superpose(out, vlines.labeled_image(), literal::green);
io::ppm::save(out, argv[6]);
trace::exiting("main");
diff --git a/scribo/src/primitive/find/find_thick_and_single_lines.cc
b/scribo/src/primitive/find/find_thick_and_single_lines.cc
index fa66e29..cf88571 100644
--- a/scribo/src/primitive/find/find_thick_and_single_lines.cc
+++ b/scribo/src/primitive/find/find_thick_and_single_lines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -34,10 +35,8 @@
#include <scribo/debug/usage.hh>
-#include <scribo/core/object_image.hh>
-
-# include <scribo/primitive/extract/lines_v_thick_and_single.hh>
-# include <scribo/primitive/extract/lines_h_thick_and_single.hh>
+#include <scribo/primitive/extract/lines_v_thick_and_single.hh>
+#include <scribo/primitive/extract/lines_h_thick_and_single.hh>
const char *args_desc[][2] =
{
@@ -57,13 +56,12 @@ int main(int argc, char *argv[])
if (argc != 7)
return scribo::debug::usage(argv,
- "Extract thick horizontal and vertical lines.\
-\n Common argument values: 150 10 150 10.",
- "<input.pbm> <vlength> <vratio> <hlength>\
- <hratio> <output.ppm>",
- args_desc,
- "A color image. Horizontal lines are in red\
- and vertical lines in green.");
+ "Extract thick horizontal and vertical "
+ "lines.\n Common argument values: 150 10 "
+ "150 10.",
+ "<input.pbm> <vlength> <vratio> <hlength>"
+ " <hratio> <output.ppm>",
+ args_desc);
trace::entering("main");
@@ -77,7 +75,7 @@ int main(int argc, char *argv[])
nhlines,
nvlines;
- object_image(L)
+ component_set<L>
hlines = primitive::extract::lines_h_thick_and_single(input, c8(),
nhlines,
atoi(argv[2]),
@@ -87,8 +85,9 @@ int main(int argc, char *argv[])
atoi(argv[4]),
atoi(argv[5]));
- image2d<value::rgb8> out = mln::debug::superpose(input, hlines, literal::red);
- out = mln::debug::superpose(out, vlines, literal::green);
+ image2d<value::rgb8>
+ out = mln::debug::superpose(input, hlines.labeled_image(), literal::red);
+ out = mln::debug::superpose(out, vlines.labeled_image(), literal::green);
io::ppm::save(out, argv[6]);
diff --git a/scribo/src/primitive/find/find_thick_lines.cc
b/scribo/src/primitive/find/find_thick_lines.cc
index 045b34d..8966b81 100644
--- a/scribo/src/primitive/find/find_thick_lines.cc
+++ b/scribo/src/primitive/find/find_thick_lines.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -34,7 +35,6 @@
#include <scribo/debug/usage.hh>
-#include <scribo/core/object_image.hh>
#include <scribo/primitive/extract/lines_h_thick.hh>
#include <scribo/primitive/extract/lines_v_thick.hh>
@@ -54,15 +54,14 @@ const char *args_desc[][2] =
int main(int argc, char *argv[])
{
using namespace mln;
+ using namespace scribo;
if (argc != 5)
return scribo::debug::usage(argv,
- "Extract thick horizontal and vertical lines.\
-\n Common argument values: 150 150.",
+ "Extract thick horizontal and vertical "
+ "lines.\n Common argument values: 150 150.",
"<input.pbm> <vlength> <hlength> <output.ppm>",
- args_desc,
- "A color image. Horizontal lines are in red\
- and vertical lines in green.");
+ args_desc);
trace::entering("main");
@@ -76,14 +75,15 @@ int main(int argc, char *argv[])
nhlines,
nvlines;
- object_image(L)
+ component_set<L>
hlines = scribo::primitive::extract::lines_h_thick(input, c8(),
nhlines, atoi(argv[2])),
vlines = scribo::primitive::extract::lines_v_thick(input, c8(),
nvlines, atoi(argv[3]));
- image2d<value::rgb8> out = debug::superpose(input, hlines, literal::red);
- out = debug::superpose(out, vlines, literal::green);
+ image2d<value::rgb8>
+ out = mln::debug::superpose(input, hlines.labeled_image(), literal::red);
+ out = mln::debug::superpose(out, vlines.labeled_image(), literal::green);
io::ppm::save(out, argv[4]);
diff --git a/scribo/src/primitive/group/Makefile.am
b/scribo/src/primitive/group/Makefile.am
index 92a81fc..afc4f8e 100644
--- a/scribo/src/primitive/group/Makefile.am
+++ b/scribo/src/primitive/group/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+# (LRDE).
#
# This file is part of Olena.
#
@@ -18,21 +19,19 @@ include $(top_srcdir)/scribo/scribo.mk
bin_PROGRAMS = \
group_from_double_link \
- group_from_double_link_filter_non_aligned \
group_from_double_several_links \
- group_from_graph \
- group_from_several_graph \
group_from_several_left_links \
group_from_single_link
group_from_double_link_SOURCES = group_from_double_link.cc
-group_from_double_link_filter_non_aligned_SOURCES =
group_from_double_link_filter_non_aligned.cc
group_from_double_several_links_SOURCES = group_from_double_several_links.cc
-group_from_graph_SOURCES = group_from_graph.cc
-group_from_several_graph_SOURCES = group_from_several_graph.cc
group_from_several_left_links_SOURCES = group_from_several_left_links.cc
group_from_single_link_SOURCES = group_from_single_link.cc
## FIXME: Does not compile.
-## bin_PROGRAMS += group_from_rag
+## bin_PROGRAMS += group_from_rag \
+## group_from_graph \
+## group_from_several_graph \
## group_from_rag_SOURCES = group_from_rag.cc
+## group_from_graph_SOURCES = group_from_graph.cc
+## group_from_several_graph_SOURCES = group_from_several_graph.cc
\ No newline at end of file
diff --git a/scribo/src/primitive/group/group_from_double_link.cc
b/scribo/src/primitive/group/group_from_double_link.cc
index 9e8a6b3..00c68df 100644
--- a/scribo/src/primitive/group/group_from_double_link.cc
+++ b/scribo/src/primitive/group/group_from_double_link.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <scribo/core/object_links.hh>
#include <scribo/core/object_image.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.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>
@@ -53,10 +54,12 @@
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." },
+ { "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." },
{ "prefix", "Output names prefix" },
{0, 0}
};
@@ -68,10 +71,10 @@ int main(int argc, char *argv[])
if (argc != 5)
return scribo::debug::usage(argv,
- "Group potential text objects using a double validation link.",
+ "Group potential text objects using a double"
+ "validation link.",
"input.pbm hlmax hrmax prefix",
- args_desc,
- "Several images showing the process.");
+ args_desc);
scribo::make::internal::debug_filename_prefix = argv[4];
@@ -81,10 +84,10 @@ int main(int argc, char *argv[])
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);
+ component_set<L>
+ text = primitive::extract::components(input, c8(), nbboxes);
- text = filter::objects_small(text, 4);
+ text = filter::components_small(text, 4);
object_links<L> left_link
= primitive::link::with_single_left_link(text, atoi(argv[2]));
@@ -93,41 +96,29 @@ int main(int argc, char *argv[])
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,
+ left_link, right_link,
literal::red, literal::cyan, literal::yellow,
literal::green,
+ anchor::MassCenter,
scribo::make::debug_filename("links.ppm"));
-// io::ppm::save(mln::labeling::colorize(value::rgb8(),
-// text.label_image(),
-// text.nlabels()),
-// scribo::make::debug_filename("lbl_before.ppm"));
-
// With validation.
object_groups<L> groups
- = primitive::group::from_double_link(text, left_link, right_link);
+ = primitive::group::from_double_link(left_link, right_link);
- text_t grouped_text = primitive::group::apply(text, groups);
+ component_set<L> grouped_text = primitive::group::apply(groups);
io::ppm::save(mln::labeling::colorize(value::rgb8(),
- grouped_text,
- grouped_text.nlabels()),
+ grouped_text.labeled_image(),
+ grouped_text.nelements()),
scribo::make::debug_filename("label_color.ppm"));
- std::cout << "AFTER double grouping - nbboxes = " <<
grouped_text.bboxes().nelements() << std::endl;
+ std::cout << "AFTER double grouping - nbboxes = "
+ << grouped_text.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
- literal::red,
- scribo::make::debug_filename("bboxes.ppm"));
+ scribo::debug::save_bboxes_image(input, grouped_text,
+ scribo::make::debug_filename("bboxes.ppm"),
+ literal::red);
}
diff --git a/scribo/src/primitive/group/group_from_double_several_links.cc
b/scribo/src/primitive/group/group_from_double_several_links.cc
index 5b591c2..2a49b33 100644
--- a/scribo/src/primitive/group/group_from_double_several_links.cc
+++ b/scribo/src/primitive/group/group_from_double_several_links.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -36,7 +37,7 @@
#include <mln/literal/colors.hh>
#include <mln/util/array.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.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>
@@ -71,46 +72,47 @@ int main(int argc, char* argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
std::cout << "extract bboxes" << std::endl;
- typedef object_image(L) text_t;
- text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L>
+ comps = scribo::primitive::extract::components(input, c8(), nbboxes);
std::cout << "Remove small components" << std::endl;
- text = filter::objects_small(text,4);
+ comps = filter::components_small(comps, 4);
std::cout << "Group with left link" << std::endl;
object_links<L> left_link
- = primitive::link::with_several_left_links(text, 30);
+ = primitive::link::with_several_left_links(comps, 30);
std::cout << "Group with right link" << std::endl;
object_links<L> right_link
- = primitive::link::with_several_right_links(text, 30);
+ = primitive::link::with_several_right_links(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
scribo::debug::save_linked_bboxes_image(input,
- text, left_link, right_link,
+ left_link, right_link,
literal::red, literal::cyan, literal::yellow,
literal::green,
+ anchor::Center,
scribo::make::debug_filename("links.ppm"));
// With validation.
std::cout << "Group from double link" << std::endl;
object_groups<L> groups
- = primitive::group::from_double_link(text, left_link, right_link);
+ = primitive::group::from_double_link(left_link, right_link);
- text_t grouped_text = primitive::group::apply(text, groups);
+ component_set<L> grouped_comps = primitive::group::apply(groups);
io::ppm::save(mln::labeling::colorize(value::rgb8(),
- grouped_text,
- grouped_text.nlabels()),
+ grouped_comps.labeled_image(),
+ grouped_comps.nelements()),
scribo::make::debug_filename("label_color.ppm"));
- std::cout << "AFTER double grouping - nbboxes = " <<
grouped_text.bboxes().nelements() << std::endl;
+ std::cout << "AFTER double grouping - nbboxes = " <<
grouped_comps.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
- literal::red,
- scribo::make::debug_filename("bboxes.ppm"));
+ scribo::debug::save_bboxes_image(input, grouped_comps,
+ scribo::make::debug_filename("bboxes.ppm"),
+ literal::red);
}
diff --git a/scribo/src/primitive/group/group_from_several_left_links.cc
b/scribo/src/primitive/group/group_from_several_left_links.cc
index a153e0c..ef70a19 100644
--- a/scribo/src/primitive/group/group_from_several_left_links.cc
+++ b/scribo/src/primitive/group/group_from_several_left_links.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -40,7 +41,7 @@
#include <mln/io/ppm/save.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/group/from_single_link.hh>
@@ -70,33 +71,34 @@ int main(int argc, char* argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- typedef object_image(L) text_t;
- text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L>
+ comps = scribo::primitive::extract::components(input, c8(), nbboxes);
{
std::cout << "* Left grouping" << std::endl;
object_links<L> left_link
- = primitive::link::with_several_left_links(text, 30);
+ = primitive::link::with_several_left_links(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
scribo::debug::save_linked_bboxes_image(input,
- text, left_link,
+ left_link,
literal::red, literal::cyan,
scribo::make::debug_filename("left_links.ppm"));
object_groups<L>
- groups = primitive::group::from_single_link(text, left_link);
+ groups = primitive::group::from_single_link(left_link);
- text_t grouped_text = primitive::group::apply(text, groups);
- std::cout << "AFTER - nbboxes = " <<
grouped_text.bboxes().nelements() << std::endl;
+ component_set<L> grouped_comps = primitive::group::apply(groups);
+ std::cout << "AFTER - nbboxes = " << grouped_comps.nelements()
+ << std::endl;
io::ppm::save(mln::labeling::colorize(value::rgb8(),
- grouped_text,
- grouped_text.nlabels()),
- scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
- literal::red,
- scribo::make::debug_filename("left_bboxes.ppm"));
+ grouped_comps.labeled_image(),
+ grouped_comps.nelements()),
+ scribo::make::debug_filename("left_label_color.ppm"));
+ scribo::debug::save_bboxes_image(input, grouped_comps,
+ scribo::make::debug_filename("left_bboxes.ppm"),
+ literal::red);
}
}
diff --git a/scribo/src/primitive/group/group_from_single_link.cc
b/scribo/src/primitive/group/group_from_single_link.cc
index f408d66..5b5f710 100644
--- a/scribo/src/primitive/group/group_from_single_link.cc
+++ b/scribo/src/primitive/group/group_from_single_link.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
-#include <scribo/primitive/extract/objects.hh>
+#include <scribo/primitive/extract/components.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>
@@ -70,68 +71,67 @@ int main(int argc, char* argv[])
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
- typedef object_image(L) text_t;
- text_t text = scribo::primitive::extract::objects(input, c8(), nbboxes);
+ component_set<L>
+ comps = scribo::primitive::extract::components(input, c8(), nbboxes);
{
std::cout << "* Left grouping" << std::endl;
object_links<L> left_link
- = primitive::link::with_single_left_link(text, 30);
+ = primitive::link::with_single_left_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
scribo::debug::save_linked_bboxes_image(input,
- text, left_link,
+ left_link,
literal::red, literal::cyan,
scribo::make::debug_filename("left_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
-// text,
-// text.nlabels()),
+// comps,
+// comps.nlabels()),
// scribo::make::debug_filename("lbl_before.ppm"));
object_groups<L>
- groups = primitive::group::from_single_link(text, left_link);
+ groups = primitive::group::from_single_link(left_link);
- text_t grouped_text = primitive::group::apply(text, groups);
+ component_set<L> grouped_comps = primitive::group::apply(groups);
- std::cout << "AFTER - nbboxes = " <<
grouped_text.bboxes().nelements() << std::endl;
+ std::cout << "AFTER - nbboxes = " << grouped_comps.nelements()
<< std::endl;
io::ppm::save(mln::labeling::colorize(value::rgb8(),
- grouped_text,
- grouped_text.nlabels()),
- scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
- literal::red,
- scribo::make::debug_filename("left_bboxes.ppm"));
+ grouped_comps.labeled_image(),
+ grouped_comps.nelements()),
+ scribo::make::debug_filename("left_label_color.ppm"));
+ scribo::debug::save_bboxes_image(input, grouped_comps,
+ scribo::make::debug_filename("left_bboxes.ppm"), literal::red);
}
{
std::cout << "* Left grouping" << std::endl;
object_links<L> right_link
- = primitive::link::with_single_right_link(text, 30);
+ = primitive::link::with_single_right_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
scribo::debug::save_linked_bboxes_image(input,
- text, right_link,
+ right_link,
literal::red, literal::cyan,
scribo::make::debug_filename("right_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
-// text,
-// text.nlabels()),
+// comps,
+// comps.nlabels()),
// scribo::make::debug_filename("lbl_before.ppm"));
object_groups<L>
- groups = primitive::group::from_single_link(text, right_link);
+ groups = primitive::group::from_single_link(right_link);
- text_t grouped_text = primitive::group::apply(text, groups);
+ component_set<L> grouped_comps = primitive::group::apply(groups);
io::ppm::save(mln::labeling::colorize(value::rgb8(),
- grouped_text,
- grouped_text.nlabels()),
- scribo::make::debug_filename("right_label_color.ppm"));
- std::cout << "AFTER - nbboxes = " <<
grouped_text.bboxes().nelements() << std::endl;
-
- scribo::debug::save_bboxes_image(input, grouped_text.bboxes(),
- literal::red,
- scribo::make::debug_filename("right_bboxes.ppm"));
+ grouped_comps.labeled_image(),
+ grouped_comps.nelements()),
+ scribo::make::debug_filename("right_label_color.ppm"));
+ std::cout << "AFTER - nbboxes = " << grouped_comps.nelements()
<< std::endl;
+
+ scribo::debug::save_bboxes_image(input, grouped_comps,
+ scribo::make::debug_filename("right_bboxes.ppm"),
+ literal::red);
}
diff --git a/scribo/src/table/erase.cc b/scribo/src/table/erase.cc
index 29546bb..2870798 100644
--- a/scribo/src/table/erase.cc
+++ b/scribo/src/table/erase.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -58,22 +59,22 @@ int main(int argc, char* argv[])
return scribo::debug::usage(argv,
"Remove tables from a binary image.",
"input.pbm output.pbm",
- args_desc,
- "A binary image without tables.");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- typedef image2d<label_16> lbl_t;
+ typedef value::label_16 V;
+ typedef image2d<V> L;
/// Extracting vertical and horizontal lines.
- label_16 nhlines, nvlines;
- object_image(lbl_t)
+ V nhlines, nvlines;
+ component_set<L>
lbl_v = primitive::extract::lines_v_discontinued(input, c8(),
nvlines, 51, 8);
- object_image(lbl_t)
+ component_set<L>
lbl_h = primitive::extract::lines_h_discontinued(input, c8(),
nhlines, 51, 6);
diff --git a/scribo/src/text/cleantxt.cc b/scribo/src/text/cleantxt.cc
index f303448..78aa5e6 100644
--- a/scribo/src/text/cleantxt.cc
+++ b/scribo/src/text/cleantxt.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -31,18 +32,22 @@
#include <mln/logical/not.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/core/alias/w_window2d_int.hh>
-#include <mln/make/w_window2d_int.hh>
+#include <mln/value/int_u16.hh>
+#include <scribo/text/merging.hh>
+#include <scribo/primitive/extract/components.hh>
+#include <scribo/primitive/link/with_single_left_link_dmax_ratio.hh>
+#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/text/clean.hh>
#include <scribo/debug/usage.hh>
+#include <scribo/make/debug_filename.hh>
const char *args_desc[][2] =
{
- { "input.pbm", "A binary image. 'True' for objects,
'False'\
-for the background." },
+ { "input.pbm", "A binary image. 'True' for objects,
'False' for the "
+ "background." },
{ "out.pbm", "A cleaned up binary image." },
{0, 0}
};
@@ -58,22 +63,34 @@ int main(int argc, char* argv[])
return scribo::debug::usage(argv,
"Cleanup text areas.",
"input.pbm out.pbm",
- args_desc,
- "");
+ args_desc);
trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- int vals[] = { 0, 9, 0, 9, 0,
- 9, 6, 4, 6, 9,
- 0, 4, 0, 4, 0,
- 9, 6, 4, 6, 9,
- 0, 9, 0, 9, 0 };
- w_window2d_int dmap_win = mln::make::w_window2d_int(vals);
+ scribo::make::internal::debug_filename_prefix = argv[2];
- io::pbm::save(scribo::text::clean(logical::not_(input), dmap_win), argv[2]);
+ typedef image2d<value::int_u16> L;
+ value::int_u16 ncomps;
+ component_set<L>
+ comps = primitive::extract::components(input, c8(), ncomps);
+
+ object_links<L>
+ links = primitive::link::with_single_left_link_dmax_ratio(comps, 2);
+
+ object_groups<L>
+ groups = primitive::group::from_single_link(links);
+
+ line_set<L> lines(groups);
+ lines = text::merging(lines);
+
+ logical::not_inplace(input);
+
+ for_all_lines(l, lines)
+ io::pbm::save(scribo::text::clean(lines(l), input),
+ scribo::make::debug_filename("text.pbm"));
trace::exiting("main");
}
--
1.5.6.5