Olena-patches
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
* scribo/core/paragraph_info.hh: Add color information.
* scribo/debug/bboxes_image.hh: Reindent.
* scribo/draw/bounding_box_links.hh: Update use of is_link_valid.
* scribo/make/text_components_image.hh: Fix wrong domain inclusions.
* scribo/toolchain/text_in_picture.hh: Fix wrong include.
* src/debug/show_paragraph_blocks.cc: Add missing curly brackets.
---
scribo/ChangeLog | 15 +++++++++++++++
scribo/scribo/core/paragraph_info.hh | 27 +++++++++++++++++++++++++++
scribo/scribo/debug/bboxes_image.hh | 18 +++++++++---------
scribo/scribo/draw/bounding_box_links.hh | 16 ++++++----------
scribo/scribo/make/text_components_image.hh | 8 +++++---
scribo/scribo/toolchain/text_in_picture.hh | 10 +++++-----
scribo/src/debug/show_paragraph_blocks.cc | 2 ++
7 files changed, 69 insertions(+), 27 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 8a76ac6..570a3c1 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,20 @@
2011-05-03 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Small fixes.
+
+ * scribo/core/paragraph_info.hh: Add color information.
+
+ * scribo/debug/bboxes_image.hh: Reindent.
+
+ * scribo/draw/bounding_box_links.hh: Update use of is_link_valid.
+
+ * scribo/make/text_components_image.hh: Fix wrong domain inclusions.
+
+ * scribo/toolchain/text_in_picture.hh: Make use of
+ component::extract::alignments.
+
+2011-05-03 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* scribo/primitive/extract/alignments.hh: Fix several bugs.
2011-05-03 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
diff --git a/scribo/scribo/core/paragraph_info.hh b/scribo/scribo/core/paragraph_info.hh
index 2a9b626..557ded7 100644
--- a/scribo/scribo/core/paragraph_info.hh
+++ b/scribo/scribo/core/paragraph_info.hh
@@ -61,10 +61,14 @@ namespace scribo
unsigned nlines() const;
+ const line_links<L>& llinks() const;
+
// FIXME: add boldness?
const mln::value::rgb8& color() const;
+ void set_color_(const mln::value::rgb8& v);
float color_reliability() const;
+ void set_color_reliability_(float v);
bool is_valid() const;
@@ -82,6 +86,9 @@ namespace scribo
bool needs_stats_update_;
};
+ template <typename L>
+ std::ostream& operator<<(std::ostream& ostr, const paragraph_info<L>& info);
+
# ifndef MLN_INCLUDE_ONLY
@@ -139,12 +146,25 @@ namespace scribo
}
template <typename L>
+ const line_links<L>&
+ paragraph_info<L>::llinks() const
+ {
+ return llinks_;
+ }
+
+ template <typename L>
const mln::value::rgb8&
paragraph_info<L>::color() const
{
return color_;
}
+ template <typename L>
+ void
+ paragraph_info<L>::set_color_(const mln::value::rgb8& v)
+ {
+ color_ = v;
+ }
template <typename L>
float
@@ -154,6 +174,13 @@ namespace scribo
}
template <typename L>
+ void
+ paragraph_info<L>::set_color_reliability_(float v)
+ {
+ color_reliability_ = v;
+ }
+
+ template <typename L>
bool
paragraph_info<L>::is_valid() const
{
diff --git a/scribo/scribo/debug/bboxes_image.hh b/scribo/scribo/debug/bboxes_image.hh
index ca3d646..d3dc64b 100644
--- a/scribo/scribo/debug/bboxes_image.hh
+++ b/scribo/scribo/debug/bboxes_image.hh
@@ -55,15 +55,15 @@ namespace scribo
template <typename I>
mln_ch_value(I, value::rgb8)
bboxes_image(const Image<I>& input,
- const mln::util::array< box<mln_site(I)> >& bboxes,
- const value::rgb8& value);
+ const mln::util::array< box<mln_site(I)> >& bboxes,
+ const value::rgb8& value);
template <typename I, typename L>
mln_ch_value(I, value::rgb8)
bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const value::rgb8& value);
+ const line_set<L>& lines,
+ const value::rgb8& value);
/// \overload
/// value is set to literal::red.
@@ -72,15 +72,15 @@ namespace scribo
inline
mln_ch_value(I, value::rgb8)
bboxes_image(const Image<I>& input,
- const line_set<L>& lines);
+ const line_set<L>& lines);
/// \overload.
template <typename I, typename L>
inline
mln_ch_value(I, value::rgb8)
bboxes_image(const Image<I>& input,
- const component_set<L>& comps,
- const value::rgb8& value);
+ const component_set<L>& comps,
+ const value::rgb8& value);
# ifndef MLN_INCLUDE_ONLY
@@ -106,8 +106,8 @@ namespace scribo
inline
mln_ch_value(I, value::rgb8)
bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const value::rgb8& value)
+ const line_set<L>& lines,
+ const value::rgb8& value)
{
trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
diff --git a/scribo/scribo/draw/bounding_box_links.hh b/scribo/scribo/draw/bounding_box_links.hh
index f2c9804..830da25 100644
--- a/scribo/scribo/draw/bounding_box_links.hh
+++ b/scribo/scribo/draw/bounding_box_links.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -294,15 +294,11 @@ namespace scribo
right_link_value);
- mln::util::couple<bool, unsigned>
- nbh = primitive::internal::is_link_valid(left_link,
- right_link,
- i);
-
- if (nbh.first())
+ if (primitive::internal::is_link_valid(left_link,
+ right_link, i))
mln::draw::line(input,
- primitive::link::internal::compute_anchor(comps, right_link(i), anchor),
- primitive::link::internal::compute_anchor(comps, nbh.second(), anchor),
+ primitive::link::internal::compute_anchor(comps, i, anchor),
+ primitive::link::internal::compute_anchor(comps, left_link(i), anchor),
validated_link_value);
}
diff --git a/scribo/scribo/make/text_components_image.hh b/scribo/scribo/make/text_components_image.hh
index e7c892e..522505e 100644
--- a/scribo/scribo/make/text_components_image.hh
+++ b/scribo/scribo/make/text_components_image.hh
@@ -80,9 +80,11 @@ namespace scribo
comp_ids = lines(l).component_ids();
const L& lbl = lines.components().labeled_image();
for_all_elements(c, comp_ids)
- data::fill((output | lines.components()(comp_ids(c)).bbox()).rw(),
- ((doc.binary_image() | lines.components()(comp_ids(c)).bbox())
- | (pw::value(lbl) == comp_ids(c))));
+ {
+ data::fill(((output | lines.components()(comp_ids(c)).bbox()).rw()
+ | (pw::value(lbl) == comp_ids(c))).rw(),
+ (doc.binary_image() | lines.components()(comp_ids(c)).bbox()));
+ }
}
}
diff --git a/scribo/scribo/toolchain/text_in_picture.hh b/scribo/scribo/toolchain/text_in_picture.hh
index 42e69db..6f87b9d 100644
--- a/scribo/scribo/toolchain/text_in_picture.hh
+++ b/scribo/scribo/toolchain/text_in_picture.hh
@@ -71,7 +71,7 @@
# include <scribo/filter/object_links_bbox_overlap.hh>
# include <scribo/filter/object_groups_small.hh>
-# include <scribo/filter/object_groups_v_thickness.hh>
+# include <scribo/filter/object_groups_mean_width.hh>
# include <scribo/debug/decision_image.hh>
# include <scribo/debug/linked_bboxes_image.hh>
@@ -138,7 +138,7 @@ namespace scribo
bbox_h_ratio = 1.60f;
bbox_overlap = 0.80f;
small_groups = 3;
- v_thickness = 8;
+ mean_width = 8;
regroup_dmax = 30;
group_min_holes = 3;
}
@@ -154,7 +154,7 @@ namespace scribo
float bbox_h_ratio;
float bbox_overlap;
unsigned small_groups;
- unsigned v_thickness;
+ unsigned mean_width;
unsigned regroup_dmax;
unsigned group_min_holes;
};
@@ -469,8 +469,8 @@ namespace scribo
object_groups<L> filtered_thin_groups;
std::cout << "** Using group too thin" << std::endl;
filtered_thin_groups
- = filter::object_groups_v_thickness(filtered_small_groups,
- conf.v_thickness);
+ = filter::object_groups_mean_width(filtered_small_groups,
+ conf.mean_width);
t_ = g_timer;
std::cout << "Groups too thin " << t_ << std::endl;
diff --git a/scribo/src/debug/show_paragraph_blocks.cc b/scribo/src/debug/show_paragraph_blocks.cc
index b16a751..e99c2ec 100644
--- a/scribo/src/debug/show_paragraph_blocks.cc
+++ b/scribo/src/debug/show_paragraph_blocks.cc
@@ -109,6 +109,7 @@ int main(int argc, char* argv[])
const line_info<L>& line = parset.lines()(parset(p).line_ids()(l));
if (last_box.is_valid())
+ {
if (last_box.pmax().row() < line.bbox().pmin().row())
{
last_tbox = last_box;
@@ -167,6 +168,7 @@ int main(int argc, char* argv[])
// mln::io::pgm::save(log, mln::debug::filename("log.pgm", i++));
}
}
+ }
mln::draw::box_plain(blocks, line.bbox(), true);
// mln::draw::box_plain(log, line.bbox(), 255);
--
1.5.6.5
1
0

last-svn-commit-846-g3f50eb7 scribo/primitive/extract/alignments.hh: Fix several bugs.
by Guillaume Lazzara 03 May '11
by Guillaume Lazzara 03 May '11
03 May '11
---
scribo/ChangeLog | 6 +-
scribo/scribo/primitive/extract/alignments.hh | 444 +++++++++++++------------
2 files changed, 229 insertions(+), 221 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 7bbfb9e..8a76ac6 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,4 +1,8 @@
-2011-05-03 Guillaume Lazzara <lazzara(a)fidji.lrde.epita.fr>
+2011-05-03 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ * scribo/primitive/extract/alignments.hh: Fix several bugs.
+
+2011-05-03 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Improve object_groups and object_links API.
diff --git a/scribo/scribo/primitive/extract/alignments.hh b/scribo/scribo/primitive/extract/alignments.hh
index 4bd925e..8d18d93 100644
--- a/scribo/scribo/primitive/extract/alignments.hh
+++ b/scribo/scribo/primitive/extract/alignments.hh
@@ -26,57 +26,54 @@
#ifndef SCRIBO_PRIMITIVE_EXTRACT_ALIGNMENTS_HH
# define SCRIBO_PRIMITIVE_EXTRACT_ALIGNMENTS_HH
-#include <iostream>
+# include <iostream>
-#include <mln/core/image/image2d.hh>
-#include <mln/core/alias/neighb2d.hh>
+# include <mln/core/image/image2d.hh>
+# include <mln/core/alias/neighb2d.hh>
-#include <mln/data/convert.hh>
+# include <mln/data/convert.hh>
-#include <mln/value/rgb8.hh>
-#include <mln/value/label_16.hh>
-#include <mln/value/int_u.hh>
-#include <mln/literal/colors.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/value/label_16.hh>
+# include <mln/value/int_u.hh>
+# include <mln/literal/colors.hh>
-#include <mln/util/array.hh>
-#include <mln/util/couple.hh>
+# include <mln/util/array.hh>
+# include <mln/util/couple.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/ppm/save.hh>
+# include <mln/io/pbm/load.hh>
-#include <mln/labeling/colorize.hh>
+# include <mln/labeling/colorize.hh>
-#include <mln/util/couple.hh>
+# include <mln/util/couple.hh>
-#include <scribo/core/def/lbl_type.hh>
-#include <scribo/primitive/extract/components.hh>
-#include <scribo/filter/object_links_aligned.hh>
-#include <scribo/filter/object_groups_small.hh>
-#include <scribo/preprocessing/denoise_fg.hh>
-// #include <scribo/primitive/link/with_single_right_link_dmax_ratio_aligned.hh>
-// #include <scribo/primitive/link/with_single_left_link_dmax_ratio_aligned.hh>
-#include <scribo/primitive/link/internal/link_single_dmax_ratio_aligned_delta_base.hh>
-#include <scribo/primitive/link/internal/dmax_default.hh>
-#include <scribo/primitive/link/internal/dmax_hrules.hh>
-#include <scribo/primitive/link/merge_double_link_closest_aligned.hh>
+# include <scribo/core/def/lbl_type.hh>
+# include <scribo/primitive/extract/components.hh>
+# include <scribo/filter/object_links_aligned.hh>
+# include <scribo/filter/object_groups_small.hh>
+# include <scribo/preprocessing/denoise_fg.hh>
+# include <scribo/primitive/link/internal/link_single_dmax_ratio_aligned_delta_base.hh>
+# include <scribo/primitive/link/internal/dmax_default.hh>
+# include <scribo/primitive/link/internal/dmax_hrules.hh>
+# include <scribo/primitive/link/merge_double_link_closest_aligned.hh>
-#include <scribo/debug/usage.hh>
-#include <scribo/debug/links_image.hh>
+# include <scribo/debug/usage.hh>
+# include <scribo/debug/links_image.hh>
-#include <scribo/core/document.hh>
-#include <scribo/core/component_set.hh>
-#include <scribo/core/line_set.hh>
-#include <scribo/primitive/extract/components.hh>
-#include <scribo/primitive/group/from_single_link.hh>
-#include <scribo/primitive/group/apply.hh>
-#include <scribo/primitive/link/with_single_left_link_dmax_ratio.hh>
-#include <scribo/primitive/link/with_single_right_link_dmax_ratio.hh>
-#include <scribo/primitive/link/merge_double_link.hh>
-#include <scribo/primitive/link/internal/dmax_width_and_height.hh>
+# include <scribo/core/document.hh>
+# include <scribo/core/component_set.hh>
+# include <scribo/core/line_set.hh>
+# include <scribo/primitive/extract/components.hh>
+# include <scribo/primitive/group/from_single_link.hh>
+# include <scribo/primitive/group/apply.hh>
+# include <scribo/primitive/link/with_single_left_link_dmax_ratio.hh>
+# include <scribo/primitive/link/with_single_right_link_dmax_ratio.hh>
+# include <scribo/primitive/link/merge_double_link.hh>
+# include <scribo/primitive/link/internal/dmax_width_and_height.hh>
-#include <scribo/preprocessing/rotate_90.hh>
-#include <scribo/filter/object_links_bbox_h_ratio.hh>
+# include <scribo/preprocessing/rotate_90.hh>
+# include <scribo/filter/object_links_bbox_h_ratio.hh>
# include <scribo/primitive/extract/separators.hh>
# include <scribo/primitive/extract/vertical_separators.hh>
@@ -442,7 +439,7 @@ namespace scribo
}
-
+ inline
bool
is_valid_left_right_skewed_delimitor(const box2d& brot,
const image2d<bool> input,
@@ -469,6 +466,8 @@ namespace scribo
return false;
}
+
+ inline
bool
is_valid_right_left_skewed_delimitor(const box2d& brot,
const image2d<bool> input,
@@ -496,6 +495,7 @@ namespace scribo
}
+ inline
box2d fast_rotate_positive(const box2d& box, const box2d& rbox)
{
box2d b(point2d(box.pmin().col(),
@@ -505,25 +505,12 @@ namespace scribo
return b;
}
+
+ inline
box2d fast_rotate_negative(const box2d& box, const box2d& rbox)
{
- // std::cout << point2d(rbox.ncols() - box.pmin().col() - 1,
- // box.pmin().row())
- // << " - "
- // << point2d(rbox.ncols() - box.pmax().col() - 1,
- // box.pmax().row()) << std::endl;
-
- // std::cout << box << " - " << rbox << std::endl;
-
- // box2d b(point2d(rbox.ncols() - box.pmin().col() - 1,
- // box.pmin().row()),
- // point2d(rbox.ncols() - box.pmax().col() - 1,
- // box.pmax().row()));
-
mln::def::coord max_row = rbox.ncols() - box.pmin().col() - 1;
mln::def::coord min_row = rbox.ncols() - box.pmax().col() - 1;
-// if (min_row > max_row)
- //std::swap(min_row, max_row);
box2d b(point2d(min_row,
box.pmin().row()),
@@ -533,6 +520,26 @@ namespace scribo
return b;
}
+
+ inline
+ unsigned
+ compute_reliable_ldelta(const value::int_u12& char_width,
+ const value::int_u12& char_space)
+ {
+ return 1.2 * char_width + char_space;
+ }
+
+
+ inline
+ unsigned
+ compute_unreliable_ldelta(const value::int_u12& max_char_width)
+ {
+ return max_char_width * 2; // FIXME: reduce to 1.5 ? Problem
+ // with 2 or 3 lines besides an
+ // image.
+ }
+
+
} // end of namespace scribo::primitive::extract
@@ -579,8 +586,7 @@ namespace scribo
mln::draw::box(bbox_ima,
internal::fast_rotate_positive(lines(l).bbox(),
rbbox),
- lines(l).id().value());
-
+ l);
// Compute component information
//
@@ -613,12 +619,7 @@ namespace scribo
// 2.1. BEGIN OF TOP LINKS PROCESSING
{
object_links<L> top_links;
-
- object_groups<L>
- top_groups,
- old_top_groups;
-
- util::array<unsigned> top_group_size;
+ object_groups<L> top_groups;
typedef mln::accu::stat::median_h<value::int_u<12u> > median_t;
mln::util::array<median_t>
@@ -656,9 +657,8 @@ namespace scribo
anchor::StrictTopCenter);
// Remove groups with not enough links.
- old_top_groups = primitive::group::from_single_link(top_links);
- top_groups = filter::object_groups_small(old_top_groups, min_card,
- top_group_size);
+ top_groups = primitive::group::from_single_link(top_links);
+ top_groups = filter::object_groups_small(top_groups, min_card);
// Compute char_width and char_space statistics.
@@ -674,17 +674,18 @@ namespace scribo
top_max_char_width.resize(top_groups.nelements());
for_all_groups(g, top_groups)
- if (top_groups.is_valid(g))
- {
- if (lines(g).card() > 1)
+ if (top_groups(g).is_valid())
+ for_all_elements(e, top_groups(g).component_ids())
{
- top_median_char_space(top_groups(g)).take(lines(g).char_space());
- top_median_char_width(top_groups(g)).take(lines(g).char_width());
+ unsigned l = top_groups(g).component_ids()(e);
+ if (lines(l).card() > 1)
+ {
+ top_median_char_space(g).take(lines(l).char_space());
+ top_median_char_width(g).take(lines(l).char_width());
+ }
+ else if (top_max_char_width(g) < lines(l).char_width())
+ top_max_char_width(g) = lines(l).char_width();
}
- else if (top_max_char_width(top_groups(g)) < lines(g).char_width())
- top_max_char_width(top_groups(g)) = lines(g).char_width();
- }
-
}
@@ -694,103 +695,104 @@ namespace scribo
group_bbox(top_groups.nelements());
// Compute group bboxes
- for_all_links(l, top_links)
- if (top_links.is_valid(l))
- {
- point2d p = components(top_links(l)).bbox().pmax();
- p.row() = components(top_links(l)).bbox().pmin().row();
+ for_all_groups(g, top_groups)
+ for_all_elements(e, top_groups(g).component_ids())
+ {
+ unsigned l = top_groups(g).component_ids()(e);
+ point2d p = components(top_links(l)).bbox().pmax();
+ p.row() = components(top_links(l)).bbox().pmin().row();
- if (top_groups.is_valid(l)
- && top_group_size(old_top_groups(l)) > 2)
- {
- group_bbox(top_groups(l)).take(p);
- group_bbox(top_groups(l)).take(components(l).bbox().pmin());
+ if (top_groups(g).is_valid())// && top_links.is_linked(l))
+ {
+ group_bbox(g).take(p);
+ group_bbox(g).take(components(l).bbox().pmin());
# ifndef SCRIBO_NDEBUG
- // Draw first component bbox.
- mln::draw::box(debug,
- internal::fast_rotate_positive(
- groups.components()(lines(l).component_ids()[0]).bbox(),
- rbbox),
- literal::cyan);
-
- mln::draw::box(debug,
- internal::fast_rotate_positive(
- groups.components()(lines(top_links(l)).component_ids()[0]).bbox(),
- rbbox),
- literal::cyan);
+ // Draw first component bbox.
+ mln::draw::box(debug,
+ internal::fast_rotate_positive(
+ groups.components()(lines(l).component_ids()[0]).bbox(),
+ rbbox),
+ literal::cyan);
+
+ mln::draw::box(debug,
+ internal::fast_rotate_positive(
+ groups.components()(lines(top_links(l)).component_ids()[0]).bbox(),
+ rbbox),
+ literal::cyan);
# endif // ! SCRIBO_NDEBUG
- }
-
+ }
# ifndef SCRIBO_NDEBUG
- else if (top_group_size(old_top_groups(l)) > 1)
- {
- mln::draw::line(debug,
- components(l).bbox().pmin(),
- p,
- literal::orange);
-
- // Draw first component bbox.
- mln::draw::box(debug,
- internal::fast_rotate_positive(
- groups.components()(lines(l).component_ids()[0]).bbox(),
- rbbox),
- literal::cyan);
-
- mln::draw::box(debug,
- internal::fast_rotate_positive(
- groups.components()(lines(top_links(l)).component_ids()[0]).bbox(),
- rbbox),
- literal::cyan);
-
- }
+ else if (top_groups(g).card() > 1)
+ {
+ mln::draw::line(debug,
+ components(l).bbox().pmin(),
+ p,
+ literal::orange);
+
+ // Draw first component bbox.
+ mln::draw::box(debug,
+ internal::fast_rotate_positive(
+ groups.components()(lines(l).component_ids()[0]).bbox(),
+ rbbox),
+ literal::cyan);
+
+ mln::draw::box(debug,
+ internal::fast_rotate_positive(
+ groups.components()(lines(top_links(l)).component_ids()[0]).bbox(),
+ rbbox),
+ literal::cyan);
+ }
# endif // ! SCRIBO_NDEBUG
- }
-
+ }
// Looking for whitespaces (if needed)
- for_all_elements(c, group_bbox)
- if (group_bbox(c).to_result().is_valid())
+ for_all_groups(g, top_groups)
+ if (top_groups(g).is_valid())
{
unsigned ldelta = delta;
- // Handle low connection groups.
- if (top_group_size(c) >= 3 && top_group_size(c) < 5)
+
+ // Special case : handle low connected groups.
+ if (top_groups(g).card() >= 3 && top_groups(g).card() < 5)
{
// Stats are not reliable, prefer using max char width.
- if (top_median_char_width(c).card() == 0)
- ldelta = top_max_char_width(c) * 2;
+ if (top_median_char_width(g).card() == 0)
+ ldelta = internal::compute_unreliable_ldelta(top_max_char_width(g));
else
- ldelta = 1.2 * top_median_char_width(c) + top_median_char_space(c);
+ ldelta = internal::compute_reliable_ldelta(top_median_char_width(g),
+ top_median_char_space(g));
+
+ point2d p(group_bbox(g).to_result().pmin().row() - ldelta,
+ group_bbox(g).to_result().pmin().col());
- point2d p(group_bbox(c).to_result().pmin().row() - ldelta,
- group_bbox(c).to_result().pmin().col());
p = scribo::internal::point_row_adjust(p, bbox_ima);
// Checking whitespace area
- for (; p.col() <= group_bbox(c).to_result().pmax().col()
+ for (; p.col() <= group_bbox(g).to_result().pmax().col()
&& (bbox_ima(p) == 0);)
++p.col();
if (bbox_ima(p) != 0)
{
+ top_groups(g).invalidate();
+
# ifndef SCRIBO_NDEBUG
mln::draw::line(debug,
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmin().row() - ldelta,
- group_bbox(c).to_result().pmin().col()), debug),
+ point2d(group_bbox(g).to_result().pmin().row() - ldelta,
+ group_bbox(g).to_result().pmin().col()), debug),
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmin().row() - ldelta,
- group_bbox(c).to_result().pmax().col()), debug),
+ point2d(group_bbox(g).to_result().pmin().row() - ldelta,
+ group_bbox(g).to_result().pmax().col()), debug),
literal::red);
# endif // ! SCRIBO_NDEBUG
-
continue;
}
}
box2d
- brot = internal::fast_rotate_negative(group_bbox(c).to_result(),
+ brot = internal::fast_rotate_negative(group_bbox(g).to_result(),
rbbox);
// Checking if the delimitor is skewed.
@@ -821,24 +823,25 @@ namespace scribo
else
{
mln::draw::line(delimitors,
- scribo::internal::point_col_adjust(point2d(brot.pmin().row(),
- brot.pmin().col() - delta), delimitors),
- scribo::internal::point_col_adjust(point2d(brot.pmax().row(),
- brot.pmin().col() - delta), delimitors),
+ scribo::internal::point_col_adjust(
+ point2d(brot.pmin().row(),
+ brot.pmin().col() - delta), delimitors),
+ scribo::internal::point_col_adjust(
+ point2d(brot.pmax().row(),
+ brot.pmin().col() - delta), delimitors),
true);
}
# ifndef SCRIBO_NDEBUG
mln::draw::line(debug,
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmin().row() - ldelta,
- group_bbox(c).to_result().pmin().col()), debug),
+ point2d(group_bbox(g).to_result().pmin().row() - ldelta,
+ group_bbox(g).to_result().pmin().col()), debug),
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmin().row() - ldelta,
- group_bbox(c).to_result().pmax().col()), debug),
+ point2d(group_bbox(g).to_result().pmin().row() - ldelta,
+ group_bbox(g).to_result().pmax().col()), debug),
literal::green);
# endif // ! SCRIBO_NDEBUG
-
}
}
@@ -849,12 +852,7 @@ namespace scribo
// 2.2. BEGIN OF BOTTOM LINKS PROCESSING
{
object_links<L> bot_links;
-
- object_groups<L>
- bot_groups,
- old_bot_groups;
-
- util::array<unsigned> bot_group_size;
+ object_groups<L> bot_groups;
typedef mln::accu::stat::median_h<value::int_u<12u> > median_t;
mln::util::array<median_t>
@@ -892,27 +890,30 @@ namespace scribo
anchor::StrictBottomCenter);
// Remove groups with not enough links.
- old_bot_groups = primitive::group::from_single_link(bot_links);
- bot_groups = filter::object_groups_small(old_bot_groups, min_card,
- bot_group_size);
+ bot_groups = primitive::group::from_single_link(bot_links);
+
+ bot_groups = filter::object_groups_small(bot_groups, min_card);
bot_median_char_space.resize(bot_groups.nelements());
bot_median_char_width.resize(bot_groups.nelements());
bot_max_char_width.resize(bot_groups.nelements());
for_all_groups(g, bot_groups)
- if (bot_groups.is_valid(g))
- {
- if (lines(g).card() > 1)
+ if (bot_groups(g).is_valid())
+ for_all_elements(e, bot_groups(g).component_ids())
{
- bot_median_char_space(bot_groups(g)).take(lines(g).char_space());
- bot_median_char_width(bot_groups(g)).take(lines(g).char_width());
+ unsigned l = bot_groups(g).component_ids()(e);
+
+ if (lines(l).card() > 1)
+ {
+ bot_median_char_space(g).take(lines(l).char_space());
+ bot_median_char_width(g).take(lines(l).char_width());
+ }
+ // This data will be used if alignments are made with single
+ // components only.
+ else if (bot_max_char_width(g) < lines(l).char_width())
+ bot_max_char_width(g) = lines(l).char_width();
}
- // This data will be used if alignments are made with single
- // components only.
- else if (bot_max_char_width(bot_groups(g)) < lines(g).char_width())
- bot_max_char_width(bot_groups(g)) = lines(g).char_width();
- }
}
@@ -921,19 +922,20 @@ namespace scribo
util::array<accu::shape::bbox<point2d> >
group_bbox(bot_groups.nelements());
- // Compute group bboxes
- for_all_links(l, bot_links)
- if (bot_links.is_valid(l))
- {
- point2d p = components(l).bbox().pmin();
- p.row() = components(l).bbox().pmax().row();
+ // Compute group bboxes
+ for_all_groups(g, bot_groups)
+ for_all_elements(e, bot_groups(g).component_ids())
+ {
+ unsigned l = bot_groups(g).component_ids()(e);
+ point2d p = components(l).bbox().pmin();
+ p.row() = components(l).bbox().pmax().row();
- if (bot_groups.is_valid(l)
- && bot_group_size(old_bot_groups(l)) > 2)
+ if (bot_groups(g).is_valid())// && bot_links.is_linked(l))
+ {
+ if (bot_groups.group_of(l).is_valid())
{
- group_bbox(bot_groups(l)).take(p);
- group_bbox(bot_groups(l)).take(
- components(bot_links(l)).bbox().pmax());
+ group_bbox(g).take(p);
+ group_bbox(g).take(components(bot_links(l)).bbox().pmax());
# ifndef SCRIBO_NDEBUG
// Draw first component box
@@ -950,76 +952,78 @@ namespace scribo
literal::cyan);
# endif // ! SCRIBO_NDEBUG
}
-
+ }
# ifndef SCRIBO_NDEBUG
- else if (bot_group_size(old_bot_groups(l)) > 1)
- {
- mln::draw::line(debug,
- p,
- components(bot_links(l)).bbox().pmax(),
- literal::orange);
-
- // Draw first component box
- mln::draw::box(debug,
- internal::fast_rotate_positive(
- groups.components()(lines(l).component_ids()[lines(l).card() - 1]).bbox(),
- rbbox),
- literal::cyan);
-
- mln::draw::box(debug,
- internal::fast_rotate_positive(
- groups.components()(lines(bot_links(l)).component_ids()[lines(bot_links(l)).card() - 1]).bbox(),
- rbbox),
- literal::cyan);
- }
-# endif // ! SCRIBO_NDEBUG
+ else if (bot_groups(g).card() > 1)
+ {
+ mln::draw::line(debug,
+ p,
+ components(bot_links(l)).bbox().pmax(),
+ literal::orange);
+
+ // Draw first component box
+ mln::draw::box(debug,
+ internal::fast_rotate_positive(
+ groups.components()(lines(l).component_ids()[lines(l).card() - 1]).bbox(),
+ rbbox),
+ literal::cyan);
+
+ mln::draw::box(debug,
+ internal::fast_rotate_positive(
+ groups.components()(lines(bot_links(l)).component_ids()[lines(bot_links(l)).card() - 1]).bbox(),
+ rbbox),
+ literal::cyan);
}
-
+# endif // ! SCRIBO_NDEBUG
+ }
// Looking for whitespaces
- for_all_elements(c, group_bbox)
- if (group_bbox(c).is_valid())
+ for_all_groups(g, bot_groups)
+ if (bot_groups(g).is_valid())
{
unsigned ldelta = delta;
- if (bot_group_size(c) >= 3 && bot_group_size(c) < 5)
+ // Special case : handle low connected groups.
+ if (bot_groups(g).card() >= 3 && bot_groups(g).card() < 5)
{
// Stats are not reliable, prefer using max char width.
- if (bot_median_char_width(c).card() == 0)
- ldelta = bot_max_char_width(c) * 2;
+ if (bot_median_char_width(g).card() == 0)
+ ldelta = internal::compute_unreliable_ldelta(bot_max_char_width(g));
else
- ldelta = 1.2 * bot_median_char_width(c)
- + bot_median_char_space(c);
+ ldelta = internal::compute_reliable_ldelta(bot_median_char_width(g),
+ bot_median_char_space(g));
- point2d p(group_bbox(c).to_result().pmax().row() + ldelta,
- group_bbox(c).to_result().pmin().col());
+ point2d p(bot_groups(g).bbox().pmax().row() + ldelta,
+ bot_groups(g).bbox().pmin().col());
p = scribo::internal::point_row_adjust(p, bbox_ima);
// Checking whitespace area
- for (; p.col() <= group_bbox(c).to_result().pmax().col()
+ for (; p.col() <= group_bbox(g).to_result().pmax().col()
&& (bbox_ima(p) == 0);)
++p.col();
if (bbox_ima(p) != 0)
{
+ bot_groups(g).invalidate();
+
# ifndef SCRIBO_NDEBUG
mln::draw::line(debug,
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmax().row() + ldelta,
- group_bbox(c).to_result().pmin().col()), debug),
+ point2d(group_bbox(g).to_result().pmax().row() + ldelta,
+ group_bbox(g).to_result().pmin().col()), debug),
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmax().row() + ldelta,
- group_bbox(c).to_result().pmax().col()), debug),
+ point2d(group_bbox(g).to_result().pmax().row() + ldelta,
+ group_bbox(g).to_result().pmax().col()), debug),
literal::red);
# endif // ! SCRIBO_NDEBUG
-
continue;
}
}
box2d
- brot = internal::fast_rotate_negative(group_bbox(c).to_result(),
+ brot = internal::fast_rotate_negative(group_bbox(g).to_result(),
rbbox);
+ // Checking if delimitor is skewed.
if (internal::is_valid_left_right_skewed_delimitor(brot, input,
- delta))
{
@@ -1066,11 +1070,11 @@ namespace scribo
# ifndef SCRIBO_NDEBUG
mln::draw::line(debug,
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmax().row() + ldelta,
- group_bbox(c).to_result().pmin().col()), debug),
+ point2d(group_bbox(g).to_result().pmax().row() + ldelta,
+ group_bbox(g).to_result().pmin().col()), debug),
scribo::internal::point_row_adjust(
- point2d(group_bbox(c).to_result().pmax().row() + ldelta,
- group_bbox(c).to_result().pmax().col()), debug),
+ point2d(group_bbox(g).to_result().pmax().row() + ldelta,
+ group_bbox(g).to_result().pmax().col()), debug),
literal::green);
# endif // ! SCRIBO_NDEBUG
}
--
1.5.6.5
1
0

last-svn-commit-845-g7e736d6 Improve object_groups and object_links API.
by Guillaume Lazzara 03 May '11
by Guillaume Lazzara 03 May '11
03 May '11
* scribo/core/group_info.hh,
* scribo/core/internal/sort_comp_ids.hh: New.
* scribo/core/object_groups.hh,
* scribo/core/object_links.hh: Improve API.
* scribo/core/line_info.hh,
* scribo/core/line_set.hh,
* scribo/debug/decision_image.hh,
* scribo/estim/object_groups_mean_width.hh,
* scribo/filter/object_groups_mean_width.hh,
* scribo/filter/object_groups_size_ratio.hh,
* scribo/filter/object_groups_small.hh,
* scribo/filter/object_groups_with_holes.hh,
* scribo/filter/object_links_bbox_overlap.hh,
* scribo/filter/object_links_bbox_ratio.hh,
* scribo/filter/object_links_non_aligned_simple.hh,
* scribo/primitive/group/from_double_link_any.hh,
* scribo/primitive/group/from_single_link.hh,
* scribo/primitive/internal/is_link_valid.hh,
* scribo/primitive/link/internal/link_functor_base.hh,
* scribo/primitive/link/internal/link_several_dmax_base.hh,
* scribo/primitive/link/merge_double_link.hh,
* scribo/primitive/link/merge_double_link_closest_aligned.hh,
* tests/filter/object_groups_mean_width.cc,
* tests/filter/object_groups_size_ratio.cc,
* tests/filter/object_groups_small.cc,
* tests/filter/object_groups_with_holes.cc: Update code to take
API changes into account.
---
scribo/ChangeLog | 34 +++
scribo/scribo/core/group_info.hh | 184 ++++++++++++++++
.../sort_comp_ids.hh} | 57 +++---
scribo/scribo/core/line_info.hh | 140 ++++++++-----
scribo/scribo/core/line_set.hh | 66 ++++---
scribo/scribo/core/object_groups.hh | 228 +++++++++++++++-----
scribo/scribo/core/object_links.hh | 81 ++++++-
scribo/scribo/debug/decision_image.hh | 8 +-
scribo/scribo/estim/object_groups_mean_width.hh | 21 +--
scribo/scribo/filter/object_groups_mean_width.hh | 10 +-
scribo/scribo/filter/object_groups_size_ratio.hh | 16 +-
scribo/scribo/filter/object_groups_small.hh | 36 +---
scribo/scribo/filter/object_groups_with_holes.hh | 2 +-
scribo/scribo/filter/object_links_bbox_overlap.hh | 6 +-
scribo/scribo/filter/object_links_bbox_ratio.hh | 10 +-
.../filter/object_links_non_aligned_simple.hh | 6 +-
.../scribo/primitive/group/from_double_link_any.hh | 57 ++++--
scribo/scribo/primitive/group/from_single_link.hh | 13 --
scribo/scribo/primitive/internal/is_link_valid.hh | 12 +-
.../primitive/link/internal/link_functor_base.hh | 2 +-
.../link/internal/link_several_dmax_base.hh | 10 +-
scribo/scribo/primitive/link/merge_double_link.hh | 17 +-
.../link/merge_double_link_closest_aligned.hh | 6 +-
scribo/tests/filter/object_groups_mean_width.cc | 11 +-
scribo/tests/filter/object_groups_size_ratio.cc | 10 +-
scribo/tests/filter/object_groups_small.cc | 28 +--
scribo/tests/filter/object_groups_with_holes.cc | 10 +-
27 files changed, 743 insertions(+), 338 deletions(-)
create mode 100644 scribo/scribo/core/group_info.hh
copy scribo/scribo/core/{component_features_data.hh => internal/sort_comp_ids.hh} (59%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 8d95b3a..7bbfb9e 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,37 @@
+2011-05-03 Guillaume Lazzara <lazzara(a)fidji.lrde.epita.fr>
+
+ Improve object_groups and object_links API.
+
+ * scribo/core/group_info.hh,
+ * scribo/core/internal/sort_comp_ids.hh: New.
+
+ * scribo/core/object_groups.hh,
+ * scribo/core/object_links.hh: Improve API.
+
+ * scribo/core/line_info.hh,
+ * scribo/core/line_set.hh,
+ * scribo/debug/decision_image.hh,
+ * scribo/estim/object_groups_mean_width.hh,
+ * scribo/filter/object_groups_mean_width.hh,
+ * scribo/filter/object_groups_size_ratio.hh,
+ * scribo/filter/object_groups_small.hh,
+ * scribo/filter/object_groups_with_holes.hh,
+ * scribo/filter/object_links_bbox_overlap.hh,
+ * scribo/filter/object_links_bbox_ratio.hh,
+ * scribo/filter/object_links_non_aligned_simple.hh,
+ * scribo/primitive/group/from_double_link_any.hh,
+ * scribo/primitive/group/from_single_link.hh,
+ * scribo/primitive/internal/is_link_valid.hh,
+ * scribo/primitive/link/internal/link_functor_base.hh,
+ * scribo/primitive/link/internal/link_several_dmax_base.hh,
+ * scribo/primitive/link/merge_double_link.hh,
+ * scribo/primitive/link/merge_double_link_closest_aligned.hh,
+ * tests/filter/object_groups_mean_width.cc,
+ * tests/filter/object_groups_size_ratio.cc,
+ * tests/filter/object_groups_small.cc,
+ * tests/filter/object_groups_with_holes.cc: Update code to take
+ API changes into account.
+
2011-04-07 Guillaume Lazzara <z(a)lrde.epita.fr>
Add test data in EXTRA_DIST.
diff --git a/scribo/scribo/core/group_info.hh b/scribo/scribo/core/group_info.hh
new file mode 100644
index 0000000..19a8ecc
--- /dev/null
+++ b/scribo/scribo/core/group_info.hh
@@ -0,0 +1,184 @@
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_CORE_GROUP_INFO_HH
+# define SCRIBO_CORE_GROUP_INFO_HH
+
+/// \file
+///
+/// \brief Object groups representation.
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_links.hh>
+# include <scribo/core/component_set.hh>
+
+# include <scribo/core/internal/sort_comp_ids.hh>
+# include <scribo/core/concept/serializable.hh>
+
+
+namespace scribo
+{
+
+ using namespace mln;
+
+ class group_info
+ {
+ public:
+ group_info();
+ group_info(unsigned id, const mln::util::array<component_id_t>& comps,
+ unsigned pixel_area, const box2d& bbox);
+ // used for incremental construction (xml loading).
+ group_info(unsigned id, unsigned pixel_area, const box2d& bbox,
+ bool valid = false);
+
+ const mln::util::array<component_id_t>& component_ids() const;
+
+ // Used for incremental construction (xml loading)
+ mln::util::array<component_id_t>& component_ids_();
+
+ bool is_valid() const;
+ void invalidate();
+
+ unsigned card() const;
+ unsigned id() const;
+ unsigned pixel_area() const;
+ const box2d& bbox() const;
+
+ private:
+ unsigned id_;
+ mln::util::array<component_id_t> comps_;
+ bool valid_;
+ unsigned pixel_area_;
+ box2d bbox_;
+ };
+
+ bool operator==(const group_info& lhs, const group_info& rhs);
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ group_info::group_info()
+ : valid_(false)
+ {
+ }
+
+ group_info::group_info(unsigned id, const mln::util::array<component_id_t>& comps,
+ unsigned pixel_area, const box2d& bbox)
+ : id_(id), comps_(comps), valid_(true),
+ pixel_area_(pixel_area), bbox_(bbox)
+ {
+ }
+
+ group_info::group_info(unsigned id, unsigned pixel_area, const box2d& bbox, bool valid)
+ : id_(id), valid_(valid),
+ pixel_area_(pixel_area), bbox_(bbox)
+ {
+ }
+
+ const mln::util::array<component_id_t>&
+ group_info::component_ids() const
+ {
+ return comps_;
+ }
+
+ mln::util::array<component_id_t>&
+ group_info::component_ids_()
+ {
+ return comps_;
+ }
+
+ bool group_info::is_valid() const
+ {
+ return valid_;
+ }
+
+ void
+ group_info::invalidate()
+ {
+ valid_ = false;
+ }
+
+ unsigned
+ group_info::card() const
+ {
+ return comps_.nelements();
+ }
+
+ unsigned
+ group_info::id() const
+ {
+ return id_;
+ }
+
+ unsigned
+ group_info::pixel_area() const
+ {
+ return pixel_area_;
+ }
+
+ const box2d&
+ group_info::bbox() const
+ {
+ return bbox_;
+ }
+
+ inline
+ std::ostream&
+ operator<<(std::ostream& ostr, const group_info& group_info)
+ {
+ ostr << "group_info[";
+
+ ostr << "id=" << group_info.id() << ", "
+ << "valid=" << group_info.is_valid() << ", "
+ << "pixel_area=" << group_info.pixel_area() << ", "
+ << "bbox=" << group_info.bbox() << ", "
+ << "component_ids=" << group_info.component_ids();
+
+ ostr << "]";
+
+ return ostr;
+ }
+
+ inline
+ bool
+ operator==(const group_info& lhs, const group_info& rhs)
+ {
+ return
+ lhs.id() == rhs.id()
+ && lhs.component_ids() == rhs.component_ids()
+ && lhs.is_valid() == rhs.is_valid()
+ && lhs.pixel_area() == rhs.pixel_area()
+ && lhs.bbox() == rhs.bbox();
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_CORE_GROUP_INFO_HH
diff --git a/scribo/scribo/core/component_features_data.hh b/scribo/scribo/core/internal/sort_comp_ids.hh
similarity index 59%
copy from scribo/scribo/core/component_features_data.hh
copy to scribo/scribo/core/internal/sort_comp_ids.hh
index 07b3e4a..83cd507 100644
--- a/scribo/scribo/core/component_features_data.hh
+++ b/scribo/scribo/core/internal/sort_comp_ids.hh
@@ -23,54 +23,55 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_CORE_COMPONENT_FEATURES_DATA_HH
-# define SCRIBO_CORE_COMPONENT_FEATURES_DATA_HH
+#ifndef SCRIBO_CORE_INTERNAL_SORT_COMP_IDS_HH
+# define SCRIBO_CORE_INTERNAL_SORT_COMP_IDS_HH
/// \file
///
-/// \brief Component features data structure.
+/// Functor ordering Components by location, from left to right.
-# include <scribo/core/def/color_type.hh>
+# include <scribo/core/component_set.hh>
+
namespace scribo
{
- struct component_features_data
+ namespace internal
{
- component_features_data();
-
- bool valid;
- scribo::def::color_type color;
- float boldness;
- };
+ template <typename L>
+ struct sort_comp_ids
+ {
+ sort_comp_ids(const component_set<L>& comp_set);
+ bool operator()(const component_id_t& l, const component_id_t& r) const;
- std::ostream&
- operator<<(std::ostream& ostr, const component_features_data& data);
+ component_set<L> comps_;
+ };
# ifndef MLN_INCLUDE_ONLY
- component_features_data::component_features_data()
- : valid(false)
- {
- }
+ template <typename L>
+ sort_comp_ids<L>::sort_comp_ids(const component_set<L>& comp_set)
+ : comps_(comp_set)
+ {
+ }
- inline
- std::ostream&
- operator<<(std::ostream& ostr, const component_features_data& data)
- {
- return ostr << "features["
- << "valid=" << data.valid
- << ", color=" << data.color
- << ", boldness=" << data.boldness
- << "]" << std::endl;
- }
+ template <typename L>
+ bool
+ sort_comp_ids<L>::operator()(const component_id_t& l,
+ const component_id_t& r) const
+ {
+ return comps_(l).bbox().pmin().col() < comps_(r).bbox().pmin().col()
+ && comps_(l).bbox().pmax().col() < comps_(r).bbox().pmax().col();
+ }
# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace scribo::internal
+
} // end of namespace scribo
-#endif // ! SCRIBO_CORE_COMPONENT_FEATURES_DATA_HH
+#endif // ! SCRIBO_CORE_INTERNAL_SORT_COMP_IDS_HH
diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh
index e925db7..b8a8be3 100644
--- a/scribo/scribo/core/line_info.hh
+++ b/scribo/scribo/core/line_info.hh
@@ -54,9 +54,11 @@
# include <scribo/core/tag/component.hh>
# include <scribo/core/tag/line.hh>
+# include <scribo/core/object_groups.hh>
# include <scribo/core/line_set.hh>
# include <scribo/core/component_set.hh>
+# include <scribo/core/internal/sort_comp_ids.hh>
# include <scribo/core/concept/serializable.hh>
@@ -79,14 +81,16 @@ namespace scribo
{
line_info_data();
line_info_data(const line_set<L>& holder,
- const mln::util::array<component_id_t>& comps);
-
+ const group_info& group);
+ // Used for incremental construction (xml loading)
+ line_info_data(const line_set<L>& holder,
+ const mln::util::array<component_id_t>& component_ids);
bool hidden_;
line::Tag tag_;
mln::box2d bbox_;
mln::box2d ebbox_;
- mln::util::array<component_id_t> components_;
+ mln::util::array<component_id_t> component_ids_;
// The number of pixels used for line characters.
unsigned pixel_area_;
@@ -138,21 +142,11 @@ namespace scribo
// Line set holding this element.
line_set<L> holder_;
- };
-
-
- // Functor used to sort components ids.
- // Order by location from left to right.
- template <typename L>
- struct sort_comp_ids
- {
- sort_comp_ids(const component_set<L>& comp_set);
- bool operator()(const component_id_t& l, const component_id_t& r) const;
+ private:
+ void init_();
- component_set<L> comps_;
};
-
} // end of namespace scribo::internal
@@ -176,7 +170,7 @@ namespace scribo
line_info(const line_set<L>& holder,
const line_id_t& id,
- const mln::util::array<component_id_t>& comps);
+ const group_info& group);
/// The line id of the target instance is preserved if it is valid.
line_info(const line_info<L>& other);
@@ -317,6 +311,10 @@ namespace scribo
std::ostream&
operator<<(std::ostream& ostr, const line_info<L>& info);
+ template <typename L>
+ bool
+ operator==(const line_info<L>& lhs, const line_info<L>& rhs);
+
# ifndef MLN_INCLUDE_ONLY
@@ -365,13 +363,28 @@ namespace scribo
hidden_ = false;
}
+ template <typename L>
+ line_info_data<L>::line_info_data(const line_set<L>& holder,
+ const group_info& group)
+ : hidden_(false), tag_(line::None), component_ids_(group.component_ids()),
+ type_(line::Undefined), holder_(holder)
+ {
+ init_();
+ }
template <typename L>
line_info_data<L>::line_info_data(const line_set<L>& holder,
- const mln::util::array<component_id_t>& comps)
- : hidden_(false), tag_(line::None), components_(comps),
+ const mln::util::array<component_id_t>& component_ids)
+ : hidden_(false), tag_(line::None), component_ids_(component_ids),
type_(line::Undefined), holder_(holder)
{
+ init_();
+ }
+
+ template <typename L>
+ void
+ line_info_data<L>::init_()
+ {
// FIXME: set valid information for these attributes in
// force_stats_update.
word_space_ = 0;
@@ -384,26 +397,6 @@ namespace scribo
indented_ = false;
}
-
-
- // sort_comp_ids functor
-
- template <typename L>
- sort_comp_ids<L>::sort_comp_ids(const component_set<L>& comp_set)
- : comps_(comp_set)
- {
- }
-
-
- template <typename L>
- bool
- sort_comp_ids<L>::operator()(const component_id_t& l,
- const component_id_t& r) const
- {
- return comps_(l).bbox().pmin().col() < comps_(r).bbox().pmin().col()
- && comps_(l).bbox().pmax().col() < comps_(r).bbox().pmax().col();
- }
-
} // end of namespace scribo::internal
@@ -480,10 +473,10 @@ namespace scribo
template <typename L>
line_info<L>::line_info(const line_set<L>& holder,
const line_id_t& id,
- const mln::util::array<component_id_t>& comps)
+ const group_info& group)
: id_(id)
{
- data_ = new data_t(holder, comps);
+ data_ = new data_t(holder, group);
force_stats_update();
}
@@ -540,7 +533,7 @@ namespace scribo
const mln::util::array<typename line_info<L>::component_id_t>&
line_info<L>::component_ids() const
{
- return data_->components_;
+ return data_->component_ids_;
}
@@ -548,7 +541,7 @@ namespace scribo
unsigned
line_info<L>::card() const
{
- return data_->components_.size();
+ return data_->component_ids_.size();
}
@@ -691,9 +684,9 @@ namespace scribo
void
line_info<L>::update_components_type(component::Type type)
{
- for_all_elements(i, data_->components_)
+ for_all_elements(i, data_->component_ids_)
{
- unsigned c = data_->components_[i];
+ unsigned c = data_->component_ids_[i];
data_->holder_.components_()(c).update_type(type);
}
}
@@ -954,7 +947,7 @@ namespace scribo
// Update bbox and ebbox
update_bbox_and_ebox(other);
- data_->components_.append(other.component_ids());
+ data_->component_ids_.append(other.component_ids());
}
@@ -1006,9 +999,9 @@ namespace scribo
// Workaround to avoid overflow with int_u<12> in median accumulators.
//
// FIXME: not optimal...
- for_all_elements(i, data_->components_)
+ for_all_elements(i, data_->component_ids_)
{
- unsigned c = data_->components_(i);
+ unsigned c = data_->component_ids_(i);
// Ignore punctuation for stats computation but not for bbox
// computation.
@@ -1020,9 +1013,9 @@ namespace scribo
unsigned used_comps = 0;
- for_all_elements(i, data_->components_)
+ for_all_elements(i, data_->component_ids_)
{
- unsigned c = data_->components_(i);
+ unsigned c = data_->component_ids_(i);
pixel_area += comp_set(c).card();
@@ -1111,8 +1104,8 @@ namespace scribo
// Order component ids according to component localization (left
// to right).
- std::sort(data_->components_.hook_std_vector_().begin(),
- data_->components_.hook_std_vector_().end(),
+ std::sort(data_->component_ids_.hook_std_vector_().begin(),
+ data_->component_ids_.hook_std_vector_().end(),
internal::sort_comp_ids<L>(comp_set));
// Boldness
@@ -1142,8 +1135,8 @@ namespace scribo
// Char width
if (card() == 2)
- data_->char_width_ = (comp_set(data_->components_[0]).bbox().width()
- + comp_set(data_->components_[1]).bbox().width()) / 2;
+ data_->char_width_ = (comp_set(data_->component_ids_[0]).bbox().width()
+ + comp_set(data_->component_ids_[1]).bbox().width()) / 2;
else
data_->char_width_ = char_width.to_result();
@@ -1218,6 +1211,47 @@ namespace scribo
}
+ template <typename L>
+ bool
+ operator==(const line_info<L>& lhs, const line_info<L>& rhs)
+ {
+ if (! lhs.is_valid() && ! rhs.is_valid())
+ return true;
+
+ return
+ lhs.is_valid() == rhs.is_valid()
+ && lhs.id() == rhs.id()
+ && lhs.pixel_area() == rhs.pixel_area()
+ && lhs.tag() == rhs.tag()
+ && lhs.type() == rhs.type()
+ && lhs.bbox() == rhs.bbox()
+ && lhs.ebbox() == rhs.ebbox()
+ && lhs.boldness() == rhs.boldness()
+ && lhs.boldness_reliability() == rhs.boldness_reliability()
+ && lhs.color() == rhs.color()
+ && lhs.color_reliability() == rhs.color_reliability()
+ && lhs.component_ids() == rhs.component_ids()
+ && lhs.baseline() == rhs.baseline()
+ && lhs.meanline() == rhs.meanline()
+ && lhs.ascent() == rhs.ascent()
+ && lhs.descent() == rhs.descent()
+ && lhs.x_height() == rhs.x_height()
+ && lhs.d_height() == rhs.d_height()
+ && lhs.a_height() == rhs.a_height()
+ && lhs.char_space() == rhs.char_space()
+ && lhs.char_width() == rhs.char_width()
+ && lhs.word_space() == rhs.word_space()
+ && lhs.reading_orientation() == rhs.reading_orientation()
+ && lhs.type() == rhs.type()
+ && lhs.reverse_video() == rhs.reverse_video()
+ && lhs.orientation() == rhs.orientation()
+ && lhs.reading_orientation() == rhs.reading_orientation()
+ && lhs.indented() == rhs.indented()
+ && lhs.is_hidden() == rhs.is_hidden()
+ && lhs.text() == rhs.text()
+ && lhs.html_text() == rhs.html_text();
+ }
+
# endif// ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/core/line_set.hh b/scribo/scribo/core/line_set.hh
index f1e443b..db987e6 100644
--- a/scribo/scribo/core/line_set.hh
+++ b/scribo/scribo/core/line_set.hh
@@ -123,6 +123,9 @@ namespace scribo
/// Return line information for a given line id \p id.
const line_info<L>& operator()(const line_id_t& id) const;
+ /// Return all the line information.
+ const mln::util::array<line_info<L> >& infos() const;
+
/// Update tag of lines set to 'false' in \p f with \p tag.
template <typename F>
void update_tags(const mln::Function_v2b<F>& f, line::Tag tag);
@@ -166,7 +169,6 @@ namespace scribo
void update_line_data_(const mln::util::array<line_info<L> >& line_data);
-
private:
/// Duplicate the underlying image and create a new line_set.
void init_(const line_set<L>& model);
@@ -174,6 +176,11 @@ namespace scribo
mln::util::tracked_ptr< internal::line_set_data<L> > data_;
};
+
+ template <typename L>
+ bool
+ operator==(const line_set<L>& lhs, const line_set<L>& rhs);
+
template <typename L>
std::ostream&
operator<<(std::ostream& ostr, const line_set<L>& lines);
@@ -260,38 +267,14 @@ namespace scribo
{
data_ = new internal::line_set_data<L>(groups);
- typedef mln_site(L) P;
-
- mln_value(L) n_groups = groups.nelements() - 1;
- mln::fun::i2v::array<mln_value(L)>
- packed_groups = mln::make::relabelfun(groups.comp_to_group(),
- n_groups, n_groups);
-
- // FIXME: object_groups should store the relation 'group -> comp'.
- mln::util::array< mln::util::array<component_id_t> >
- group_to_comps(value::next(n_groups));
-
-
- // 1st pass - Compute data.
- for_all_comps(i, data_->components_)
- if (data_->components_(i).is_valid())
- {
- unsigned group_id = packed_groups(i);
- if (group_id != 0) // Is this component part of a group?
- {
- // Component id.
- group_to_comps(group_id).append(i);
- }
- }
-
// 2nd pass - Store data.
- data_->infos_.reserve(group_to_comps.size());
+ data_->infos_.reserve(groups.nelements());
data_->infos_.append(line_info<L>()); // line with id 0 is invalid.
- for_all_groups(i, group_to_comps)
+ for_all_groups(i, groups)
{
// Add line info.
- line_info<L> info(*this, i, group_to_comps(i));
+ line_info<L> info(*this, i, groups(i));
data_->infos_.append(info);
}
}
@@ -339,6 +322,13 @@ namespace scribo
}
template <typename L>
+ const mln::util::array<line_info<L> >&
+ line_set<L>::infos() const
+ {
+ return this->data_->infos_;
+ }
+
+ template <typename L>
template <typename F>
inline
void
@@ -437,6 +427,26 @@ namespace scribo
data_ = new internal::line_set_data<L>(set.infos_(), set.groups());
}
+ template <typename L>
+ bool
+ operator==(const line_set<L>& lhs, const line_set<L>& rhs)
+ {
+ if (! (lhs.groups() == rhs.groups() && lhs.nelements() == rhs.nelements()))
+ {
+ std::cout << "line.group" << std::endl;
+ return false;
+ }
+
+ for_all_lines(l, lhs)
+ if ( ! (lhs(l) != rhs(l)))
+ {
+ std::cout << "line.info" << std::endl;
+ return false;
+ }
+
+ return true;
+ }
+
template <typename L>
diff --git a/scribo/scribo/core/object_groups.hh b/scribo/scribo/core/object_groups.hh
index 2a4b0b1..1cc8815 100644
--- a/scribo/scribo/core/object_groups.hh
+++ b/scribo/scribo/core/object_groups.hh
@@ -36,8 +36,13 @@
# include <scribo/core/object_links.hh>
# include <scribo/core/component_set.hh>
+# include <scribo/core/group_info.hh>
+# include <scribo/core/internal/sort_comp_ids.hh>
# include <scribo/core/concept/serializable.hh>
+// Not to include.
+//#include <scribo/core/line_info.hh>
+
namespace scribo
{
@@ -47,7 +52,6 @@ namespace scribo
// Forward declaration.
template <typename L> class object_groups;
-
namespace internal
{
/// Data structure for \c scribo::object_groups<I>.
@@ -56,9 +60,12 @@ namespace scribo
{
object_groups_data();
object_groups_data(const object_links<L>& links);
- object_groups_data(const object_links<L>& links, unsigned value);
+ object_groups_data(const object_links<L>& links,
+ const mln::util::array<group_info>& info);
mln::util::array<unsigned> comp_to_group_;
+ mln::util::array<group_info> group_info_;
+
component_set<L> components_;
object_links<L> links_;
};
@@ -78,26 +85,34 @@ namespace scribo
public:
object_groups();
object_groups(const object_links<L>& links);
- object_groups(const object_links<L>& links, unsigned value);
+ // Used for incremental construction (xml loading)
+ object_groups(const object_links<L>& links,
+ const mln::util::array<group_info>& info);
const component_set<L>& components() const;
const object_links<L>& links() const;
- void init_(const object_links<L>& links);
-
bool is_valid() const;
- bool is_valid(unsigned comp_id) const;
+
+ // Return the number of groups
unsigned nelements() const;
- unsigned& operator()(unsigned comp_id);
- const unsigned& operator()(unsigned comp_id) const;
+ /// Return the group id of the component \p comp_id.
+ const group_info& group_of(unsigned comp_id) const;
+ group_info& group_of(unsigned comp_id);
+
+ /// Return group info data for group with id \p group_id.
+ /// Valid id starts from 1.
+ const group_info& operator()(unsigned group_id) const;
+ group_info& operator()(unsigned group_id);
+
+ // Map component ids to group ids.
const mln::util::array<unsigned>& comp_to_group() const;
object_groups<L> duplicate() const;
- void init();
private: // attributes
mln::util::tracked_ptr<data_t> data_;
@@ -108,6 +123,10 @@ namespace scribo
std::ostream&
operator<<(std::ostream& ostr, const object_groups<L>& groups);
+ template <typename L>
+ bool
+ operator==(const object_groups<L>& lhs, const object_groups<L>& rhs);
+
# ifndef MLN_INCLUDE_ONLY
@@ -127,17 +146,93 @@ namespace scribo
: comp_to_group_(unsigned(links.nelements())),
components_(links.components()), links_(links)
{
- };
-
+ comp_to_group_ = links.comp_to_link();
+
+ unsigned ngroups = 0;
+ util::array<unsigned> new_id(comp_to_group_.nelements(), 0);
+ mln::util::array<mln::util::array<component_id_t> > comp_ids(1);
+ mln::util::array<accu::shape::bbox<mln_site(L)> > bboxes(1);
+ mln::util::array<unsigned> pixel_areas(1);
+
+ // Remove potential loops in linking
+ // FIXME: we may try to avoid loops while linking...
+ {
+ util::array<bool> deja_vu(comp_to_group_.nelements());
+ for_all_elements(e, comp_to_group_)
+ if (comp_to_group_(e) != e && comp_to_group_(e) != 0)
+ {
+ deja_vu.fill(false); // FIXME: ugly!
+ unsigned cur = e;
+ deja_vu(cur) = true;
+ while (comp_to_group_(cur) != cur && !deja_vu(comp_to_group_(cur)))
+ {
+ cur = comp_to_group_(cur);
+ deja_vu(cur) = true;
+ }
+ // Break the loop!
+ if (comp_to_group_(cur) != cur && deja_vu(comp_to_group_(cur)))
+ comp_to_group_(cur) = cur;
+ }
+ }
+
+ for_all_elements(e, comp_to_group_)
+ if (comp_to_group_(e) != 0)
+ {
+ // Make sure there is no intermediate ids to reach the root.
+ // FIXME: useful?
+ unsigned e_root = internal::find_root(comp_to_group_, e);
+
+ if (! new_id(e_root))
+ {
+ new_id(e_root) = ++ngroups;
+ comp_ids.resize(comp_ids.size() + 1);
+ bboxes.resize(bboxes.size() + 1);
+ pixel_areas.resize(pixel_areas.size() + 1, 0);
+ }
+
+ unsigned nid = new_id(e_root);
+ comp_ids(nid).append(e);
+
+ bboxes(nid).take(components_(e).bbox());
+ pixel_areas(nid) += components_(e).card();
+ }
+
+ group_info_.resize(1);
+ group_info_.reserve(ngroups);
+ util::array<unsigned> group_idx(ngroups + 1, 0);
+
+ for (unsigned i = 1; i < new_id.nelements(); ++i)
+ if (new_id(i))
+ {
+ unsigned id = new_id(i);
+
+ // Order component ids according to component localization (left
+ // to right).
+ std::sort(comp_ids(id).hook_std_vector_().begin(),
+ comp_ids(id).hook_std_vector_().end(),
+ internal::sort_comp_ids<L>(components_));
+
+ group_idx(id) = group_info_.size();
+ group_info_.append(group_info(group_info_.size(), comp_ids(id), pixel_areas(id), bboxes(id)));
+ }
+
+ // Update mapping comp/group with new ids. Note: group id is
+ // different from its location in group_info array during
+ // construction.
+ for (unsigned i = 0; i < comp_to_group_.nelements(); ++i)
+ comp_to_group_(i) = group_idx(new_id(comp_to_group_(i)));
+ }
template <typename L>
object_groups_data<L>::object_groups_data(const object_links<L>& links,
- unsigned value)
- : comp_to_group_(unsigned(links.nelements()), value),
+ const mln::util::array<group_info>& info)
+ : comp_to_group_(unsigned(links.nelements())), group_info_(info),
components_(links.components()), links_(links)
{
- };
-
+ for_all_groups(g, group_info_)
+ for_all_elements(e, group_info_(g).component_ids())
+ comp_to_group_(group_info_(g).component_ids()(e)) = group_info_(g).id();
+ }
} // end of namespace scribo::internal
@@ -154,9 +249,10 @@ namespace scribo
}
template <typename L>
- object_groups<L>::object_groups(const object_links<L>& links, unsigned value)
+ object_groups<L>::object_groups(const object_links<L>& links,
+ const mln::util::array<group_info>& info)
{
- data_ = new data_t(links, value);
+ data_ = new data_t(links, info);
}
template <typename L>
@@ -175,60 +271,66 @@ namespace scribo
}
template <typename L>
- void
- object_groups<L>::init_(const object_links<L>& links)
- {
- mln_assertion(data_ != 0);
- data_->comp_to_group_ = links.comp_to_link();
- }
-
- template <typename L>
bool
object_groups<L>::is_valid() const
{
- mln_assertion(data_->components_.nelements() == (nelements() - 1));
+ mln_assertion(data_->components_.nelements() == data_->comp_to_group_.nelements() - 1);
return data_->links_.is_valid();
}
template <typename L>
- bool
- object_groups<L>::is_valid(unsigned comp_id) const
+ unsigned
+ object_groups<L>::nelements() const
{
- mln_assertion(is_valid());
- mln_assertion(comp_id < data_->links_.nelements());
- return data_->links_(comp_id) != 0;
+ return data_->group_info_.nelements();
}
template <typename L>
- unsigned
- object_groups<L>::nelements() const
+ const group_info&
+ object_groups<L>::group_of(unsigned comp_id) const
{
- return data_->comp_to_group_.nelements();
+ mln_precondition(comp_id < data_->comp_to_group_.nelements());
+ mln_assertion(data_->group_info_(data_->comp_to_group_(comp_id)).id()
+ == data_->comp_to_group_(comp_id));
+ return data_->group_info_(data_->comp_to_group_(comp_id));
}
+ template <typename L>
+ group_info&
+ object_groups<L>::group_of(unsigned comp_id)
+ {
+ mln_precondition(comp_id < data_->comp_to_group_.nelements());
+ mln_assertion(data_->group_info_(data_->comp_to_group_(comp_id)).id()
+ == data_->comp_to_group_(comp_id));
+ return data_->group_info_(data_->comp_to_group_(comp_id));
+ }
template <typename L>
- unsigned&
- object_groups<L>::operator()(unsigned comp_id)
+ const util::array<unsigned>&
+ object_groups<L>::comp_to_group() const
{
- return data_->comp_to_group_(comp_id);
+ return data_->comp_to_group_;
}
template <typename L>
- const unsigned&
- object_groups<L>::operator()(unsigned comp_id) const
+ const group_info&
+ object_groups<L>::operator()(unsigned group_id) const
{
- return data_->comp_to_group_(comp_id);
+ mln_precondition(group_id < data_->group_info_.nelements());
+ return data_->group_info_(group_id);
}
+
template <typename L>
- const mln::util::array<unsigned>&
- object_groups<L>::comp_to_group() const
+ group_info&
+ object_groups<L>::operator()(unsigned group_id)
{
- return data_->comp_to_group_;
+ mln_precondition(group_id < data_->group_info_.nelements());
+ return data_->group_info_(group_id);
}
+
template <typename L>
inline
object_groups<L>
@@ -242,22 +344,15 @@ namespace scribo
}
template <typename L>
- void
- object_groups<L>::init()
- {
- for (unsigned i = 0; i < nelements(); ++i)
- data_->comp_to_group_(i) = i;
- }
-
-
- template <typename L>
std::ostream&
operator<<(std::ostream& ostr, const object_groups<L>& groups)
{
ostr << "object_groups[";
for_all_groups(g, groups)
- ostr << g << "->" << groups.comp_to_group()[g] << ", ";
+ ostr << groups(g) << ", ";
+
+ ostr << " | comp_to_group=" << groups.comp_to_group();
ostr << "]";
@@ -265,6 +360,33 @@ namespace scribo
}
+ template <typename L>
+ bool
+ operator==(const object_groups<L>& lhs, const object_groups<L>& rhs)
+ {
+ if (! (lhs.components() == rhs.components()))
+ {
+ std::cout << "group.comp" << std::endl;
+ return false;
+ }
+
+ if (!( lhs.comp_to_group() == rhs.comp_to_group() && lhs.nelements() == rhs.nelements()))
+ {
+ std::cout << "group.comp_to_group" << std::endl;
+ return false;
+ }
+
+
+ for_all_groups(g, lhs)
+ if (! (lhs(g) == rhs(g)))
+ {
+ std::cout << "group.info" << std::endl;
+ return false;
+ }
+
+ return true;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/core/object_links.hh b/scribo/scribo/core/object_links.hh
index 1fbcd5a..386de41 100644
--- a/scribo/scribo/core/object_links.hh
+++ b/scribo/scribo/core/object_links.hh
@@ -39,7 +39,6 @@
# include <scribo/core/concept/serializable.hh>
-
namespace scribo
{
@@ -51,6 +50,18 @@ namespace scribo
namespace internal
{
+
+ inline
+ unsigned
+ find_root(mln::util::array<unsigned>& parent, unsigned x)
+ {
+ if (parent(x) == x)
+ return x;
+ else
+ return parent(x) = find_root(parent, parent(x));
+ }
+
+
/// Data structure for \c scribo::object_links<I>.
template <typename L>
struct object_links_data
@@ -83,13 +94,36 @@ namespace scribo
const component_set<L>& components() const;
+ /// Return True if this object_links structure is correctly
+ /// constructed.
bool is_valid() const;
- bool is_valid(unsigned comp_id) const;
+
+ /// Return True if component \p comp_id can be linked to another
+ /// component.
+ bool has_linking_enabled(unsigned comp_id) const;
+
+ /// Return True if component \p comp_id has a link starting from
+ /// itself to another one.
+ bool is_linked(unsigned comp_id) const;
unsigned nelements() const;
- unsigned& operator()(unsigned comp_id);
+ /// Link related methods.
+ /// \{
+ /// Set link between component \p from_id and \p to_id.
+ void update(unsigned from_id, unsigned to_id);
+
+ /// Reset link for component with id \p id. This component can be
+ /// linked later.
+ void clear(unsigned id);
+
+ /// Do not allow component with id \p id to be linked to anyother
+ /// ones.
+ void disable_linking(unsigned id);
+
+ /// Get link id for component \p comp_id.
const unsigned& operator()(unsigned comp_id) const;
+ /// \}
const mln::util::array<unsigned>& comp_to_link() const;
@@ -183,13 +217,25 @@ namespace scribo
template <typename L>
bool
- object_links<L>::is_valid(unsigned comp_id) const
+ object_links<L>::has_linking_enabled(unsigned comp_id) const
{
mln_precondition(is_valid());
mln_precondition(comp_id < data_->comp_to_link_.nelements());
+
return data_->comp_to_link_(comp_id) != 0;
}
+ template <typename L>
+ bool
+ object_links<L>::is_linked(unsigned comp_id) const
+ {
+ mln_precondition(is_valid());
+ mln_precondition(comp_id < data_->comp_to_link_.nelements());
+
+ return has_linking_enabled(comp_id)
+ && data_->comp_to_link_(comp_id) != comp_id;
+ }
+
template <typename L>
unsigned
@@ -200,20 +246,32 @@ namespace scribo
template <typename L>
- unsigned&
- object_links<L>::operator()(unsigned comp_id)
+ const unsigned&
+ object_links<L>::operator()(unsigned comp_id) const
{
return data_->comp_to_link_(comp_id);
}
+ template <typename L>
+ void
+ object_links<L>::update(unsigned from_id, unsigned to_id)
+ {
+ data_->comp_to_link_(from_id) = to_id;
+ }
template <typename L>
- const unsigned&
- object_links<L>::operator()(unsigned comp_id) const
+ void
+ object_links<L>::clear(unsigned id)
{
- return data_->comp_to_link_(comp_id);
+ data_->comp_to_link_(id) = id;
}
+ template <typename L>
+ void
+ object_links<L>::disable_linking(unsigned id)
+ {
+ data_->comp_to_link_(id) = 0;
+ }
template <typename L>
const mln::util::array<unsigned>&
@@ -222,16 +280,15 @@ namespace scribo
return data_->comp_to_link_;
}
-
template <typename L>
void
object_links<L>::init()
{
for (unsigned i = 0; i < nelements(); ++i)
if (data_->components_(i).tag() == component::Ignored)
- data_->comp_to_link_(i) = 0;
+ disable_linking(i);
else
- data_->comp_to_link_(i) = i;
+ clear(i);
}
template <typename L>
diff --git a/scribo/scribo/debug/decision_image.hh b/scribo/scribo/debug/decision_image.hh
index aa1a188..ff298e6 100644
--- a/scribo/scribo/debug/decision_image.hh
+++ b/scribo/scribo/debug/decision_image.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -150,10 +150,10 @@ namespace scribo
for_all_comps(i, comps)
mln::draw::box(decision_image, comps(i).bbox(), literal::blue);
- for (unsigned i = 1; i < links.nelements(); ++i)
+ for_all_links(i, links)
{
- if (links(i) != i)
+ if (links.is_linked(i))
{
mln_site(L)
p1 = primitive::link::internal::compute_anchor(comps, i, anchor),
diff --git a/scribo/scribo/estim/object_groups_mean_width.hh b/scribo/scribo/estim/object_groups_mean_width.hh
index c74137a..65d843c 100644
--- a/scribo/scribo/estim/object_groups_mean_width.hh
+++ b/scribo/scribo/estim/object_groups_mean_width.hh
@@ -72,24 +72,17 @@ namespace scribo
const component_set<L>& components = groups.components();
- //FIXME: remove when object_groups will store the number of
- //elements per group.
- mln::util::array<unsigned> group_card(groups.nelements(), 0.0);
-
mln::util::array<float> output(groups.nelements(), 0.0);
- for_all_comps(i, components)
- if (components(i).is_valid())
- {
- output(groups(i)) += components(i).bbox().width();
- ++group_card(groups(i));
- }
+ for_all_groups(g, groups)
+ for_all_elements(e, groups(g).component_ids())
+ output(g) += components(groups(g).component_ids()(e)).bbox().width();
output(0) = 0;
- for_all_groups(i, output)
- if (components(i).is_valid())
- output(i) /= static_cast<float>(group_card(i));
+ for_all_groups(g, groups)
+ if (groups(g).is_valid())
+ output(g) /= groups(g).card();
else
- output(i) = 0;
+ output(g) = 0;
trace::exiting("scribo::estim::object_groups_mean_width");
return output;
diff --git a/scribo/scribo/filter/object_groups_mean_width.hh b/scribo/scribo/filter/object_groups_mean_width.hh
index 0668205..b9c7b8a 100644
--- a/scribo/scribo/filter/object_groups_mean_width.hh
+++ b/scribo/scribo/filter/object_groups_mean_width.hh
@@ -77,11 +77,11 @@ namespace scribo
group_width = estim::object_groups_mean_width(groups);
object_groups<L> output = groups.duplicate();
- output(0) = 0;
- for (unsigned i = 1; i < output.nelements(); ++i)
- if (groups.components()(i).is_valid()
- && group_width[groups(i)] < width)
- output(i) = 0;
+
+ for_all_groups(g, groups)
+ if (groups(g).is_valid()
+ && group_width[g] < width)
+ output(g).invalidate();
trace::exiting("scribo::filter::object_groups_mean_width");
return output;
diff --git a/scribo/scribo/filter/object_groups_size_ratio.hh b/scribo/scribo/filter/object_groups_size_ratio.hh
index 01676c4..6f2e33e 100644
--- a/scribo/scribo/filter/object_groups_size_ratio.hh
+++ b/scribo/scribo/filter/object_groups_size_ratio.hh
@@ -65,29 +65,23 @@ namespace scribo
const component_set<L>& comps = groups.components();
- // FIXME: estimating the group size should be removed once
- // available in the object_group structure.
// Counting the number of objects per group with a size ratio >
// max_ratio.
mln::util::array<unsigned>
- group_size(groups.nelements(), 0),
invalid_object_in_group(groups.nelements(), 0);
for_all_comps(i, comps)
{
if ((comps(i).bbox().height() / comps(i).bbox().width())
>= max_size_ratio)
- ++invalid_object_in_group(groups(i));
-
- ++group_size(groups(i));
+ ++invalid_object_in_group(groups.group_of(i).id());
}
object_groups<L> output(groups);
- output(0) = 0;
- for (unsigned i = 1; i < output.nelements(); ++i)
- if ((invalid_object_in_group(groups(i)) / static_cast<float>(group_size(groups(i)))) >= max_invalid_ratio_per_group
- || !comps(i).is_valid())
- output(i) = 0;
+ for_all_groups(g, groups)
+ if ((invalid_object_in_group(g) / static_cast<float>(groups(g).card())) >= max_invalid_ratio_per_group
+ || !groups(g).is_valid())
+ output(g).invalidate();
trace::exiting("scribo::filter::object_groups_size_ratio");
return output;
diff --git a/scribo/scribo/filter/object_groups_small.hh b/scribo/scribo/filter/object_groups_small.hh
index 8dd244c..dd92852 100644
--- a/scribo/scribo/filter/object_groups_small.hh
+++ b/scribo/scribo/filter/object_groups_small.hh
@@ -50,7 +50,6 @@ namespace scribo
\param[in] groups Information about object groups.
\param[in] n_links The minimum number of links per group.
- \param[out] group_size Return the group sizes _before_ filtering.
\return A copy of object group in which small groups have been
removed.
@@ -58,13 +57,6 @@ namespace scribo
template <typename L>
object_groups<L>
object_groups_small(const object_groups<L>& groups,
- unsigned n_links,
- mln::util::array<unsigned>& group_size);
-
- // \overload
- template <typename L>
- object_groups<L>
- object_groups_small(const object_groups<L>& groups,
unsigned n_links);
@@ -76,42 +68,22 @@ namespace scribo
inline
object_groups<L>
object_groups_small(const object_groups<L>& groups,
- unsigned n_links,
- mln::util::array<unsigned>& group_size)
+ unsigned n_links)
{
trace::entering("scribo::filter::object_groups_small");
mln_precondition(groups.is_valid());
- // Counting the number of objects per group.
- group_size = mln::util::array<unsigned>(groups.nelements(), 0);
- for_all_groups(i, group_size)
- ++group_size[groups(i)];
-
object_groups<L> output = groups.duplicate();
- output(0) = 0;
+
for_all_groups(i, output)
- if (group_size[groups(i)] < n_links
- || !groups.components()(i).is_valid())
- output(i) = 0;
+ if (output(i).is_valid() && output(i).card() < n_links)
+ output(i).invalidate();
trace::exiting("scribo::filter::object_groups_small");
return output;
}
-
- template <typename L>
- inline
- object_groups<L>
- object_groups_small(const object_groups<L>& groups,
- unsigned n_links)
- {
- mln::util::array<unsigned> group_size;
- return object_groups_small(groups, n_links, group_size);
- }
-
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::filter
diff --git a/scribo/scribo/filter/object_groups_with_holes.hh b/scribo/scribo/filter/object_groups_with_holes.hh
index b86b10e..a59beec 100644
--- a/scribo/scribo/filter/object_groups_with_holes.hh
+++ b/scribo/scribo/filter/object_groups_with_holes.hh
@@ -298,7 +298,7 @@ namespace scribo
object_groups<L> output = groups.duplicate();
for_all_groups(c, groups)
if (! to_keep(group_2_comp(c)))
- output(c) = 0;
+ output(c).invalidate();
trace::exiting("scribo::filter::impl::generic::object_groups_with_holes");
return output;
diff --git a/scribo/scribo/filter/object_links_bbox_overlap.hh b/scribo/scribo/filter/object_links_bbox_overlap.hh
index 995ad68..3bf3c50 100644
--- a/scribo/scribo/filter/object_links_bbox_overlap.hh
+++ b/scribo/scribo/filter/object_links_bbox_overlap.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -109,7 +109,7 @@ namespace scribo
if (ratio_i >= max_overlap_ratio
|| ratio_link_i >= max_overlap_ratio)
- output(i) = i;
+ output.clear(i);
}
trace::exiting("scribo::filter::object_links_bbox_overlap");
diff --git a/scribo/scribo/filter/object_links_bbox_ratio.hh b/scribo/scribo/filter/object_links_bbox_ratio.hh
index 5318b57..d6c9286 100644
--- a/scribo/scribo/filter/object_links_bbox_ratio.hh
+++ b/scribo/scribo/filter/object_links_bbox_ratio.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -78,10 +78,10 @@ namespace scribo
mln_precondition(links.is_valid());
const component_set<L>& components = links.components();
-
object_links<L> output = links.duplicate();
+
for_all_links(i, links)
- if (links(i) && links(i) != i)
+ if (links.is_linked(i))
{
float
lmin = components(i).bbox().pmax()[dim]
@@ -93,7 +93,7 @@ namespace scribo
std::swap(lmin, lmax);
if ((lmax/ lmin) > max_ratio)
- output(i) = i;
+ output.clear(i);
}
trace::exiting("scribo::filter::object_links_bbox_ratio");
diff --git a/scribo/scribo/filter/object_links_non_aligned_simple.hh b/scribo/scribo/filter/object_links_non_aligned_simple.hh
index 5abf598..f8db5cf 100644
--- a/scribo/scribo/filter/object_links_non_aligned_simple.hh
+++ b/scribo/scribo/filter/object_links_non_aligned_simple.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -112,7 +112,7 @@ namespace scribo
if (!::scribo::filter::internal::component_aligned_rad(comps, i, links(i),
anchor,
max_alpha_rad))
- output(i) = i;
+ output.clear(i);
trace::exiting("scribo::filter::object_links_non_aligned_simple");
diff --git a/scribo/scribo/primitive/group/from_double_link_any.hh b/scribo/scribo/primitive/group/from_double_link_any.hh
index b3bd82a..7ed15e2 100644
--- a/scribo/scribo/primitive/group/from_double_link_any.hh
+++ b/scribo/scribo/primitive/group/from_double_link_any.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -42,6 +43,7 @@
# include <scribo/core/macros.hh>
+# include <scribo/core/object_links.hh>
# include <scribo/core/object_groups.hh>
# include <scribo/core/component_set.hh>
# include <scribo/primitive/internal/find_root.hh>
@@ -73,6 +75,21 @@ namespace scribo
# ifndef MLN_INCLUDE_ONLY
+ namespace internal
+ {
+
+ template <typename L>
+ util::array<unsigned> make_parent(const object_links<L>& link)
+ {
+ mln::util::array<unsigned> parent = link.comp_to_link();
+ for_all_links(l, link)
+ parent(l) = scribo::internal::find_root(parent, l);
+
+ return parent;
+ }
+
+ } // end of namespace scribo::primitive::group::internal
+
template <typename L>
inline
@@ -82,40 +99,46 @@ namespace scribo
{
trace::entering("scribo::primitive::group::from_double_link_any");
- object_groups<L> parent(left_link);
- parent.init();
+ object_links<L> merged_link(left_link.components());
+ merged_link.init();
+
+ util::array<unsigned> lparent = internal::make_parent(left_link);
+ util::array<unsigned> rparent = internal::make_parent(right_link);
- for_all_comps(i, left_link.components())
+ for_all_links(i, merged_link)
{
+ // Looking for new left link
unsigned
- pi = internal::find_root(parent, i),
- pli = internal::find_root(parent, left_link(i));
+ pi = scribo::internal::find_root(lparent, i),
+ pli = scribo::internal::find_root(lparent, left_link(i));
if (pi != pli)
{
- if (pli < pi)
- parent(pli) = pi;
+ merged_link.update(i, left_link(i));
+ if (pi < pli)
+ lparent(pli) = pi;
else
- parent(pi) = pli;
+ lparent(pi) = pli;
}
- pi = internal::find_root(parent, i);
- unsigned pri = internal::find_root(parent, right_link(i));
+ // Looking for new right link
+ pi = scribo::internal::find_root(lparent, i);
+ unsigned pri = scribo::internal::find_root(rparent, right_link(i));
if (pi != pri)
{
- if (pri < pi)
- parent(pri) = pi;
+ merged_link.update(i, right_link(i));
+ if (pi < pli)
+ lparent(pli) = pi;
else
- parent(pi) = pri;
+ lparent(pi) = pli;
}
}
- for_all_groups(g, parent)
- internal::find_root(parent, g);
+ object_groups<L> output(merged_link);
trace::exiting("scribo::primitive::group::from_double_link_any");
- return parent;
+ return output;
}
diff --git a/scribo/scribo/primitive/group/from_single_link.hh b/scribo/scribo/primitive/group/from_single_link.hh
index 05efdc7..0a2cca3 100644
--- a/scribo/scribo/primitive/group/from_single_link.hh
+++ b/scribo/scribo/primitive/group/from_single_link.hh
@@ -82,19 +82,6 @@ namespace scribo
mln_precondition(links.is_valid());
object_groups<L> parent(links);
- parent.init_(links);
-
- for_all_groups(i, parent)
- if (!links.components()(i).is_valid())
- parent(i) = 0;
- else
- ::scribo::primitive::internal::find_root(parent, i);
-
-
- // FIXME: useful?
- // Make sure the root is propagated.
- for_all_groups(g, parent)
- internal::find_root(parent, g);
trace::exiting("scribo::primitive::group::from_single_link");
return parent;
diff --git a/scribo/scribo/primitive/internal/is_link_valid.hh b/scribo/scribo/primitive/internal/is_link_valid.hh
index b18e55c..30823cb 100644
--- a/scribo/scribo/primitive/internal/is_link_valid.hh
+++ b/scribo/scribo/primitive/internal/is_link_valid.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -51,9 +51,8 @@ namespace scribo
/// \param[in] i The component id.
///
/// \return True if the link is between the \p i-th component
- /// and it neighbor is validated.
template <typename L>
- mln::util::couple<bool,unsigned>
+ bool
is_link_valid(const object_links<L>& left_link,
const object_links<L>& right_link,
unsigned i);
@@ -61,13 +60,12 @@ namespace scribo
# ifndef MLN_INCLUDE_ONLY
template <typename L>
- mln::util::couple<bool,unsigned>
+ bool
is_link_valid(const object_links<L>& left_link,
const object_links<L>& right_link,
unsigned i)
{
- bool b = (right_link(left_link(i)) == i && left_link(i) != i);
- return mln::make::couple(b, left_link(i));
+ return left_link.is_linked(i) && right_link(left_link(i)) == i;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/primitive/link/internal/link_functor_base.hh b/scribo/scribo/primitive/link/internal/link_functor_base.hh
index 11066c5..a509126 100644
--- a/scribo/scribo/primitive/link/internal/link_functor_base.hh
+++ b/scribo/scribo/primitive/link/internal/link_functor_base.hh
@@ -477,7 +477,7 @@ namespace scribo
{
(void) start_point;
(void) anchor;
- this->links_(current_object) = this->labeled_image_(p);
+ this->links_.update(current_object, this->labeled_image_(p));
}
diff --git a/scribo/scribo/primitive/link/internal/link_several_dmax_base.hh b/scribo/scribo/primitive/link/internal/link_several_dmax_base.hh
index 422eed9..08681c7 100644
--- a/scribo/scribo/primitive/link/internal/link_several_dmax_base.hh
+++ b/scribo/scribo/primitive/link/internal/link_several_dmax_base.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -248,15 +248,15 @@ namespace scribo
if (nratio == 1)
{
- this->links_(current_object)
- = labeled_image_(potential_links_(id_max_ratio).second());
+ this->links_.update(current_object,
+ labeled_image_(potential_links_(id_max_ratio).second()));
return potential_links_(id_max_ratio);
}
}
- this->links_(current_object) = current_object;
+ this->links_.clear(current_object);
return mln::make::couple(anchor::Invalid, P());
}
diff --git a/scribo/scribo/primitive/link/merge_double_link.hh b/scribo/scribo/primitive/link/merge_double_link.hh
index e58c1ab..2416a77 100644
--- a/scribo/scribo/primitive/link/merge_double_link.hh
+++ b/scribo/scribo/primitive/link/merge_double_link.hh
@@ -93,19 +93,20 @@ namespace scribo
const component_set<L>& components = left_link.components();
- object_links<L> merge = left_link.duplicate();
+ object_links<L> merge(components);
+ merge.init();
- for_all_ncomponents(i, components.nelements())
+ for_all_comps(i, components)
{
if (components(i).tag() == component::Ignored)
- merge(i) = 0;
+ merge.disable_linking(i);
else
{
- mln::util::couple<bool, unsigned>
- nbh = primitive::internal::is_link_valid(left_link,
- right_link, i);
- if (!nbh.first())
- merge(i) = i;
+ if (primitive::internal::is_link_valid(left_link,
+ right_link, i))
+ merge.update(i, left_link(i));
+ else
+ merge.clear(i);
}
}
diff --git a/scribo/scribo/primitive/link/merge_double_link_closest_aligned.hh b/scribo/scribo/primitive/link/merge_double_link_closest_aligned.hh
index 6c6e67f..d80fe85 100644
--- a/scribo/scribo/primitive/link/merge_double_link_closest_aligned.hh
+++ b/scribo/scribo/primitive/link/merge_double_link_closest_aligned.hh
@@ -129,14 +129,12 @@ namespace scribo
if (right(left(l)) == left(l))
{
- output(left(l)) = l;
- //output.update_link(left(l), l);
+ output.update(left(l), l);
}
else if ((dh < align_data(left(l)).first() * 0.66f)
|| (alpha < align_data(left(l)).second()))
{
- output(left(l)) = l;
- //output.update_link(left(l), l);
+ output.update(left(l), l);
align_data(left(l)).first() = dh;
align_data(left(l)).second() = alpha;
}
diff --git a/scribo/tests/filter/object_groups_mean_width.cc b/scribo/tests/filter/object_groups_mean_width.cc
index 81da661..751649d 100644
--- a/scribo/tests/filter/object_groups_mean_width.cc
+++ b/scribo/tests/filter/object_groups_mean_width.cc
@@ -45,8 +45,8 @@ int main()
std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
- const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
- const unsigned filtered_ref[] = { 0, 0, 7, 3, 0, 3, 3, 7, 7, 3, 3, 3, 3 };
+ const bool ref[] = { false, true, true, true, true };
+ const unsigned filtered_ref[] = { false, false, true, false, true };
image2d<bool> input;
io::pbm::load(input, img.c_str());
@@ -61,12 +61,13 @@ int main()
object_groups<L> groups = primitive::group::from_single_link(links);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == ref[g]);
+ mln_assertion(groups(g).is_valid() == ref[g]);
groups = filter::object_groups_mean_width(groups, 10);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == filtered_ref[g]);
-
+ mln_assertion(groups(g).is_valid() == filtered_ref[g]);
}
diff --git a/scribo/tests/filter/object_groups_size_ratio.cc b/scribo/tests/filter/object_groups_size_ratio.cc
index 90e353a..4051c71 100644
--- a/scribo/tests/filter/object_groups_size_ratio.cc
+++ b/scribo/tests/filter/object_groups_size_ratio.cc
@@ -45,8 +45,8 @@ int main()
std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
- const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
- const unsigned filtered_ref[] = { 0, 1, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3 };
+ const bool ref[] = { false, true, true, true, true };
+ const bool filtered_ref[] = { false, true, true, false, false };
image2d<bool> input;
io::pbm::load(input, img.c_str());
@@ -61,11 +61,13 @@ int main()
object_groups<L> groups = primitive::group::from_single_link(links);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == ref[g]);
+ mln_assertion(groups(g).is_valid() == ref[g]);
groups = filter::object_groups_size_ratio(groups, 1.2, 0.3);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == filtered_ref[g]);
+ mln_assertion(groups(g).is_valid() == filtered_ref[g]);
}
diff --git a/scribo/tests/filter/object_groups_small.cc b/scribo/tests/filter/object_groups_small.cc
index 165634d..9812b70 100644
--- a/scribo/tests/filter/object_groups_small.cc
+++ b/scribo/tests/filter/object_groups_small.cc
@@ -45,9 +45,9 @@ int main()
std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
- const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
- const unsigned filtered_ref[] = { 0, 0, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3 };
- const unsigned size_ref[] = { 0, 1, 0, 7, 1, 0, 0, 3, 0, 0, 0, 0, 0 };
+ const bool ref[] = { false, true, true, true, true };
+ const bool filtered_ref[] = { false, false, true, false, false };
+ const unsigned size_ref[] = { 0, 1, 7, 1, 3 };
image2d<bool> input;
@@ -63,25 +63,17 @@ int main()
object_groups<L> groups = primitive::group::from_single_link(links);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == ref[g]);
+ mln_assertion(groups(g).is_valid() == ref[g]);
- {
- object_groups<L> groups2 = filter::object_groups_small(groups, 4);
-
- for_all_groups(g, groups2)
- mln_assertion(groups2(g) == filtered_ref[g]);
- }
+ object_groups<L> groups2 = filter::object_groups_small(groups, 4);
+ for_all_groups(g, groups2)
{
- mln::util::array<unsigned> group_size;
- object_groups<L> groups2 = filter::object_groups_small(groups, 4, group_size);
-
- for_all_groups(g, groups2)
- {
- mln_assertion(groups2(g) == filtered_ref[g]);
- mln_assertion(group_size(g) == size_ref[g]);
- }
+ mln_assertion(groups2(g).is_valid() == filtered_ref[g]);
+ mln_assertion(groups2(g).card() == size_ref[g]);
}
+
}
diff --git a/scribo/tests/filter/object_groups_with_holes.cc b/scribo/tests/filter/object_groups_with_holes.cc
index 3b5b29f..72f8464 100644
--- a/scribo/tests/filter/object_groups_with_holes.cc
+++ b/scribo/tests/filter/object_groups_with_holes.cc
@@ -45,8 +45,8 @@ int main()
std::string img = SCRIBO_IMG_DIR "/the_valleys.pbm";
- const unsigned ref[] = { 0, 1, 7, 3, 4, 3, 3, 7, 7, 3, 3, 3, 3 };
- const unsigned filtered_ref[] = { 0, 0, 7, 3, 0, 3, 3, 7, 7, 3, 3, 3, 3 };
+ const bool ref[] = { false, true, true, true, true };
+ const bool filtered_ref[] = { 0, false, true, true, false };
image2d<bool> input;
io::pbm::load(input, img.c_str());
@@ -61,11 +61,13 @@ int main()
object_groups<L> groups = primitive::group::from_single_link(links);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == ref[g]);
+ mln_assertion(groups(g).is_valid() == ref[g]);
groups = filter::object_groups_with_holes(groups, 3);
+ mln_assertion(groups.nelements() == 5);
for_all_groups(g, groups)
- mln_assertion(groups(g) == filtered_ref[g]);
+ mln_assertion(groups(g).is_valid() == filtered_ref[g]);
}
--
1.5.6.5
1
0
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch coddy has been created
at f78df6e36baadcfbce50bb22a0cf84fa86ed750f (commit)
- Log -----------------------------------------------------------------
f78df6e disabled tesseract, debug functions added
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0

02 May '11
---
scribo/scribo/core/line_set.hh | 1 +
scribo/scribo/debug/bboxes_image.hh | 41 ++++++++++++++++++++
.../toolchain/internal/text_in_doc_functor.hh | 4 +-
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/scribo/scribo/core/line_set.hh b/scribo/scribo/core/line_set.hh
index bfa9240..92bdd7d 100644
--- a/scribo/scribo/core/line_set.hh
+++ b/scribo/scribo/core/line_set.hh
@@ -166,6 +166,7 @@ namespace scribo
void update_line_data_(const mln::util::array<line_info<L> >& line_data);
+ void merge(const line_set<L>& lines);
private:
/// Duplicate the underlying image and create a new line_set.
diff --git a/scribo/scribo/debug/bboxes_image.hh b/scribo/scribo/debug/bboxes_image.hh
index ca3d646..0ad8570 100644
--- a/scribo/scribo/debug/bboxes_image.hh
+++ b/scribo/scribo/debug/bboxes_image.hh
@@ -82,6 +82,15 @@ namespace scribo
const component_set<L>& comps,
const value::rgb8& value);
+ // Draw text lines and their components
+ template <typename I, typename L>
+ inline
+ mln_ch_value(I, value::rgb8)
+ bboxes_image_textline(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& value,
+ const value::rgb8& comp_value);
+
# ifndef MLN_INCLUDE_ONLY
template <typename I>
@@ -155,6 +164,38 @@ namespace scribo
return output;
}
+ template <typename I, typename L>
+ inline
+ mln_ch_value(I, value::rgb8)
+ bboxes_image_textline(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& value,
+ const value::rgb8& comp_value)
+ {
+ trace::entering("scribo::debug::bboxes_image_textline");
+ mln_precondition(exact(input).is_valid());
+
+ mln_ch_value(I, value::rgb8)
+ output = data::convert(value::rgb8(), input);
+
+ for_all_lines(l, lines)
+ {
+ if (! lines(l).is_hidden()
+ && text::internal::looks_like_a_text_line(lines(l)))
+ {
+ mln::draw::box(output, lines(l).bbox(), value);
+ const mln::util::array<component_id_t>& comps_id =
+ lines(l).component_ids();
+ const component_set<L>& comps = lines.components();
+ for (unsigned i = 0; i < comps_id.nelements(); i++)
+ mln::draw::box(output, comps(comps_id[i]).bbox(),
+ comp_value);
+ }
+ }
+
+ trace::exiting("scribo::debug::bboxes_image_textline");
+ return output;
+ }
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/toolchain/internal/text_in_doc_functor.hh b/scribo/scribo/toolchain/internal/text_in_doc_functor.hh
index 62074f0..41bb132 100644
--- a/scribo/scribo/toolchain/internal/text_in_doc_functor.hh
+++ b/scribo/scribo/toolchain/internal/text_in_doc_functor.hh
@@ -47,7 +47,7 @@
# include <scribo/preprocessing/denoise_fg.hh>
-# include <scribo/text/recognition.hh>
+//# include <scribo/text/recognition.hh>
# include <scribo/text/merging.hh>
# include <scribo/make/debug_filename.hh>
@@ -383,7 +383,7 @@ namespace scribo
on_new_progress_label("Recognizing text");
- scribo::text::recognition(lines, ocr_language.c_str());
+ // scribo::text::recognition(lines, ocr_language.c_str());
on_progress();
--
1.5.6.5
1
0

28 Apr '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch llvm-support has been updated
via 887dfe212525fea8f438c84b490ebd7ae1287119 (commit)
from d85cb3e1f44dbcb5b8d790d691f00aa360f08398 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
887dfe2 Fix more warnings with Clang 3.0
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 102 ++++++++++++++++++++
milena/mln/accu/internal/couple.hh | 7 +-
milena/mln/border/duplicate.hh | 4 +-
milena/mln/border/mirror.hh | 4 +-
milena/mln/canvas/browsing/backdiagonal2d.hh | 6 +-
milena/mln/canvas/browsing/breadth_first_search.hh | 5 +-
milena/mln/canvas/browsing/depth_first_search.hh | 5 +-
milena/mln/canvas/browsing/diagonal2d.hh | 6 +-
milena/mln/canvas/browsing/directional.hh | 7 +-
milena/mln/canvas/browsing/fwd.hh | 5 +-
milena/mln/canvas/browsing/hyper_directional.hh | 5 +-
.../canvas/browsing/internal/graph_first_search.hh | 1 +
milena/mln/canvas/browsing/snake_fwd.hh | 6 +-
milena/mln/canvas/browsing/snake_generic.hh | 6 +-
milena/mln/canvas/browsing/snake_vert.hh | 5 +-
milena/mln/convert/from_to.hxx | 2 +-
milena/mln/convert/impl/from_float_to_value.hh | 5 +-
milena/mln/convert/to_qimage.hh | 2 +
milena/mln/core/concept/box.hh | 6 +-
milena/mln/core/dpoints_pixter.hh | 25 +++---
milena/mln/core/faces_psite.hh | 5 +-
milena/mln/core/image/ch_piter.hh | 5 +-
milena/mln/core/image/complex_window_piter.hh | 4 +-
milena/mln/core/image/dmorph/extended.hh | 5 +-
milena/mln/core/image/dmorph/extension_fun.hh | 5 +-
milena/mln/core/image/dmorph/extension_ima.hh | 6 +-
milena/mln/core/image/dmorph/extension_val.hh | 5 +-
milena/mln/core/image/dmorph/hexa.hh | 5 +-
milena/mln/core/image/dmorph/sub_image_if.hh | 7 +-
milena/mln/core/image/dmorph/transformed_image.hh | 7 +-
milena/mln/core/image/flat_image.hh | 5 +-
milena/mln/core/image/graph_elt_mixed_window.hh | 7 +-
milena/mln/core/image/graph_elt_window.hh | 4 +-
milena/mln/core/image/graph_elt_window_if.hh | 7 +-
milena/mln/core/image/graph_window_if_piter.hh | 4 +-
milena/mln/core/image/graph_window_piter.hh | 6 +-
milena/mln/core/image/image2d.hh | 5 +-
milena/mln/core/image/imorph/labeled_image.hh | 5 +-
milena/mln/core/image/imorph/plain.hh | 5 +-
milena/mln/core/image/imorph/safe.hh | 5 +-
milena/mln/core/image/vmorph/cast_image.hh | 5 +-
milena/mln/core/image/vmorph/fun_image.hh | 4 +-
milena/mln/core/image/vmorph/thru_image.hh | 8 +-
milena/mln/core/image/vmorph/thrubin_image.hh | 4 +-
milena/mln/core/image/vmorph/violent_cast_image.hh | 5 +-
.../mln/core/internal/is_masked_impl_selector.hh | 7 +-
milena/mln/core/internal/pixel_impl.hh | 4 +-
milena/mln/core/routine/init.hxx | 7 +-
milena/mln/core/site_set/attic/p_faces_piter.hh | 4 +-
milena/mln/core/site_set/p_faces.hh | 5 +-
milena/mln/core/site_set/p_if.hh | 6 +-
milena/mln/core/site_set/p_transformed.hh | 5 +-
milena/mln/data/fill.hh | 20 ++--
milena/mln/debug/println.spe.hh | 5 +-
milena/mln/extension/fill.hh | 2 +
milena/mln/fun/spe/binary.hh | 1 +
milena/mln/fun/spe/unary.hh | 4 +-
milena/mln/fun/x2x/rotation.hh | 7 +-
milena/mln/geom/chamfer.hh | 5 +-
milena/mln/io/fld/max_components.hh | 3 +-
milena/mln/io/pbm/save.hh | 7 +-
milena/mln/io/pgm/save.hh | 7 +-
milena/mln/labeling/flat_zones.hh | 10 +-
milena/mln/labeling/value.hh | 4 +-
milena/mln/morpho/attribute/height.hh | 5 +-
milena/mln/morpho/attribute/sharpness.hh | 5 +-
milena/mln/morpho/attribute/volume.hh | 5 +-
.../reconstruction/by_dilation/union_find.hh | 18 ++--
milena/mln/morpho/tree/compute_attribute_image.hh | 9 +-
milena/mln/morpho/tree/data.hh | 4 +-
milena/mln/opt/element.hh | 1 +
milena/mln/registration/get_rot.hh | 9 ++-
milena/mln/subsampling/antialiased.hh | 10 ++
milena/mln/subsampling/gaussian_subsampling.hh | 5 +-
milena/mln/topo/center_only_iter.hh | 7 +-
milena/mln/topo/face.hh | 5 +-
milena/mln/topo/face_data.hh | 13 ++-
milena/mln/topo/skeleton/is_simple_point.hh | 4 +
milena/mln/trait/image_from_grid.hh | 5 +-
milena/mln/trait/images.hh | 11 +-
milena/mln/transform/influence_zone_geodesic.hh | 7 +-
milena/mln/util/object_id.hh | 4 +-
milena/mln/value/float01.hh | 5 +-
milena/mln/value/float01_f.hh | 5 +-
milena/mln/value/graylevel.hh | 2 +-
milena/mln/value/graylevel_f.hh | 5 +-
milena/mln/value/internal/gray_.hh | 17 +++-
milena/mln/value/internal/gray_f.hh | 14 ++-
milena/mln/value/lut_vec.hh | 4 +-
milena/mln/world/binary_2d/enlarge.hh | 6 +-
90 files changed, 442 insertions(+), 203 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0

28 Apr '11
* mln/border/duplicate.hh,
* mln/border/mirror.hh,
* mln/canvas/browsing/internal/graph_first_search.hh,
* mln/convert/impl/from_float_to_value.hh,
* mln/convert/to_qimage.hh,
* mln/core/image/complex_window_piter.hh,
* mln/extension/fill.hh,
* mln/fun/spe/binary.hh,
* mln/fun/spe/unary.hh,
* mln/fun/x2x/rotation.hh,
* mln/io/fld/max_components.hh,
* mln/labeling/flat_zones.hh,
* mln/labeling/value.hh,
* mln/morpho/reconstruction/by_dilation/union_find.hh,
* mln/opt/element.hh,
* mln/registration/get_rot.hh,
* mln/subsampling/antialiased.hh,
* mln/subsampling/gaussian_subsampling.hh,
* mln/topo/skeleton/is_simple_point.hh,
* mln/transform/influence_zone_geodesic.hh,
* mln/util/object_id.hh,
* mln/value/lut_vec.hh,
* mln/world/binary_2d/enlarge.hh: Avoid unused variable warnings.
* mln/accu/internal/couple.hh,
* mln/convert/from_to.hxx,
* mln/core/faces_psite.hh,
* mln/core/image/ch_piter.hh,
* mln/core/image/dmorph/extended.hh,
* mln/core/image/dmorph/extension_fun.hh,
* mln/core/image/dmorph/extension_ima.hh,
* mln/core/image/dmorph/extension_val.hh,
* mln/core/image/dmorph/hexa.hh,
* mln/core/image/dmorph/sub_image_if.hh,
* mln/core/image/dmorph/transformed_image.hh,
* mln/core/image/flat_image.hh,
* mln/core/image/graph_elt_mixed_window.hh,
* mln/core/image/graph_elt_window.hh,
* mln/core/image/graph_elt_window_if.hh,
* mln/core/image/graph_window_piter.hh,
* mln/core/image/image2d.hh,
* mln/core/image/imorph/labeled_image.hh,
* mln/core/image/imorph/plain.hh,
* mln/core/image/imorph/safe.hh,
* mln/core/image/vmorph/cast_image.hh,
* mln/core/image/vmorph/fun_image.hh,
* mln/core/image/vmorph/thru_image.hh,
* mln/core/image/vmorph/thrubin_image.hh,
* mln/core/image/vmorph/violent_cast_image.hh,
* mln/core/internal/is_masked_impl_selector.hh,
* mln/core/internal/pixel_impl.hh,
* mln/core/routine/init.hxx,
* mln/core/site_set/attic/p_faces_piter.hh,
* mln/core/site_set/p_faces.hh,
* mln/core/site_set/p_if.hh,
* mln/core/site_set/p_transformed.hh,
* mln/debug/println.spe.hh,
* mln/io/pbm/save.hh,
* mln/io/pgm/save.hh,
* mln/morpho/attribute/height.hh,
* mln/morpho/attribute/sharpness.hh,
* mln/morpho/attribute/volume.hh,
* mln/morpho/tree/data.hh,
* mln/topo/center_only_iter.hh,
* mln/topo/face.hh,
* mln/topo/face_data.hh,
* mln/trait/image_from_grid.hh,
* mln/trait/images.hh,
* mln/value/float01.hh,
* mln/value/float01_f.hh,
* mln/value/graylevel.hh,
* mln/value/graylevel_f.hh,
* mln/value/internal/gray_.hh,
* mln/value/internal/gray_f.hh: Make forward declarations
consistent with declarations.
* mln/canvas/browsing/backdiagonal2d.hh,
* mln/canvas/browsing/breadth_first_search.hh,
* mln/canvas/browsing/depth_first_search.hh,
* mln/canvas/browsing/diagonal2d.hh,
* mln/canvas/browsing/directional.hh,
* mln/canvas/browsing/fwd.hh,
* mln/canvas/browsing/hyper_directional.hh,
* mln/canvas/browsing/snake_fwd.hh,
* mln/canvas/browsing/snake_generic.hh,
* mln/canvas/browsing/snake_vert.hh: Explicitly call default
constructor.
* mln/core/concept/box.hh,
* mln/core/dpoints_pixter.hh,
* mln/core/image/graph_window_if_piter.hh: Add explicit 'this'.
* mln/data/fill.hh: Make sure declarations are made before use.
* mln/geom/chamfer.hh,
* mln/morpho/tree/compute_attribute_image.hh: Do not set default
argument values in declaration.
---
milena/ChangeLog | 102 ++++++++++++++++++++
milena/mln/accu/internal/couple.hh | 7 +-
milena/mln/border/duplicate.hh | 4 +-
milena/mln/border/mirror.hh | 4 +-
milena/mln/canvas/browsing/backdiagonal2d.hh | 6 +-
milena/mln/canvas/browsing/breadth_first_search.hh | 5 +-
milena/mln/canvas/browsing/depth_first_search.hh | 5 +-
milena/mln/canvas/browsing/diagonal2d.hh | 6 +-
milena/mln/canvas/browsing/directional.hh | 7 +-
milena/mln/canvas/browsing/fwd.hh | 5 +-
milena/mln/canvas/browsing/hyper_directional.hh | 5 +-
.../canvas/browsing/internal/graph_first_search.hh | 1 +
milena/mln/canvas/browsing/snake_fwd.hh | 6 +-
milena/mln/canvas/browsing/snake_generic.hh | 6 +-
milena/mln/canvas/browsing/snake_vert.hh | 5 +-
milena/mln/convert/from_to.hxx | 2 +-
milena/mln/convert/impl/from_float_to_value.hh | 5 +-
milena/mln/convert/to_qimage.hh | 2 +
milena/mln/core/concept/box.hh | 6 +-
milena/mln/core/dpoints_pixter.hh | 25 +++---
milena/mln/core/faces_psite.hh | 5 +-
milena/mln/core/image/ch_piter.hh | 5 +-
milena/mln/core/image/complex_window_piter.hh | 4 +-
milena/mln/core/image/dmorph/extended.hh | 5 +-
milena/mln/core/image/dmorph/extension_fun.hh | 5 +-
milena/mln/core/image/dmorph/extension_ima.hh | 6 +-
milena/mln/core/image/dmorph/extension_val.hh | 5 +-
milena/mln/core/image/dmorph/hexa.hh | 5 +-
milena/mln/core/image/dmorph/sub_image_if.hh | 7 +-
milena/mln/core/image/dmorph/transformed_image.hh | 7 +-
milena/mln/core/image/flat_image.hh | 5 +-
milena/mln/core/image/graph_elt_mixed_window.hh | 7 +-
milena/mln/core/image/graph_elt_window.hh | 4 +-
milena/mln/core/image/graph_elt_window_if.hh | 7 +-
milena/mln/core/image/graph_window_if_piter.hh | 4 +-
milena/mln/core/image/graph_window_piter.hh | 6 +-
milena/mln/core/image/image2d.hh | 5 +-
milena/mln/core/image/imorph/labeled_image.hh | 5 +-
milena/mln/core/image/imorph/plain.hh | 5 +-
milena/mln/core/image/imorph/safe.hh | 5 +-
milena/mln/core/image/vmorph/cast_image.hh | 5 +-
milena/mln/core/image/vmorph/fun_image.hh | 4 +-
milena/mln/core/image/vmorph/thru_image.hh | 8 +-
milena/mln/core/image/vmorph/thrubin_image.hh | 4 +-
milena/mln/core/image/vmorph/violent_cast_image.hh | 5 +-
.../mln/core/internal/is_masked_impl_selector.hh | 7 +-
milena/mln/core/internal/pixel_impl.hh | 4 +-
milena/mln/core/routine/init.hxx | 7 +-
milena/mln/core/site_set/attic/p_faces_piter.hh | 4 +-
milena/mln/core/site_set/p_faces.hh | 5 +-
milena/mln/core/site_set/p_if.hh | 6 +-
milena/mln/core/site_set/p_transformed.hh | 5 +-
milena/mln/data/fill.hh | 20 ++--
milena/mln/debug/println.spe.hh | 5 +-
milena/mln/extension/fill.hh | 2 +
milena/mln/fun/spe/binary.hh | 1 +
milena/mln/fun/spe/unary.hh | 4 +-
milena/mln/fun/x2x/rotation.hh | 7 +-
milena/mln/geom/chamfer.hh | 5 +-
milena/mln/io/fld/max_components.hh | 3 +-
milena/mln/io/pbm/save.hh | 7 +-
milena/mln/io/pgm/save.hh | 7 +-
milena/mln/labeling/flat_zones.hh | 10 +-
milena/mln/labeling/value.hh | 4 +-
milena/mln/morpho/attribute/height.hh | 5 +-
milena/mln/morpho/attribute/sharpness.hh | 5 +-
milena/mln/morpho/attribute/volume.hh | 5 +-
.../reconstruction/by_dilation/union_find.hh | 18 ++--
milena/mln/morpho/tree/compute_attribute_image.hh | 9 +-
milena/mln/morpho/tree/data.hh | 4 +-
milena/mln/opt/element.hh | 1 +
milena/mln/registration/get_rot.hh | 9 ++-
milena/mln/subsampling/antialiased.hh | 10 ++
milena/mln/subsampling/gaussian_subsampling.hh | 5 +-
milena/mln/topo/center_only_iter.hh | 7 +-
milena/mln/topo/face.hh | 5 +-
milena/mln/topo/face_data.hh | 13 ++-
milena/mln/topo/skeleton/is_simple_point.hh | 4 +
milena/mln/trait/image_from_grid.hh | 5 +-
milena/mln/trait/images.hh | 11 +-
milena/mln/transform/influence_zone_geodesic.hh | 7 +-
milena/mln/util/object_id.hh | 4 +-
milena/mln/value/float01.hh | 5 +-
milena/mln/value/float01_f.hh | 5 +-
milena/mln/value/graylevel.hh | 2 +-
milena/mln/value/graylevel_f.hh | 5 +-
milena/mln/value/internal/gray_.hh | 17 +++-
milena/mln/value/internal/gray_f.hh | 14 ++-
milena/mln/value/lut_vec.hh | 4 +-
milena/mln/world/binary_2d/enlarge.hh | 6 +-
90 files changed, 442 insertions(+), 203 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 8226e1b..0791106 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,105 @@
+2011-04-28 Guillaume Lazzara <lazzara(a)fidji.lrde.epita.fr>
+
+ Fix more warnings with Clang 3.0
+
+ * mln/border/duplicate.hh,
+ * mln/border/mirror.hh,
+ * mln/canvas/browsing/internal/graph_first_search.hh,
+ * mln/convert/impl/from_float_to_value.hh,
+ * mln/convert/to_qimage.hh,
+ * mln/core/image/complex_window_piter.hh,
+ * mln/extension/fill.hh,
+ * mln/fun/spe/binary.hh,
+ * mln/fun/spe/unary.hh,
+ * mln/fun/x2x/rotation.hh,
+ * mln/io/fld/max_components.hh,
+ * mln/labeling/flat_zones.hh,
+ * mln/labeling/value.hh,
+ * mln/morpho/reconstruction/by_dilation/union_find.hh,
+ * mln/opt/element.hh,
+ * mln/registration/get_rot.hh,
+ * mln/subsampling/antialiased.hh,
+ * mln/subsampling/gaussian_subsampling.hh,
+ * mln/topo/skeleton/is_simple_point.hh,
+ * mln/transform/influence_zone_geodesic.hh,
+ * mln/util/object_id.hh,
+ * mln/value/lut_vec.hh,
+ * mln/world/binary_2d/enlarge.hh: Avoid unused variable warnings.
+
+ * mln/accu/internal/couple.hh,
+ * mln/convert/from_to.hxx,
+ * mln/core/faces_psite.hh,
+ * mln/core/image/ch_piter.hh,
+ * mln/core/image/dmorph/extended.hh,
+ * mln/core/image/dmorph/extension_fun.hh,
+ * mln/core/image/dmorph/extension_ima.hh,
+ * mln/core/image/dmorph/extension_val.hh,
+ * mln/core/image/dmorph/hexa.hh,
+ * mln/core/image/dmorph/sub_image_if.hh,
+ * mln/core/image/dmorph/transformed_image.hh,
+ * mln/core/image/flat_image.hh,
+ * mln/core/image/graph_elt_mixed_window.hh,
+ * mln/core/image/graph_elt_window.hh,
+ * mln/core/image/graph_elt_window_if.hh,
+ * mln/core/image/graph_window_piter.hh,
+ * mln/core/image/image2d.hh,
+ * mln/core/image/imorph/labeled_image.hh,
+ * mln/core/image/imorph/plain.hh,
+ * mln/core/image/imorph/safe.hh,
+ * mln/core/image/vmorph/cast_image.hh,
+ * mln/core/image/vmorph/fun_image.hh,
+ * mln/core/image/vmorph/thru_image.hh,
+ * mln/core/image/vmorph/thrubin_image.hh,
+ * mln/core/image/vmorph/violent_cast_image.hh,
+ * mln/core/internal/is_masked_impl_selector.hh,
+ * mln/core/internal/pixel_impl.hh,
+ * mln/core/routine/init.hxx,
+ * mln/core/site_set/attic/p_faces_piter.hh,
+ * mln/core/site_set/p_faces.hh,
+ * mln/core/site_set/p_if.hh,
+ * mln/core/site_set/p_transformed.hh,
+ * mln/debug/println.spe.hh,
+ * mln/io/pbm/save.hh,
+ * mln/io/pgm/save.hh,
+ * mln/morpho/attribute/height.hh,
+ * mln/morpho/attribute/sharpness.hh,
+ * mln/morpho/attribute/volume.hh,
+ * mln/morpho/tree/data.hh,
+ * mln/topo/center_only_iter.hh,
+ * mln/topo/face.hh,
+ * mln/topo/face_data.hh,
+ * mln/trait/image_from_grid.hh,
+ * mln/trait/images.hh,
+ * mln/value/float01.hh,
+ * mln/value/float01_f.hh,
+ * mln/value/graylevel.hh,
+ * mln/value/graylevel_f.hh,
+ * mln/value/internal/gray_.hh,
+ * mln/value/internal/gray_f.hh: Make forward declarations
+ consistent with declarations.
+
+ * mln/canvas/browsing/backdiagonal2d.hh,
+ * mln/canvas/browsing/breadth_first_search.hh,
+ * mln/canvas/browsing/depth_first_search.hh,
+ * mln/canvas/browsing/diagonal2d.hh,
+ * mln/canvas/browsing/directional.hh,
+ * mln/canvas/browsing/fwd.hh,
+ * mln/canvas/browsing/hyper_directional.hh,
+ * mln/canvas/browsing/snake_fwd.hh,
+ * mln/canvas/browsing/snake_generic.hh,
+ * mln/canvas/browsing/snake_vert.hh: Explicitly call default
+ constructor.
+
+ * mln/core/concept/box.hh,
+ * mln/core/dpoints_pixter.hh,
+ * mln/core/image/graph_window_if_piter.hh: Add explicit 'this'.
+
+ * mln/data/fill.hh: Make sure declarations are made before use.
+
+ * mln/geom/chamfer.hh,
+ * mln/morpho/tree/compute_attribute_image.hh: Do not set default
+ argument values in declaration.
+
2011-04-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Fix warnings with clang 1.1
diff --git a/milena/mln/accu/internal/couple.hh b/milena/mln/accu/internal/couple.hh
index 43550fd..55c6cc4 100644
--- a/milena/mln/accu/internal/couple.hh
+++ b/milena/mln/accu/internal/couple.hh
@@ -53,10 +53,11 @@ namespace mln
///
/// \todo Check that, when T is not provided, A1 and A2 have the same value.
template <typename A1, typename A2, typename R, typename E>
- struct couple
- : base<R,E>,
- mlc_equal(mln_argument(A1), mln_argument(A2))::check_t
+ class couple
+ : public base<R,E>,
+ public mlc_equal(mln_argument(A1), mln_argument(A2))::check_t
{
+ public:
typedef mln_argument(A1) argument;
/// Manipulators.
diff --git a/milena/mln/border/duplicate.hh b/milena/mln/border/duplicate.hh
index 4d836cc..059dc77 100644
--- a/milena/mln/border/duplicate.hh
+++ b/milena/mln/border/duplicate.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -227,6 +228,7 @@ namespace mln
void duplicate_dispatch_on(trait::image::speed::any,
const Image<I>& ima)
{
+ (void) ima;
// No-op.
}
diff --git a/milena/mln/border/mirror.hh b/milena/mln/border/mirror.hh
index 183c0a2..8a82bb7 100644
--- a/milena/mln/border/mirror.hh
+++ b/milena/mln/border/mirror.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -193,6 +194,7 @@ namespace mln
inline
void mirror_(const box3d&, const I& ima)
{
+ (void) ima;
mln::internal::fixme();
}
diff --git a/milena/mln/canvas/browsing/backdiagonal2d.hh b/milena/mln/canvas/browsing/backdiagonal2d.hh
index a490ffe..cc8589b 100644
--- a/milena/mln/canvas/browsing/backdiagonal2d.hh
+++ b/milena/mln/canvas/browsing/backdiagonal2d.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -91,7 +92,8 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const backdiagonal2d_t backdiagonal2d;
+ // Explicitly call the default constructor (LLVM support).
+ const backdiagonal2d_t backdiagonal2d = backdiagonal2d_t();
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/breadth_first_search.hh b/milena/mln/canvas/browsing/breadth_first_search.hh
index 6f5327e..c021a86 100644
--- a/milena/mln/canvas/browsing/breadth_first_search.hh
+++ b/milena/mln/canvas/browsing/breadth_first_search.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -86,7 +87,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const breadth_first_search_t breadth_first_search;
+ const breadth_first_search_t breadth_first_search = breadth_first_search_t();
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/canvas/browsing/depth_first_search.hh b/milena/mln/canvas/browsing/depth_first_search.hh
index 4b61d4d..6467e9e 100644
--- a/milena/mln/canvas/browsing/depth_first_search.hh
+++ b/milena/mln/canvas/browsing/depth_first_search.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -86,7 +87,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const depth_first_search_t depth_first_search;
+ const depth_first_search_t depth_first_search = depth_first_search_t();
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/canvas/browsing/diagonal2d.hh b/milena/mln/canvas/browsing/diagonal2d.hh
index 2ba66c7..4953b4b 100644
--- a/milena/mln/canvas/browsing/diagonal2d.hh
+++ b/milena/mln/canvas/browsing/diagonal2d.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -88,7 +89,8 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const diagonal2d_t diagonal2d;
+ // Explicitly call the default constructor (LLVM support).
+ const diagonal2d_t diagonal2d = diagonal2d_t();
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/directional.hh b/milena/mln/canvas/browsing/directional.hh
index 85ae7f6..871321a 100644
--- a/milena/mln/canvas/browsing/directional.hh
+++ b/milena/mln/canvas/browsing/directional.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -96,7 +97,9 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const directional_t directional;
+ // Explicitly call the default constructor (LLVM support).
+ const directional_t directional = directional_t();
+
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/fwd.hh b/milena/mln/canvas/browsing/fwd.hh
index f89e75b..1d90e73 100644
--- a/milena/mln/canvas/browsing/fwd.hh
+++ b/milena/mln/canvas/browsing/fwd.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -79,7 +80,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const fwd_t fwd;
+ const fwd_t fwd = fwd_t();
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/hyper_directional.hh b/milena/mln/canvas/browsing/hyper_directional.hh
index 6ad9a47..7786799 100644
--- a/milena/mln/canvas/browsing/hyper_directional.hh
+++ b/milena/mln/canvas/browsing/hyper_directional.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -81,7 +82,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const hyper_directional_t hyper_directional;
+ const hyper_directional_t hyper_directional = hyper_directional_t();
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/internal/graph_first_search.hh b/milena/mln/canvas/browsing/internal/graph_first_search.hh
index 1bc64c6..8d74fa4 100644
--- a/milena/mln/canvas/browsing/internal/graph_first_search.hh
+++ b/milena/mln/canvas/browsing/internal/graph_first_search.hh
@@ -128,6 +128,7 @@ namespace mln
util::vertex_id_t
next(const S& stack)
{
+ (void) stack;
mln_assertion(0);
/// Not defined yet!
// mlc_abort(S)::check();
diff --git a/milena/mln/canvas/browsing/snake_fwd.hh b/milena/mln/canvas/browsing/snake_fwd.hh
index e67b594..ab7a23e 100644
--- a/milena/mln/canvas/browsing/snake_fwd.hh
+++ b/milena/mln/canvas/browsing/snake_fwd.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -90,7 +91,8 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const snake_fwd_t snake_fwd;
+ // Explicitly call the default constructor (LLVM support).
+ const snake_fwd_t snake_fwd = snake_fwd_t();
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/snake_generic.hh b/milena/mln/canvas/browsing/snake_generic.hh
index 885431d..8718f0e 100644
--- a/milena/mln/canvas/browsing/snake_generic.hh
+++ b/milena/mln/canvas/browsing/snake_generic.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -84,7 +85,8 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const snake_generic_t snake_generic;
+ // Explicitly call the default constructor (LLVM support).
+ const snake_generic_t snake_generic = snake_generic_t();
template <typename F>
inline
diff --git a/milena/mln/canvas/browsing/snake_vert.hh b/milena/mln/canvas/browsing/snake_vert.hh
index 9e46c9c..416786c 100644
--- a/milena/mln/canvas/browsing/snake_vert.hh
+++ b/milena/mln/canvas/browsing/snake_vert.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -90,7 +91,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- const snake_vert_t snake_vert;
+ const snake_vert_t snake_vert = snake_vert_t();
template <typename F>
inline
diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx
index 95c35a8..6780a94 100644
--- a/milena/mln/convert/from_to.hxx
+++ b/milena/mln/convert/from_to.hxx
@@ -63,7 +63,7 @@ namespace mln
template <typename D> class neighb;
template <typename D> class window;
- template <typename D, typename W> class w_window;
+ template <typename D, typename W> struct w_window;
template <typename T> struct image1d;
diff --git a/milena/mln/convert/impl/from_float_to_value.hh b/milena/mln/convert/impl/from_float_to_value.hh
index f516419..66c7ecb 100644
--- a/milena/mln/convert/impl/from_float_to_value.hh
+++ b/milena/mln/convert/impl/from_float_to_value.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -89,6 +90,8 @@ namespace mln
from_float_to_value(const float& from,
Value<V>& to)
{
+ (void) from;
+ (void) to;
mlc_abort(V)::check();
}
diff --git a/milena/mln/convert/to_qimage.hh b/milena/mln/convert/to_qimage.hh
index b5b22ae..d6b5278 100644
--- a/milena/mln/convert/to_qimage.hh
+++ b/milena/mln/convert/to_qimage.hh
@@ -255,6 +255,8 @@ namespace mln
inline
QImage to_qimage_dispatch(const Image<I>& ima, V&)
{
+ (void) ima;
+
// Not supported yet!
mlc_abort(I)::check();
return QImage();
diff --git a/milena/mln/core/concept/box.hh b/milena/mln/core/concept/box.hh
index 15696b4..0c3b481 100644
--- a/milena/mln/core/concept/box.hh
+++ b/milena/mln/core/concept/box.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -132,7 +133,8 @@ namespace mln
{
return
exact(this)->is_valid()
- ? 1 + exact(this)->pmax()[i] - exact(this)->pmin()[i]
+ ? static_cast<unsigned>(1 + exact(this)->pmax()[i]
+ - exact(this)->pmin()[i])
: 0u;
}
diff --git a/milena/mln/core/dpoints_pixter.hh b/milena/mln/core/dpoints_pixter.hh
index 8020fcc..eb19c2b 100644
--- a/milena/mln/core/dpoints_pixter.hh
+++ b/milena/mln/core/dpoints_pixter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -27,7 +28,7 @@
# define MLN_CORE_DPOINTS_PIXTER_HH
/// \file
-///
+///
/// \brief Definition of forward and backward mln::dpoint-based
/// iterators for pixels iterations.
///
@@ -51,7 +52,7 @@ namespace mln
/// \brief A generic forward iterator on the pixels of a
/// dpoint-based window or neighborhood.
- ///
+ ///
/// Parameter \c I is the image type.
template <typename I>
class dpoints_fwd_pixter
@@ -62,7 +63,7 @@ namespace mln
public:
/// \brief Constructor (using an image).
- ///
+ ///
/// \param[in] image The image to iterate over.
/// \param[in] dps An object (neighborhood or window) that can
/// provide a set of delta-points.
@@ -74,7 +75,7 @@ namespace mln
const Pref& p_ref);
/// \brief Constructor (using a generalized pixel).
- ///
+ ///
/// \param[in] pxl_ref Center (generalized) pixel to iterate around.
/// \param[in] dps An object (neighborhood or window) that can
/// provide a set of delta-points.
@@ -134,7 +135,7 @@ namespace mln
/// \brief A generic backward iterator on the pixels of a
/// dpoint-based window or neighborhood.
- ///
+ ///
/// Parameter \c I is the image type.
template <typename I>
class dpoints_bkd_pixter
@@ -145,7 +146,7 @@ namespace mln
public:
/// \brief Constructor (using an image).
- ///
+ ///
/// \param[in] image The image to iterate over.
/// \param[in] dps An object (neighborhood or window) that can
/// provide a set of delta-points.
@@ -157,7 +158,7 @@ namespace mln
const Pref& p_ref);
/// \brief Constructor (using a generalized pixel).
- ///
+ ///
/// \param[in] pxl_ref Center (generalized) pixel to iterate around.
/// \param[in] dps An object (neighborhood or window) that can
/// provide a set of delta-points.
@@ -257,7 +258,7 @@ namespace mln
{
mln_invariant(value_ref_ != 0 || p_ref_ != 0);
if (p_ref_)
- return image_(*p_ref_);
+ return this->image_(*p_ref_);
else
return **value_ref_;
}
@@ -286,7 +287,7 @@ namespace mln
if (is_valid())
{
if (p_ref_)
- this->value_ptr_ = & image_(*p_ref_) + *i_;
+ this->value_ptr_ = & this->image_(*p_ref_) + *i_;
else
this->value_ptr_ = * value_ref_ + *i_;
}
@@ -368,7 +369,7 @@ namespace mln
{
mln_invariant(value_ref_ != 0 || p_ref_ != 0);
if (p_ref_)
- return image_(*p_ref_);
+ return this->image_(*p_ref_);
else
return **value_ref_;
}
@@ -397,7 +398,7 @@ namespace mln
if (is_valid())
{
if (p_ref_)
- this->value_ptr_ = & image_(*p_ref_) + *i_;
+ this->value_ptr_ = & this->image_(*p_ref_) + *i_;
else
this->value_ptr_ = * value_ref_ + *i_;
}
diff --git a/milena/mln/core/faces_psite.hh b/milena/mln/core/faces_psite.hh
index d8d7573..9f72533 100644
--- a/milena/mln/core/faces_psite.hh
+++ b/milena/mln/core/faces_psite.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,7 +45,7 @@
namespace mln
{
// Forward declaration.
- template <unsigned N, unsigned D, typename P> class p_faces;
+ template <unsigned N, unsigned D, typename P> struct p_faces;
/// \brief Point site associated to a mln::p_faces.
diff --git a/milena/mln/core/image/ch_piter.hh b/milena/mln/core/image/ch_piter.hh
index cacb5c7..b7c53f8 100644
--- a/milena/mln/core/image/ch_piter.hh
+++ b/milena/mln/core/image/ch_piter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -40,7 +41,7 @@ namespace mln
{
// Forward declaration.
- template <typename I, typename Fwd> struct ch_piter_image;
+ template <typename I, typename Fwd> class ch_piter_image;
namespace internal
diff --git a/milena/mln/core/image/complex_window_piter.hh b/milena/mln/core/image/complex_window_piter.hh
index 8a54adb..06b66e7 100644
--- a/milena/mln/core/image/complex_window_piter.hh
+++ b/milena/mln/core/image/complex_window_piter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -365,6 +366,7 @@ namespace mln
void
complex_window_bkd_piter<I, G, W>::center_at_(const Pref& c)
{
+ (void) c;
iter_.center_at(this->center().face());
}
diff --git a/milena/mln/core/image/dmorph/extended.hh b/milena/mln/core/image/dmorph/extended.hh
index 588f95a..791ab1d 100644
--- a/milena/mln/core/image/dmorph/extended.hh
+++ b/milena/mln/core/image/dmorph/extended.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -43,7 +44,7 @@ namespace mln
// Forward declaration.
- template <typename I> class extended;
+ template <typename I> struct extended;
namespace internal
diff --git a/milena/mln/core/image/dmorph/extension_fun.hh b/milena/mln/core/image/dmorph/extension_fun.hh
index a8731c2..887fe02 100644
--- a/milena/mln/core/image/dmorph/extension_fun.hh
+++ b/milena/mln/core/image/dmorph/extension_fun.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -42,7 +43,7 @@ namespace mln
{
// Forward declaration.
- template <typename I, typename F> struct extension_fun;
+ template <typename I, typename F> class extension_fun;
namespace internal
diff --git a/milena/mln/core/image/dmorph/extension_ima.hh b/milena/mln/core/image/dmorph/extension_ima.hh
index a0bc9ca..63ea0ed 100644
--- a/milena/mln/core/image/dmorph/extension_ima.hh
+++ b/milena/mln/core/image/dmorph/extension_ima.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -40,7 +40,7 @@ namespace mln
{
// Forward declaration.
- template <typename I, typename J> struct extension_ima;
+ template <typename I, typename J> class extension_ima;
namespace internal
diff --git a/milena/mln/core/image/dmorph/extension_val.hh b/milena/mln/core/image/dmorph/extension_val.hh
index c104eba..c0ccbe0 100644
--- a/milena/mln/core/image/dmorph/extension_val.hh
+++ b/milena/mln/core/image/dmorph/extension_val.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@ namespace mln
{
// Forward declaration.
- template <typename I> struct extension_val;
+ template <typename I> class extension_val;
namespace internal
diff --git a/milena/mln/core/image/dmorph/hexa.hh b/milena/mln/core/image/dmorph/hexa.hh
index bfa3739..314cba1 100644
--- a/milena/mln/core/image/dmorph/hexa.hh
+++ b/milena/mln/core/image/dmorph/hexa.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -42,7 +43,7 @@ namespace mln
{
// Forward declaration.
- template <typename I> class hexa;
+ template <typename I> struct hexa;
namespace internal
diff --git a/milena/mln/core/image/dmorph/sub_image_if.hh b/milena/mln/core/image/dmorph/sub_image_if.hh
index 547366a..2cc9661 100644
--- a/milena/mln/core/image/dmorph/sub_image_if.hh
+++ b/milena/mln/core/image/dmorph/sub_image_if.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -46,7 +47,7 @@ namespace mln
// Forward declaration.
- template <typename I, typename S> class sub_image_if;
+ template <typename I, typename S> struct sub_image_if;
namespace internal
@@ -168,7 +169,7 @@ namespace mln
{
typedef fun::p2b::has<I> F;
F f(ima);
- s_ = p_if<S,F>(s, f);
+ s_ = p_if<S,F>(s, f);
}
} // end of namespace mln::internal
diff --git a/milena/mln/core/image/dmorph/transformed_image.hh b/milena/mln/core/image/dmorph/transformed_image.hh
index 5feb3b8..0fb4509 100644
--- a/milena/mln/core/image/dmorph/transformed_image.hh
+++ b/milena/mln/core/image/dmorph/transformed_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -42,7 +43,7 @@ namespace mln
// Forward declaration.
- template <typename I, typename F> class transformed_image;
+ template <typename I, typename F> struct transformed_image;
namespace internal
@@ -221,7 +222,7 @@ namespace mln
mln_precondition(this->delegatee_()->has(this->data_->f_(p)));
return this->delegatee_()->operator()(this->data_->f_(p));
}
-
+
template <typename I, typename F>
inline
mln_morpher_lvalue(I)
diff --git a/milena/mln/core/image/flat_image.hh b/milena/mln/core/image/flat_image.hh
index 10d6211..6647766 100644
--- a/milena/mln/core/image/flat_image.hh
+++ b/milena/mln/core/image/flat_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@ namespace mln
// Forward declaration.
- template <typename T, typename S> class flat_image;
+ template <typename T, typename S> struct flat_image;
namespace internal
diff --git a/milena/mln/core/image/graph_elt_mixed_window.hh b/milena/mln/core/image/graph_elt_mixed_window.hh
index 6ece878..046843a 100644
--- a/milena/mln/core/image/graph_elt_mixed_window.hh
+++ b/milena/mln/core/image/graph_elt_mixed_window.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -42,8 +43,8 @@ namespace mln
/// Forward declaration
template <typename G, typename S, typename S2> class graph_elt_mixed_window;
- template <typename G, typename F> struct p_edges;
- template <typename G, typename F> struct p_vertices;
+ template <typename G, typename F> class p_edges;
+ template <typename G, typename F> class p_vertices;
namespace util
{
template <typename G> class edge;
diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_window.hh
index b39c44e..86cb147 100644
--- a/milena/mln/core/image/graph_elt_window.hh
+++ b/milena/mln/core/image/graph_elt_window.hh
@@ -42,8 +42,8 @@ namespace mln
/// Forward declaration
template <typename G, typename S> class graph_elt_window;
- template <typename G, typename F> struct p_edges;
- template <typename G, typename F> struct p_vertices;
+ template <typename G, typename F> class p_edges;
+ template <typename G, typename F> class p_vertices;
namespace util
{
template <typename G> class edge;
diff --git a/milena/mln/core/image/graph_elt_window_if.hh b/milena/mln/core/image/graph_elt_window_if.hh
index 131e4d2..920e524 100644
--- a/milena/mln/core/image/graph_elt_window_if.hh
+++ b/milena/mln/core/image/graph_elt_window_if.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -44,8 +45,8 @@ namespace mln
/// Forward declaration
template <typename G, typename S, typename I> class graph_elt_window_if;
- template <typename G, typename F> struct p_edges;
- template <typename G, typename F> struct p_vertices;
+ template <typename G, typename F> class p_edges;
+ template <typename G, typename F> class p_vertices;
namespace internal
diff --git a/milena/mln/core/image/graph_window_if_piter.hh b/milena/mln/core/image/graph_window_if_piter.hh
index d872853..068fbdb 100644
--- a/milena/mln/core/image/graph_window_if_piter.hh
+++ b/milena/mln/core/image/graph_window_if_piter.hh
@@ -167,7 +167,7 @@ namespace mln
graph_window_if_piter<S,W,I>::do_start_()
{
iter_.start();
- while (iter_.is_valid() && is_masked(this->c_->element(), iter_))
+ while (iter_.is_valid() && this->is_masked(this->c_->element(), iter_))
iter_.next();
}
@@ -177,7 +177,7 @@ namespace mln
graph_window_if_piter<S,W,I>::do_next_()
{
iter_.next();
- while (iter_.is_valid() && is_masked(this->c_->element(), iter_))
+ while (iter_.is_valid() && this->is_masked(this->c_->element(), iter_))
iter_.next();
}
diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh
index 1891925..f6e8d08 100644
--- a/milena/mln/core/image/graph_window_piter.hh
+++ b/milena/mln/core/image/graph_window_piter.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -209,8 +209,8 @@ namespace mln
using super_impl_::do_start_;
- friend class internal::impl_selector<typename W::center_t, mln_psite(W),
- graph_window_piter<S,W,I> > ;
+ friend struct internal::impl_selector<typename W::center_t, mln_psite(W),
+ graph_window_piter<S,W,I> > ;
private:
I iter_;
diff --git a/milena/mln/core/image/image2d.hh b/milena/mln/core/image/image2d.hh
index d2a3e0f..120d84b 100644
--- a/milena/mln/core/image/image2d.hh
+++ b/milena/mln/core/image/image2d.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -58,7 +59,7 @@ namespace mln
{
// Forward declaration.
- template <typename T> struct image2d;
+ template <typename T> class image2d;
namespace internal
diff --git a/milena/mln/core/image/imorph/labeled_image.hh b/milena/mln/core/image/imorph/labeled_image.hh
index c0fcde2..c99f386 100644
--- a/milena/mln/core/image/imorph/labeled_image.hh
+++ b/milena/mln/core/image/imorph/labeled_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -50,7 +51,7 @@ namespace mln
{
// Forward declarations.
- template <typename I> struct labeled_image;
+ template <typename I> class labeled_image;
namespace accu
{
template <typename T> struct nil;
diff --git a/milena/mln/core/image/imorph/plain.hh b/milena/mln/core/image/imorph/plain.hh
index e09bfa5..66c9ebd 100644
--- a/milena/mln/core/image/imorph/plain.hh
+++ b/milena/mln/core/image/imorph/plain.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -40,7 +41,7 @@ namespace mln
{
// Forward declaration.
- template <typename I> struct plain;
+ template <typename I> class plain;
namespace internal
diff --git a/milena/mln/core/image/imorph/safe.hh b/milena/mln/core/image/imorph/safe.hh
index c053645..c516ef4 100644
--- a/milena/mln/core/image/imorph/safe.hh
+++ b/milena/mln/core/image/imorph/safe.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +42,7 @@ namespace mln
{
// Forward declaration.
- template <typename I> struct safe_image;
+ template <typename I> class safe_image;
namespace internal
diff --git a/milena/mln/core/image/vmorph/cast_image.hh b/milena/mln/core/image/vmorph/cast_image.hh
index bed4fbf..0226ad0 100644
--- a/milena/mln/core/image/vmorph/cast_image.hh
+++ b/milena/mln/core/image/vmorph/cast_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -42,7 +43,7 @@ namespace mln
{
// Fwd decl.
- template <typename T, typename I> class cast_image_;
+ template <typename T, typename I> struct cast_image_;
namespace internal
diff --git a/milena/mln/core/image/vmorph/fun_image.hh b/milena/mln/core/image/vmorph/fun_image.hh
index 3934725..1dc4256 100644
--- a/milena/mln/core/image/vmorph/fun_image.hh
+++ b/milena/mln/core/image/vmorph/fun_image.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -46,7 +46,7 @@ namespace mln
{
// Forward declaration.
- template <typename F, typename I> class fun_image;
+ template <typename F, typename I> struct fun_image;
namespace internal
{
diff --git a/milena/mln/core/image/vmorph/thru_image.hh b/milena/mln/core/image/vmorph/thru_image.hh
index 2691d38..e829b27 100644
--- a/milena/mln/core/image/vmorph/thru_image.hh
+++ b/milena/mln/core/image/vmorph/thru_image.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -43,12 +43,12 @@ namespace mln
{
// Forward declaration.
- template <typename I, typename F> struct thru_image;
+ template <typename I, typename F> class thru_image;
namespace internal
{
- template <typename I, typename F> struct thru_image_write;
- template <typename I, typename F> struct thru_image_read;
+ template <typename I, typename F> class thru_image_write;
+ template <typename I, typename F> class thru_image_read;
/// Find correct implementation
template <typename I, typename F>
diff --git a/milena/mln/core/image/vmorph/thrubin_image.hh b/milena/mln/core/image/vmorph/thrubin_image.hh
index 9d5a2f3..0195d1a 100644
--- a/milena/mln/core/image/vmorph/thrubin_image.hh
+++ b/milena/mln/core/image/vmorph/thrubin_image.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -42,7 +42,7 @@ namespace mln
{
// Forward declaration.
- template <typename I1, typename I2, typename F> struct thrubin_image;
+ template <typename I1, typename I2, typename F> class thrubin_image;
namespace internal
{
diff --git a/milena/mln/core/image/vmorph/violent_cast_image.hh b/milena/mln/core/image/vmorph/violent_cast_image.hh
index 8ff9a1e..0ce4669 100644
--- a/milena/mln/core/image/vmorph/violent_cast_image.hh
+++ b/milena/mln/core/image/vmorph/violent_cast_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -40,7 +41,7 @@ namespace mln
{
// Fwd decl.
- template <typename T, typename I> class violent_cast_image;
+ template <typename T, typename I> struct violent_cast_image;
namespace internal
{
diff --git a/milena/mln/core/internal/is_masked_impl_selector.hh b/milena/mln/core/internal/is_masked_impl_selector.hh
index 56e4ed3..41d941b 100644
--- a/milena/mln/core/internal/is_masked_impl_selector.hh
+++ b/milena/mln/core/internal/is_masked_impl_selector.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -37,8 +38,8 @@ namespace mln
{
// Forward declarations.
- template <typename G, typename F> struct p_edges;
- template <typename G, typename F> struct p_vertices;
+ template <typename G, typename F> class p_edges;
+ template <typename G, typename F> class p_vertices;
diff --git a/milena/mln/core/internal/pixel_impl.hh b/milena/mln/core/internal/pixel_impl.hh
index 45ea553..7fe8eea 100644
--- a/milena/mln/core/internal/pixel_impl.hh
+++ b/milena/mln/core/internal/pixel_impl.hh
@@ -46,12 +46,12 @@ namespace mln
{
// We indeed have to handle the couple of cases when I is fastest
- // or is not. Justification: mln::pixel derives from pixel_impl_
+ // or is not. Justification: mln::pixel derives from pixel_impl_
// and is a general purpose pixel class; it can be used on any
// image whatever it is a fastest one or not.
template <bool is_fastest, typename I, typename E>
- class pixel_impl_base_;
+ struct pixel_impl_base_;
template <typename I, typename E>
diff --git a/milena/mln/core/routine/init.hxx b/milena/mln/core/routine/init.hxx
index 3a47684..5cc6d12 100644
--- a/milena/mln/core/routine/init.hxx
+++ b/milena/mln/core/routine/init.hxx
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -36,9 +37,9 @@ namespace mln
// Forward declarations.
namespace fun { namespace i2v { template <typename T> class array; } }
- namespace pw { namespace internal { template <typename F, typename S, typename E> class image_base; } }
+ namespace pw { namespace internal { template <typename F, typename S, typename E> struct image_base; } }
namespace pw { template <typename F, typename S> class image; }
- template <typename I, typename F> class image_if;
+ template <typename I, typename F> struct image_if;
diff --git a/milena/mln/core/site_set/attic/p_faces_piter.hh b/milena/mln/core/site_set/attic/p_faces_piter.hh
index da4b24a..148872c 100644
--- a/milena/mln/core/site_set/attic/p_faces_piter.hh
+++ b/milena/mln/core/site_set/attic/p_faces_piter.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -41,7 +41,7 @@ namespace mln
{
// Forward declarations.
- template <unsigned N, unsigned D, typename P> class p_faces;
+ template <unsigned N, unsigned D, typename P> struct p_faces;
template <unsigned N, unsigned D> class faces_fwd_iter_;
template <unsigned N, unsigned D> class faces_bkd_iter_;
diff --git a/milena/mln/core/site_set/p_faces.hh b/milena/mln/core/site_set/p_faces.hh
index a308a61..09fa2fc 100644
--- a/milena/mln/core/site_set/p_faces.hh
+++ b/milena/mln/core/site_set/p_faces.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -49,7 +50,7 @@ namespace mln
{
// Forward declarations.
- template <unsigned N, unsigned D, typename P> class p_faces;
+ template <unsigned N, unsigned D, typename P> struct p_faces;
template <unsigned N, unsigned D, typename P> class p_faces_fwd_piter_;
template <unsigned N, unsigned D, typename P> class p_faces_bkd_piter_;
diff --git a/milena/mln/core/site_set/p_if.hh b/milena/mln/core/site_set/p_if.hh
index 4381e86..06ae5c6 100644
--- a/milena/mln/core/site_set/p_if.hh
+++ b/milena/mln/core/site_set/p_if.hh
@@ -41,7 +41,7 @@ namespace mln
{
// Forward declarations.
- template <typename S, typename F> struct p_if;
+ template <typename S, typename F> class p_if;
template <typename Pi, typename S, typename F> struct p_if_piter_;
@@ -114,7 +114,7 @@ namespace mln
bool is_valid() const;
- /// Test if \p p belongs to the subset.
+ /// Test if \p p belongs to the subset.
bool has(const psite& p) const;
/// Give the primary overset.
@@ -184,7 +184,7 @@ namespace mln
{
return f_(p);
}
-
+
template <typename S, typename F>
inline
p_if<S,F>::p_if(const S& s, const F& f)
diff --git a/milena/mln/core/site_set/p_transformed.hh b/milena/mln/core/site_set/p_transformed.hh
index ff0638d..2b597a5 100644
--- a/milena/mln/core/site_set/p_transformed.hh
+++ b/milena/mln/core/site_set/p_transformed.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -39,7 +40,7 @@ namespace mln
{
// Forward declarations.
- template <typename S, typename F> struct p_transformed;
+ template <typename S, typename F> class p_transformed;
template <typename Pi, typename S, typename F> struct p_transformed_piter;
diff --git a/milena/mln/data/fill.hh b/milena/mln/data/fill.hh
index 7556470..96587a6 100644
--- a/milena/mln/data/fill.hh
+++ b/milena/mln/data/fill.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -78,14 +79,6 @@ namespace mln
// FIXME: check for ambiguities...
}
- // dispatch
-
- template <typename I, typename D>
- void fill_dispatch(Image<I>& ima, const D& data)
- {
- fill_dispatch_overload(exact(ima), exact(data));
- }
-
// dispatch_overload
template <typename I>
@@ -127,6 +120,15 @@ namespace mln
ima(p) = arr[i++];
}
+
+ // dispatch
+
+ template <typename I, typename D>
+ void fill_dispatch(Image<I>& ima, const D& data)
+ {
+ fill_dispatch_overload(exact(ima), exact(data));
+ }
+
} // end of namespace mln::data::internal
diff --git a/milena/mln/debug/println.spe.hh b/milena/mln/debug/println.spe.hh
index 257ddf4..856c635 100644
--- a/milena/mln/debug/println.spe.hh
+++ b/milena/mln/debug/println.spe.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -53,7 +54,7 @@
namespace mln
{
// Forward declaration.
- template <typename I> class hexa;
+ template <typename I> struct hexa;
namespace debug
{
diff --git a/milena/mln/extension/fill.hh b/milena/mln/extension/fill.hh
index caed937..4375a24 100644
--- a/milena/mln/extension/fill.hh
+++ b/milena/mln/extension/fill.hh
@@ -104,6 +104,8 @@ namespace mln
mln::trait::image::ext_domain::any,
I& ima, const mln_value(I)& val)
{
+ (void) ima;
+ (void) val;
// Oops...
}
diff --git a/milena/mln/fun/spe/binary.hh b/milena/mln/fun/spe/binary.hh
index eaeaa73..cde465d 100644
--- a/milena/mln/fun/spe/binary.hh
+++ b/milena/mln/fun/spe/binary.hh
@@ -71,6 +71,7 @@ namespace mln
template <typename U>
void init(const U& value)
{
+ (void) value;
}
};
diff --git a/milena/mln/fun/spe/unary.hh b/milena/mln/fun/spe/unary.hh
index 0c5a949..47d7f41 100644
--- a/milena/mln/fun/spe/unary.hh
+++ b/milena/mln/fun/spe/unary.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -175,6 +176,7 @@ namespace mln
template <typename U>
void init(const U& value)
{
+ (void) value;
};
};
diff --git a/milena/mln/fun/x2x/rotation.hh b/milena/mln/fun/x2x/rotation.hh
index 3cd54f1..ed48ebf 100644
--- a/milena/mln/fun/x2x/rotation.hh
+++ b/milena/mln/fun/x2x/rotation.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -66,6 +66,9 @@ namespace mln
algebra::h_mat<n, C>
get_rot_h_mat(const C alpha_, const algebra::vec<n,C>& axis_)
{
+ (void) alpha_;
+ (void) axis_;
+
std::cerr
<< __FILE__ << ":" << __LINE__ << ": error:"
<< " generic mln::fun::x2x::internal::get_rot_h_mat<n, C>"
diff --git a/milena/mln/geom/chamfer.hh b/milena/mln/geom/chamfer.hh
index 9603605..8fb6cc8 100644
--- a/milena/mln/geom/chamfer.hh
+++ b/milena/mln/geom/chamfer.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -111,7 +112,7 @@ namespace mln
template <typename I, typename W>
mln_ch_value(I, unsigned)
chamfer(const Image<I>& input_, const W& w_win_,
- unsigned max = mln_max(unsigned))
+ unsigned max)
{
trace::entering("mln::geom::chamfer");
// FIXME: check that input_ is binary.
diff --git a/milena/mln/io/fld/max_components.hh b/milena/mln/io/fld/max_components.hh
index d57310a..ceb4d27 100644
--- a/milena/mln/io/fld/max_components.hh
+++ b/milena/mln/io/fld/max_components.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -74,6 +74,7 @@ namespace mln
inline
unsigned max_component(const algebra::vec<n, V>& v)
{
+ (void) v;
return unsigned(mln_max(V));
}
diff --git a/milena/mln/io/pbm/save.hh b/milena/mln/io/pbm/save.hh
index 689b492..a9b7604 100644
--- a/milena/mln/io/pbm/save.hh
+++ b/milena/mln/io/pbm/save.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -46,8 +47,8 @@ namespace mln
// Fwd decl.
namespace value {
- template <unsigned> class int_u;
- template <unsigned> class int_u_sat;
+ template <unsigned> struct int_u;
+ template <unsigned> struct int_u_sat;
}
diff --git a/milena/mln/io/pgm/save.hh b/milena/mln/io/pgm/save.hh
index 6438b30..c5ba0af 100644
--- a/milena/mln/io/pgm/save.hh
+++ b/milena/mln/io/pgm/save.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -50,8 +51,8 @@ namespace mln
// Fwd decl.
namespace value {
- template <unsigned> class int_u;
- template <unsigned> class int_u_sat;
+ template <unsigned> struct int_u;
+ template <unsigned> struct int_u_sat;
}
diff --git a/milena/mln/labeling/flat_zones.hh b/milena/mln/labeling/flat_zones.hh
index 431bd86..6c406d5 100644
--- a/milena/mln/labeling/flat_zones.hh
+++ b/milena/mln/labeling/flat_zones.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -82,9 +82,9 @@ namespace mln
void do_no_union(const P&, const P&) {}
void init_attr(const P&) {}
void merge_attr(const P&, const P&) {}
- void set_new_label(const P& p, const L& l){}
- void set_label(const P& p, const L& l) {}
- void finalize() {}
+ void set_new_label(const P&, const L&){}
+ void set_label(const P&, const L&) {}
+ void finalize() {}
// Fastest implementation.
diff --git a/milena/mln/labeling/value.hh b/milena/mln/labeling/value.hh
index 7e1608c..fdd47ef 100644
--- a/milena/mln/labeling/value.hh
+++ b/milena/mln/labeling/value.hh
@@ -111,8 +111,8 @@ namespace mln
void do_no_union(const P&, const P&) {}
void init_attr(const P&) {}
void merge_attr(const P&, const P&) {}
- void set_new_label(const P& p, const L& l){}
- void set_label(const P& p, const L& l) {}
+ void set_new_label(const P&, const L&) {}
+ void set_label(const P&, const L&) {}
void finalize() {}
// Fastest implementation
diff --git a/milena/mln/morpho/attribute/height.hh b/milena/mln/morpho/attribute/height.hh
index 4e8f234..3d47ac0 100644
--- a/milena/mln/morpho/attribute/height.hh
+++ b/milena/mln/morpho/attribute/height.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,7 +45,7 @@ namespace mln
// Forward declaration.
namespace morpho {
namespace attribute {
- template <typename I> class height;
+ template <typename I> struct height;
}
}
diff --git a/milena/mln/morpho/attribute/sharpness.hh b/milena/mln/morpho/attribute/sharpness.hh
index 9548b4d..866b1ab 100644
--- a/milena/mln/morpho/attribute/sharpness.hh
+++ b/milena/mln/morpho/attribute/sharpness.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,7 +45,7 @@ namespace mln
namespace morpho {
namespace attribute {
template <typename I>
- class sharpness;
+ struct sharpness;
}
}
diff --git a/milena/mln/morpho/attribute/volume.hh b/milena/mln/morpho/attribute/volume.hh
index 94dc977..2ac66c6 100644
--- a/milena/mln/morpho/attribute/volume.hh
+++ b/milena/mln/morpho/attribute/volume.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -42,7 +43,7 @@ namespace mln
// Forward declaration.
namespace morpho {
namespace attribute {
- template <typename I> class volume;
+ template <typename I> struct volume;
}
}
diff --git a/milena/mln/morpho/reconstruction/by_dilation/union_find.hh b/milena/mln/morpho/reconstruction/by_dilation/union_find.hh
index 59f15e4..35ec2ae 100644
--- a/milena/mln/morpho/reconstruction/by_dilation/union_find.hh
+++ b/milena/mln/morpho/reconstruction/by_dilation/union_find.hh
@@ -92,7 +92,7 @@ namespace mln
}
-
+
template <typename Par>
inline
mln_site(Par) find_root(Par& parent, mln_site(Par) x)
@@ -111,10 +111,10 @@ namespace mln
namespace impl
{
-
+
namespace generic
{
-
+
template <typename I, typename J, typename N>
inline
mln_concrete(I)
@@ -128,8 +128,8 @@ namespace mln
const N& nbh = exact(nbh_);
internal::union_find_tests(f, g, nbh);
-
-
+
+
typedef mln_site(I) P;
typedef mln_value(I) V;
@@ -184,7 +184,7 @@ namespace mln
deja_vu(p) = true;
}
}
-
+
// Second pass.
{
for (int i = s.nsites() - 1; i >= 0; --i)
@@ -207,7 +207,7 @@ namespace mln
return output;
}
-
+
} // end of namespace mln::morpho::reconstruction::by_dilation::impl::generic
} // end of namespace mln::morpho::reconstruction::by_dilation::impl
@@ -225,6 +225,10 @@ namespace mln
const Image<I>& f, const Image<J>& g,
const Neighborhood<N>& nbh)
{
+ (void) f;
+ (void) g;
+ (void) nbh;
+
// FIXME: Not yet implemented.
std::cerr
<< __FILE__ << ":" << __LINE__ << ": error:\n"
diff --git a/milena/mln/morpho/tree/compute_attribute_image.hh b/milena/mln/morpho/tree/compute_attribute_image.hh
index 9126bf1..e028084 100644
--- a/milena/mln/morpho/tree/compute_attribute_image.hh
+++ b/milena/mln/morpho/tree/compute_attribute_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -92,7 +93,7 @@ namespace mln
** \param[in] values Value image.
** \param[out] accu_image Optional argument used to store image.
**
- ** \return
+ ** \return
*/
template <typename A, typename T, typename V>
mln_ch_value(typename T::function, mln_result(A))
@@ -215,7 +216,7 @@ namespace mln
mln_ch_value(typename T::function, mln_result(A))
compute_attribute_image(const Accumulator<A>& a_,
const T& t,
- mln_ch_value(typename T::function, A)* accu_image = 0)
+ mln_ch_value(typename T::function, A)* accu_image)
{
trace::entering("morpho::tree::compute_attribute_image");
@@ -233,7 +234,7 @@ namespace mln
compute_attribute_image_from(const Accumulator<A>& a_,
const T& t,
const Image<V>& values,
- mln_ch_value(typename T::function, A)* accu_image = 0)
+ mln_ch_value(typename T::function, A)* accu_image)
{
trace::entering("morpho::tree::compute_attribute_image_from");
diff --git a/milena/mln/morpho/tree/data.hh b/milena/mln/morpho/tree/data.hh
index 1a0c404..3083759 100644
--- a/milena/mln/morpho/tree/data.hh
+++ b/milena/mln/morpho/tree/data.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -93,7 +93,7 @@ namespace mln
template <typename T> struct dn_leaf_piter;
/// Depth1st tree traversal iterator.
- template <typename T> struct depth1st_piter;
+ template <typename T> class depth1st_piter;
template <typename I, typename S>
diff --git a/milena/mln/opt/element.hh b/milena/mln/opt/element.hh
index f572349..835a41f 100644
--- a/milena/mln/opt/element.hh
+++ b/milena/mln/opt/element.hh
@@ -63,6 +63,7 @@ namespace mln
mln_rvalue(I) element_impl(trait::image::category::domain_morpher,
const Image<I>& ima, unsigned index)
{
+ (void) index;
return element(*exact(ima).delegatee_());
}
diff --git a/milena/mln/registration/get_rot.hh b/milena/mln/registration/get_rot.hh
index e1babf1..28667cb 100644
--- a/milena/mln/registration/get_rot.hh
+++ b/milena/mln/registration/get_rot.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -61,6 +62,12 @@ namespace mln
{
assert(0 && "TODO");
+ (void) c;
+ (void) mu_c;
+ (void) ck;
+ (void) map;
+ (void) mu_xk;
+
//////SLOW VERSION
//// V1
diff --git a/milena/mln/subsampling/antialiased.hh b/milena/mln/subsampling/antialiased.hh
index cb6bbca..66bdd33 100644
--- a/milena/mln/subsampling/antialiased.hh
+++ b/milena/mln/subsampling/antialiased.hh
@@ -118,6 +118,11 @@ namespace mln
const mln_domain(I)& output_domain,
unsigned border_thickness)
{
+ (void) input_;
+ (void) factor;
+ (void) output_domain;
+ (void) border_thickness;
+
// To be written...
mlc_abort(I)::check();
@@ -314,6 +319,11 @@ namespace mln
const mln_domain(I)& output_domain,
unsigned border_thickness)
{
+ (void) input;
+ (void) factor;
+ (void) output_domain;
+ (void) border_thickness;
+
// Not implemented yet.
mlc_abort(I)::check();
}
diff --git a/milena/mln/subsampling/gaussian_subsampling.hh b/milena/mln/subsampling/gaussian_subsampling.hh
index 4e8f24e..8855b9c 100644
--- a/milena/mln/subsampling/gaussian_subsampling.hh
+++ b/milena/mln/subsampling/gaussian_subsampling.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -66,6 +67,8 @@ namespace mln
trace::entering("subsampling::gaussian_subsampling");
mln_precondition(exact(input).is_valid());
+ (void) sigma;
+
mln_concrete(I) temp(exact(input).domain());
mln_concrete(I) output(geom::nrows(input) / gap,
geom::ncols(input) / gap); //FIXME : image2d only
diff --git a/milena/mln/topo/center_only_iter.hh b/milena/mln/topo/center_only_iter.hh
index ff072aa..9d52099 100644
--- a/milena/mln/topo/center_only_iter.hh
+++ b/milena/mln/topo/center_only_iter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,7 +45,7 @@ namespace mln
{
// Forward declaration.
- template <unsigned D> class face;
+ template <unsigned D> struct face;
/*----------------------------.
@@ -63,7 +64,7 @@ namespace mln
as well, since it always contains a single element, the
center/reference face (and the traversal order is
meaningless).
-
+
This iterator is essentially used to implement other iterators.
\see mln::topo::centered_iter_adapter
\see mln::complex_lower_window
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 98b81c7..954ddd0 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -48,7 +49,7 @@ namespace mln
template <unsigned D> class complex;
template <unsigned N, unsigned D> class n_face;
template <unsigned N, unsigned D> class face_data;
- template <unsigned N> class algebraic_face;
+ template <unsigned N> struct algebraic_face;
/*-------.
diff --git a/milena/mln/topo/face_data.hh b/milena/mln/topo/face_data.hh
index 6a7bd8e..257586d 100644
--- a/milena/mln/topo/face_data.hh
+++ b/milena/mln/topo/face_data.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -50,7 +51,7 @@ namespace mln
{
template <unsigned N, unsigned D> struct lower_dim_faces_set_mixin;
template <unsigned N, unsigned D> struct higher_dim_faces_set_mixin;
-
+
template <unsigned N, unsigned D>
struct lower_dim_adj_faces_if_dim_matches_;
template <unsigned N, unsigned D>
@@ -115,8 +116,8 @@ namespace mln
void connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f);
private:
- friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
- friend class mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>;
+ friend struct mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
+ friend struct mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>;
friend lower_dim_faces_type
mln::topo::n_face<N, D>::lower_dim_adj_faces() const;
@@ -133,8 +134,8 @@ namespace mln
void connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f);
private:
- friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
- friend class mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>;
+ friend struct mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
+ friend struct mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>;
friend higher_dim_faces_type
mln::topo::n_face<N, D>::higher_dim_adj_faces() const;
diff --git a/milena/mln/topo/skeleton/is_simple_point.hh b/milena/mln/topo/skeleton/is_simple_point.hh
index 590bf60..5248cf4 100644
--- a/milena/mln/topo/skeleton/is_simple_point.hh
+++ b/milena/mln/topo/skeleton/is_simple_point.hh
@@ -243,6 +243,10 @@ namespace mln
const Neighborhood<N>& nbh,
const mln_site(I)& p)
{
+ (void) ima;
+ (void) nbh;
+ (void) p;
+
/// Not implemented for that site type yet.
mlc_abort(I)::check();
return false;
diff --git a/milena/mln/trait/image_from_grid.hh b/milena/mln/trait/image_from_grid.hh
index eae5e4e..38fc538 100644
--- a/milena/mln/trait/image_from_grid.hh
+++ b/milena/mln/trait/image_from_grid.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -47,7 +48,7 @@ namespace mln
// Fwd decls.
template <typename T> struct image1d;
- template <typename T> struct image2d;
+ template <typename T> class image2d;
template <typename T> struct image3d;
diff --git a/milena/mln/trait/images.hh b/milena/mln/trait/images.hh
index 409d773..d8e80b0 100644
--- a/milena/mln/trait/images.hh
+++ b/milena/mln/trait/images.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -110,16 +111,16 @@ namespace mln
// Primitive types.
template <typename T> struct image1d;
- template <typename T> struct image2d;
+ template <typename T> class image2d;
template <typename T> struct image3d;
namespace pw { template <typename F, typename S> class image; }
// Morphers.
template <typename I, typename F> struct image_if_base;
- template <typename I, typename D> class decorated_image;
- template <typename I, typename S> class sub_image;
+ template <typename I, typename D> struct decorated_image;
+ template <typename I, typename S> struct sub_image;
template <typename I> class safe_image;
- template <typename T, typename I> class cast_image_;
+ template <typename T, typename I> struct cast_image_;
namespace value { template <unsigned n, typename I> struct stack_image; }
diff --git a/milena/mln/transform/influence_zone_geodesic.hh b/milena/mln/transform/influence_zone_geodesic.hh
index b9a763f..64d7702 100644
--- a/milena/mln/transform/influence_zone_geodesic.hh
+++ b/milena/mln/transform/influence_zone_geodesic.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -87,6 +87,9 @@ namespace mln
influence_zone_geodesic(const Image<I>& input,
const Neighborhood<N>& nbh)
{
+ (void) input;
+ (void) nbh;
+
// FIXME: To be written...
mlc_abort(I)::check();
}
diff --git a/milena/mln/util/object_id.hh b/milena/mln/util/object_id.hh
index d7db929..212b2ca 100644
--- a/milena/mln/util/object_id.hh
+++ b/milena/mln/util/object_id.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -115,6 +116,7 @@ namespace mln
inline
object_id<Tag,V>::object_id(const object_id<Tag2,V2>& id)
{
+ (void) id;
typedef object_id<Tag2,V2> id_t;
mlc_abort(id_t)::check();
}
diff --git a/milena/mln/value/float01.hh b/milena/mln/value/float01.hh
index 23f83df..898853f 100644
--- a/milena/mln/value/float01.hh
+++ b/milena/mln/value/float01.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -47,7 +48,7 @@ namespace mln
{
// Fwd decl.
- template <unsigned n> class float01_;
+ template <unsigned n> struct float01_;
class float01;
diff --git a/milena/mln/value/float01_f.hh b/milena/mln/value/float01_f.hh
index 2769200..3edb4ae 100644
--- a/milena/mln/value/float01_f.hh
+++ b/milena/mln/value/float01_f.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -43,7 +44,7 @@ namespace mln
// Fwd decls.
namespace value {
- struct float01;
+ class float01;
struct float01_f;
}
diff --git a/milena/mln/value/graylevel.hh b/milena/mln/value/graylevel.hh
index cca7e08..fc68391 100644
--- a/milena/mln/value/graylevel.hh
+++ b/milena/mln/value/graylevel.hh
@@ -63,7 +63,7 @@ namespace mln
namespace internal
{
template <unsigned n> class gray_;
- class gray_f;
+ struct gray_f;
template <unsigned n_src, unsigned n_dest>
long convert(int val);
}
diff --git a/milena/mln/value/graylevel_f.hh b/milena/mln/value/graylevel_f.hh
index e70927a..4194b25 100644
--- a/milena/mln/value/graylevel_f.hh
+++ b/milena/mln/value/graylevel_f.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -57,7 +58,7 @@ namespace mln
namespace value
{
/// \{ Forward declarations.
- namespace internal {class gray_f; }
+ namespace internal { struct gray_f; }
struct graylevel_f;
template <unsigned n> struct graylevel;
struct float01_f;
diff --git a/milena/mln/value/internal/gray_.hh b/milena/mln/value/internal/gray_.hh
index e672c37..c845c21 100644
--- a/milena/mln/value/internal/gray_.hh
+++ b/milena/mln/value/internal/gray_.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -57,8 +58,8 @@ namespace mln
/// \{ Forward declarations.
template <unsigned n>
struct graylevel;
- template <unsigned N> class graylevel;
- class graylevel_f;
+ template <unsigned N> struct graylevel;
+ struct graylevel_f;
namespace internal
{
template <unsigned n> class gray_;
@@ -488,6 +489,8 @@ namespace mln
void
operator+(const graylevel<n>& lhs, const I& i)
{
+ (void) lhs;
+ (void) i;
typename graylevel<n>::wrong_use_of_graylevel___Please_use_the__to_enc__method a;
}
@@ -498,6 +501,8 @@ namespace mln
void
operator+(const I& i, const graylevel<n>& rhs)
{
+ (void) i;
+ (void) rhs;
typename graylevel<n>::wrong_use_of_graylevel___Please_use_the__to_enc__method a;
}
@@ -516,6 +521,8 @@ namespace mln
void
operator-(const graylevel<n>& lhs, const I& i)
{
+ (void) lhs;
+ (void) i;
typename graylevel<n>::wrong_use_of_graylevel___Please_use_the__to_enc__method a;
}
@@ -526,6 +533,8 @@ namespace mln
void
operator-(const I& i, const graylevel<n>& rhs)
{
+ (void) i;
+ (void) rhs;
typename graylevel<n>::wrong_use_of_graylevel___Please_use_the__to_enc__method a;
}
@@ -592,7 +601,7 @@ namespace mln
/// \{ Forward declarations.
namespace internal
{
- class gray_f;
+ struct gray_f;
}
/// \}
diff --git a/milena/mln/value/internal/gray_f.hh b/milena/mln/value/internal/gray_f.hh
index 0408ae4..79a443c 100644
--- a/milena/mln/value/internal/gray_f.hh
+++ b/milena/mln/value/internal/gray_f.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2006, 2007, 2008, 2009, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -63,7 +63,7 @@ namespace mln
namespace internal
{
template <unsigned n> class gray_;
- class gray_f;
+ struct gray_f;
}
struct float01_f;
@@ -378,6 +378,8 @@ namespace mln
void
operator+(const graylevel_f& lhs, const I& i)
{
+ (void) lhs;
+ (void) i;
typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a;
}
@@ -388,6 +390,8 @@ namespace mln
void
operator+(const I& i, const graylevel_f& rhs)
{
+ (void) i;
+ (void) rhs;
typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a;
}
@@ -398,6 +402,8 @@ namespace mln
void
operator-(const graylevel_f& lhs, const I& i)
{
+ (void) lhs;
+ (void) i;
typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a;
}
@@ -408,6 +414,8 @@ namespace mln
void
operator-(const I& i, const graylevel_f& rhs)
{
+ (void) i;
+ (void) rhs;
typename Object<I>::wrong_use_of_graylevel_f___Please_use_the__to_enc__method a;
}
diff --git a/milena/mln/value/lut_vec.hh b/milena/mln/value/lut_vec.hh
index 7886dc1..38eb4a8 100644
--- a/milena/mln/value/lut_vec.hh
+++ b/milena/mln/value/lut_vec.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -137,6 +138,7 @@ namespace mln
unsigned
lut_vec<S,T>::index_of(const T& v) const
{
+ (void) v;
mln_invariant(0); // FIXME
return 0;
}
diff --git a/milena/mln/world/binary_2d/enlarge.hh b/milena/mln/world/binary_2d/enlarge.hh
index 1ffd512..da546e1 100644
--- a/milena/mln/world/binary_2d/enlarge.hh
+++ b/milena/mln/world/binary_2d/enlarge.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -328,6 +329,9 @@ namespace mln
mln_concrete(I)
enlarge_dispatch(const I& input, const mln_value(I)&, unsigned n)
{
+ (void) input;
+ (void) n;
+
mlc_abort(I)::check();
return mln_concrete(I)();
}
--
1.5.6.5
1
0

28 Apr '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch llvm-support has been created
at d85cb3e1f44dbcb5b8d790d691f00aa360f08398 (commit)
- Log -----------------------------------------------------------------
d85cb3e Fix warnings with clang 1.1
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0
* mln/accu/line.hh: Use def::coord.
* mln/algebra/vec.hh,
* mln/convert/from_to.hxx,
* mln/core/image/dmorph/sub_image.hh,
* mln/core/internal/site_set_iterator_base.hh,
* mln/core/site_set/box.hh,
* mln/core/site_set/p_array.hh,
* mln/core/site_set/p_edges.hh,
* mln/core/site_set/p_vertices.hh: Make forward declaration
consistent with declaration.
* mln/value/builtin/carrays.hh: Explicitly convert to char *.
* mln/convert/impl/from_double_to_value.hh,
* mln/convert/impl/from_int_to_value.hh,
* mln/core/point.hh,
* mln/opt/element.hh: Avoid unused variable warning.
* mln/convert/impl/from_image_to_site_set.hh: Remove useless local variable.
---
milena/ChangeLog | 25 ++++++++++++++++++++
milena/mln/accu/line.hh | 17 +++++++------
milena/mln/algebra/vec.hh | 5 ++-
milena/mln/convert/from_to.hxx | 5 ++-
milena/mln/convert/impl/from_double_to_value.hh | 5 +++-
milena/mln/convert/impl/from_image_to_site_set.hh | 4 +-
milena/mln/convert/impl/from_int_to_value.hh | 2 +
milena/mln/core/image/dmorph/sub_image.hh | 5 ++-
milena/mln/core/internal/site_set_iterator_base.hh | 6 +++-
milena/mln/core/point.hh | 5 ++-
milena/mln/core/site_set/box.hh | 8 +++---
milena/mln/core/site_set/p_array.hh | 7 +++--
milena/mln/core/site_set/p_edges.hh | 5 ++-
milena/mln/core/site_set/p_vertices.hh | 4 +-
milena/mln/opt/element.hh | 4 ++-
milena/mln/value/builtin/carrays.hh | 5 ++-
16 files changed, 77 insertions(+), 35 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 77e5cc3..8226e1b 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,28 @@
+2011-04-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Fix warnings with clang 1.1
+
+ * mln/accu/line.hh: Use def::coord.
+
+ * mln/algebra/vec.hh,
+ * mln/convert/from_to.hxx,
+ * mln/core/image/dmorph/sub_image.hh,
+ * mln/core/internal/site_set_iterator_base.hh,
+ * mln/core/site_set/box.hh,
+ * mln/core/site_set/p_array.hh,
+ * mln/core/site_set/p_edges.hh,
+ * mln/core/site_set/p_vertices.hh: Make forward declaration
+ consistent with declaration.
+
+ * mln/value/builtin/carrays.hh: Explicitly convert to char *.
+
+ * mln/convert/impl/from_double_to_value.hh,
+ * mln/convert/impl/from_int_to_value.hh,
+ * mln/core/point.hh,
+ * mln/opt/element.hh: Avoid unused variable warning.
+
+ * mln/convert/impl/from_image_to_site_set.hh: Remove useless local variable.
+
2010-12-10 Roland Levillain <roland(a)lrde.epita.fr>
Ensure non implemented reconstructions on sets abort at run time.
diff --git a/milena/mln/accu/line.hh b/milena/mln/accu/line.hh
index c6022ef..75be6b3 100644
--- a/milena/mln/accu/line.hh
+++ b/milena/mln/accu/line.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -63,8 +64,8 @@ namespace mln
typename I, typename O>
void
line(const Image<I>& input,
- const mln_site(I)& p_start, unsigned len,
- unsigned half_length,
+ const mln_site(I)& p_start, def::coord len,
+ def::coord half_length,
Image<O>& output);
@@ -98,7 +99,7 @@ namespace mln
mln_precondition(input.is_valid());
mln_precondition(output.is_valid());
}
-
+
} // end of namespace mln::accu::internal
@@ -107,7 +108,7 @@ namespace mln
namespace generic
{
-
+
template <typename Meta_Accu, unsigned Dir,
typename I, typename O>
void
@@ -212,8 +213,8 @@ namespace mln
typename I, typename O>
void
line_fastest(const Image<I>& input_,
- const mln_site(I)& p_start, unsigned len,
- unsigned half_length,
+ const mln_site(I)& p_start, def::coord len,
+ def::coord half_length,
Image<O>& output_)
{
typedef mln_site(I) P;
@@ -371,7 +372,7 @@ namespace mln
half_length,
output);
}
-
+
} // end of namespace mln::accu::internal
diff --git a/milena/mln/algebra/vec.hh b/milena/mln/algebra/vec.hh
index 22ebc02..dc526ec 100644
--- a/milena/mln/algebra/vec.hh
+++ b/milena/mln/algebra/vec.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2006, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -55,7 +56,7 @@ namespace mln
// Forward declarations.
namespace algebra {
template <unsigned n, typename T> class vec;
- template <unsigned d, typename C> class h_vec;
+ template <unsigned d, typename C> struct h_vec;
template <unsigned n, unsigned m, typename T> class mat;
}
diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx
index f4f690d..95c35a8 100644
--- a/milena/mln/convert/from_to.hxx
+++ b/milena/mln/convert/from_to.hxx
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -68,7 +69,7 @@ namespace mln
namespace algebra {
template <unsigned n, typename T> class vec;
- template <unsigned d, typename C> class h_vec;
+ template <unsigned d, typename C> struct h_vec;
}
namespace fun {
diff --git a/milena/mln/convert/impl/from_double_to_value.hh b/milena/mln/convert/impl/from_double_to_value.hh
index de766df..fa72059 100644
--- a/milena/mln/convert/impl/from_double_to_value.hh
+++ b/milena/mln/convert/impl/from_double_to_value.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -89,6 +90,8 @@ namespace mln
from_double_to_value(const double& from,
Value<V>& to)
{
+ (void) from;
+ (void) to;
mlc_abort(V)::check();
}
diff --git a/milena/mln/convert/impl/from_image_to_site_set.hh b/milena/mln/convert/impl/from_image_to_site_set.hh
index 2bdbcff..65873b6 100644
--- a/milena/mln/convert/impl/from_image_to_site_set.hh
+++ b/milena/mln/convert/impl/from_image_to_site_set.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -107,7 +108,6 @@ namespace mln
const std::pair< mln_value(I), p_run<P> >&)
{
s.clear();
- mln_value(I) O = literal::zero;
mln_fwd_piter(I) p(input.domain());
p.start();
for (;;)
diff --git a/milena/mln/convert/impl/from_int_to_value.hh b/milena/mln/convert/impl/from_int_to_value.hh
index 30840b3..bc83bf4 100644
--- a/milena/mln/convert/impl/from_int_to_value.hh
+++ b/milena/mln/convert/impl/from_int_to_value.hh
@@ -76,6 +76,8 @@ namespace mln
from_int_to_value(const int& from,
Value<V>& to)
{
+ (void) from;
+ (void) to;
mlc_abort(V)::check();
}
diff --git a/milena/mln/core/image/dmorph/sub_image.hh b/milena/mln/core/image/dmorph/sub_image.hh
index 9155b09..6256880 100644
--- a/milena/mln/core/image/dmorph/sub_image.hh
+++ b/milena/mln/core/image/dmorph/sub_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -43,7 +44,7 @@ namespace mln
// Forward declaration.
- template <typename I, typename S> class sub_image;
+ template <typename I, typename S> struct sub_image;
namespace internal
diff --git a/milena/mln/core/internal/site_set_iterator_base.hh b/milena/mln/core/internal/site_set_iterator_base.hh
index 66c94d5..71c3fe3 100644
--- a/milena/mln/core/internal/site_set_iterator_base.hh
+++ b/milena/mln/core/internal/site_set_iterator_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -114,8 +115,9 @@ namespace mln
template <typename S, typename E>
inline
void
- site_set_iterator_base<S, E>::change_target_(const S& /* s */)
+ site_set_iterator_base<S, E>::change_target_(const S& s)
{
+ (void) s;
// Empty by default.
}
diff --git a/milena/mln/core/point.hh b/milena/mln/core/point.hh
index df1fc2c..c4d1a73 100644
--- a/milena/mln/core/point.hh
+++ b/milena/mln/core/point.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -669,6 +669,7 @@ namespace mln
const util::yes&
cut_(const point<grid::tick,C>& p)
{
+ (void) p;
util::yes* the_;
return *the_;
}
diff --git a/milena/mln/core/site_set/box.hh b/milena/mln/core/site_set/box.hh
index c061321..11715b9 100644
--- a/milena/mln/core/site_set/box.hh
+++ b/milena/mln/core/site_set/box.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,8 +44,8 @@ namespace mln
// Fwd decls.
template <typename P> struct box;
- template <typename P> struct box_fwd_piter_;
- template <typename P> struct box_bkd_piter_;
+ template <typename P> class box_fwd_piter_;
+ template <typename P> class box_bkd_piter_;
namespace trait
diff --git a/milena/mln/core/site_set/p_array.hh b/milena/mln/core/site_set/p_array.hh
index 218a95a..36129f9 100644
--- a/milena/mln/core/site_set/p_array.hh
+++ b/milena/mln/core/site_set/p_array.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -52,8 +53,8 @@ namespace mln
template <typename P> class p_array;
template <typename S> class p_indexed_psite;
- template <typename S> struct p_indexed_fwd_piter;
- template <typename S> struct p_indexed_bkd_piter;
+ template <typename S> class p_indexed_fwd_piter;
+ template <typename S> class p_indexed_bkd_piter;
diff --git a/milena/mln/core/site_set/p_edges.hh b/milena/mln/core/site_set/p_edges.hh
index 4c58696..b4f1d27 100644
--- a/milena/mln/core/site_set/p_edges.hh
+++ b/milena/mln/core/site_set/p_edges.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -45,7 +46,7 @@ namespace mln
{
// Forward declaration.
- template <typename G, typename F> struct p_edges;
+ template <typename G, typename F> class p_edges;
namespace trait
diff --git a/milena/mln/core/site_set/p_vertices.hh b/milena/mln/core/site_set/p_vertices.hh
index c8497c0..6efa1a9 100644
--- a/milena/mln/core/site_set/p_vertices.hh
+++ b/milena/mln/core/site_set/p_vertices.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
@@ -44,7 +44,7 @@ namespace mln
{
// Forward declaration.
- template <typename G, typename F> struct p_vertices;
+ template <typename G, typename F> class p_vertices;
namespace trait
diff --git a/milena/mln/opt/element.hh b/milena/mln/opt/element.hh
index cec8ebe..f572349 100644
--- a/milena/mln/opt/element.hh
+++ b/milena/mln/opt/element.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -84,6 +85,7 @@ namespace mln
mln_lvalue(I) element_impl(trait::image::category::domain_morpher,
Image<I>& ima, unsigned index)
{
+ (void) index;
return element(*exact(ima).delegatee_());
}
diff --git a/milena/mln/value/builtin/carrays.hh b/milena/mln/value/builtin/carrays.hh
index a245683..3ad2721 100644
--- a/milena/mln/value/builtin/carrays.hh
+++ b/milena/mln/value/builtin/carrays.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -69,7 +70,7 @@ namespace mln
{
std::ostringstream s;
s << value_<T>::name() << '[' << n << ']';
- return s.str();
+ return s.str().c_str();
}
};
--
1.5.6.5
1
0

12 Apr '11
* apps/generic-skel/image2d-skel-unconstrained.cc,
* apps/generic-skel/image2d-skel-with-end-points.cc,
* apps/generic-skel/image2d-skel.hh:
New.
* apps/generic-skel/test-image2d-skel-unconstrained.in,
* apps/generic-skel/test-image2d-skel-with-end-points.in:
New tests.
* apps/generic-skel/Makefile.am: New.
* apps/Makefile.am (SUBDIRS): Add generic-skel.
---
milena/ChangeLog | 14 ++
milena/apps/Makefile.am | 6 +-
milena/apps/generic-skel/Makefile.am | 54 ++++++
.../image2d-skel-unconstrained.cc} | 53 +++++--
.../image2d-skel-with-end-points.cc} | 52 +++++--
milena/apps/generic-skel/image2d-skel.hh | 174 ++++++++++++++++++++
.../test-image2d-skel-unconstrained.in} | 7 +-
.../test-image2d-skel-with-end-points.in} | 7 +-
8 files changed, 330 insertions(+), 37 deletions(-)
create mode 100644 milena/apps/generic-skel/Makefile.am
copy milena/apps/{mesh-segm-skel/off-to-vtk-bin.cc => generic-skel/image2d-skel-unconstrained.cc} (53%)
copy milena/apps/{mesh-segm-skel/off-to-vtk-bin.cc => generic-skel/image2d-skel-with-end-points.cc} (53%)
create mode 100644 milena/apps/generic-skel/image2d-skel.hh
copy milena/apps/{mesh-segm-skel/test-mesh-complex-2-collapse.in => generic-skel/test-image2d-skel-unconstrained.in} (71%)
copy milena/apps/{mesh-segm-skel/test-mesh-complex-2-collapse.in => generic-skel/test-image2d-skel-with-end-points.in} (70%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f567ea8..16b07b7 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-20 Roland Levillain <roland(a)lrde.epita.fr>
+
+ New apps on generic skeletonization.
+
+ * apps/generic-skel/image2d-skel-unconstrained.cc,
+ * apps/generic-skel/image2d-skel-with-end-points.cc,
+ * apps/generic-skel/image2d-skel.hh:
+ New.
+ * apps/generic-skel/test-image2d-skel-unconstrained.in,
+ * apps/generic-skel/test-image2d-skel-with-end-points.in:
+ New tests.
+ * apps/generic-skel/Makefile.am: New.
+ * apps/Makefile.am (SUBDIRS): Add generic-skel.
+
2011-04-12 Roland Levillain <roland(a)lrde.epita.fr>
apps/graph-morpho: Catch up with current mln::topo::is_n_face.
diff --git a/milena/apps/Makefile.am b/milena/apps/Makefile.am
index c42ffd7..c15569b 100644
--- a/milena/apps/Makefile.am
+++ b/milena/apps/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+# Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -13,10 +14,9 @@
#
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-#
# Applied examples of Milena.
-SUBDIRS = mesh-segm-skel graph-morpho constrained-connectivity
+SUBDIRS = mesh-segm-skel generic-skel graph-morpho constrained-connectivity
# Examples from papers.
SUBDIRS += papers
diff --git a/milena/apps/generic-skel/Makefile.am b/milena/apps/generic-skel/Makefile.am
new file mode 100644
index 0000000..5ae65f5
--- /dev/null
+++ b/milena/apps/generic-skel/Makefile.am
@@ -0,0 +1,54 @@
+# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
+#
+# This file is part of Olena.
+#
+# Olena is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, version 2 of the License.
+#
+# Olena is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+# Find Milena and trimesh headers.
+AM_CPPFLAGS = -I$(top_srcdir)/milena
+# Produce fast code.
+APPS_CXXFLAGS = @APPS_CXXFLAGS@
+AM_CXXFLAGS = $(APPS_CXXFLAGS)
+
+
+bin_PROGRAMS = image2d-skel-unconstrained image2d-skel-with-end-points
+image2d_skel_unconstrained_SOURCES = image2d-skel-unconstrained.cc image2d-skel.hh
+image2d_skel_with_end_points_SOURCES = image2d-skel-with-end-points.cc image2d-skel.hh
+
+EXTRA_DIST = test-image2d-skel-unconstrained.in test-image2d-skel-with-end-points.in
+
+# Use Make to generate Doxyfile instead of `configure', as advised by
+# Autoconf's manual (see section ``Installation Directory
+# Variables'').
+edit = sed -e 's|@top_srcdir[@]|$(top_srcdir)|g'
+
+test-image2d-skel-unconstrained test-image2d-skel-with-end-points: Makefile
+ rm -f $@ $@.tmp
+ srcdir=''; \
+ test -f ./$@.in || srcdir=$(srcdir)/; \
+ $(edit) $${srcdir}$@.in >$@.tmp
+ chmod +x $@.tmp
+ chmod a-w $@.tmp
+ mv $@.tmp $@
+
+test-image2d-skel-unconstrained: $(srcdir)/test-image2d-skel-unconstrained.in
+test-image2d-skel-with-end-points: $(srcdir)/test-image2d-skel-with-end-points.in
+
+TESTS = test-image2d-skel-unconstrained test-image2d-skel-with-end-points
+CLEANFILES = test-image2d-skel-unconstrained test-image2d-skel-with-end-points
+
+MOSTLYCLEANFILES = \
+ picasso-skel-unconstrained.pbm \
+ picasso-skel-with-end-points.pbm \
+ tiny-skel-unconstrained.pbm \
+ tiny-skel-with-end-points.pbm
diff --git a/milena/apps/mesh-segm-skel/off-to-vtk-bin.cc b/milena/apps/generic-skel/image2d-skel-unconstrained.cc
similarity index 53%
copy from milena/apps/mesh-segm-skel/off-to-vtk-bin.cc
copy to milena/apps/generic-skel/image2d-skel-unconstrained.cc
index 926da7d..4459ba4 100644
--- a/milena/apps/mesh-segm-skel/off-to-vtk-bin.cc
+++ b/milena/apps/generic-skel/image2d-skel-unconstrained.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -26,22 +26,26 @@
// Public License.
/// \file
+/// \brief A program computing an unconstrained skeleton of a 2D image.
-/// \brief A program converting a binary OFF file (e.g. no value
-/// attached to faces) into a VTK file.
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
-#include <iostream>
+#include <mln/topo/skeleton/breadth_first_thinning.hh>
-#include <mln/io/off/load.hh>
-#include <mln/io/vtk/save.hh>
+#include <mln/io/pbm/all.hh>
+
+#include "image2d-skel.hh"
int
main(int argc, char* argv[])
{
+ using namespace mln;
+
if (argc != 3)
{
- std::cerr << "usage: " << argv[0] << " input.off output.vtk"
+ std::cerr << "usage: " << argv[0] << " input.pbm output.pbm"
<< std::endl;
std::exit(1);
}
@@ -49,12 +53,33 @@ main(int argc, char* argv[])
std::string input_filename = argv[1];
std::string output_filename = argv[2];
- typedef mln::bin_2complex_image3df ima_t;
- ima_t ima;
+ typedef image2d<bool> I;
+ typedef neighb2d N;
+
+ // Add a border of (at least) 1 pixel, to a guarantee a meaningful
+ // result of the computation of connectivity numbers (called within
+ // is_simple_2d); indeed, this computation always expects each pixel
+ // to have 8 neighboring sites.
+ border::thickness = 1;
+
+ I input = io::pbm::load(input_filename);
+
+ // FIXME: Use a dual neighborhood instead?
+
+ // Foreground neighborhood.
+ neighb2d nbh_fg = c4();
+ // Background neighborhood.
+ neighb2d nbh_bg = c8();
+
+ // Simplicity criterion functor.
+ ::is_simple_2d<I, N> is_simple(nbh_fg, nbh_bg);
+ // Detach procedure.
+ ::detach<I> detach;
+ // (Lack of) constraint.
+ fun::p2b::tautology constraint;
- // FIXME: Converting bunny-holefilled.off to VTK took 30 sec, which
- // is awfully slow. Time the load and save operations and find
- // where is (are) the issue(s).
- mln::io::off::load(ima, input_filename);
- mln::io::vtk::save(ima, output_filename);
+ I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
+ is_simple, detach,
+ constraint);
+ io::pbm::save(output, output_filename);
}
diff --git a/milena/apps/mesh-segm-skel/off-to-vtk-bin.cc b/milena/apps/generic-skel/image2d-skel-with-end-points.cc
similarity index 53%
copy from milena/apps/mesh-segm-skel/off-to-vtk-bin.cc
copy to milena/apps/generic-skel/image2d-skel-with-end-points.cc
index 926da7d..604b065 100644
--- a/milena/apps/mesh-segm-skel/off-to-vtk-bin.cc
+++ b/milena/apps/generic-skel/image2d-skel-with-end-points.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -26,22 +26,27 @@
// Public License.
/// \file
+/// \brief A program computing a skeleton of a 2D image, preserving
+/// end points.
-/// \brief A program converting a binary OFF file (e.g. no value
-/// attached to faces) into a VTK file.
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
-#include <iostream>
+#include <mln/topo/skeleton/breadth_first_thinning.hh>
-#include <mln/io/off/load.hh>
-#include <mln/io/vtk/save.hh>
+#include <mln/io/pbm/all.hh>
+
+#include "image2d-skel.hh"
int
main(int argc, char* argv[])
{
+ using namespace mln;
+
if (argc != 3)
{
- std::cerr << "usage: " << argv[0] << " input.off output.vtk"
+ std::cerr << "usage: " << argv[0] << " input.pbm output.pbm"
<< std::endl;
std::exit(1);
}
@@ -49,12 +54,31 @@ main(int argc, char* argv[])
std::string input_filename = argv[1];
std::string output_filename = argv[2];
- typedef mln::bin_2complex_image3df ima_t;
- ima_t ima;
+ typedef image2d<bool> I;
+ typedef neighb2d N;
+
+ // Add a border of (at least) 1 pixel, to a guarantee a meaningful
+ // result of the computation of connectivity numbers (called within
+ // is_simple_2d); indeed, this computation always expects each pixel
+ // to have 8 neighboring sites.
+ border::thickness = 1;
+
+ I input = io::pbm::load(input_filename);
+
+ // Foreground neighborhood.
+ neighb2d nbh_fg = c4();
+ // Background neighborhood.
+ neighb2d nbh_bg = c8();
+
+ // Simplicity criterion functor.
+ ::is_simple_2d<I, N> is_simple(nbh_fg, nbh_bg);
+ // Detach procedure.
+ ::detach<I> detach;
+ // Constraint: do not remove end points.
+ is_not_end_point<I, N> constraint(nbh_fg, input);
- // FIXME: Converting bunny-holefilled.off to VTK took 30 sec, which
- // is awfully slow. Time the load and save operations and find
- // where is (are) the issue(s).
- mln::io::off::load(ima, input_filename);
- mln::io::vtk::save(ima, output_filename);
+ I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
+ is_simple, detach,
+ constraint);
+ io::pbm::save(output, output_filename);
}
diff --git a/milena/apps/generic-skel/image2d-skel.hh b/milena/apps/generic-skel/image2d-skel.hh
new file mode 100644
index 0000000..6cd8c50
--- /dev/null
+++ b/milena/apps/generic-skel/image2d-skel.hh
@@ -0,0 +1,174 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Milena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef APPS_GENERIC_SKEL_IMAGE2D_SKEL_HH
+# define APPS_GENERIC_SKEL_IMAGE2D_SKEL_HH
+
+/// \file
+/// \brief Definitions for a simplicity criterion and a constraint
+/// to be used in the breadth-first thinning of a 2D regular image.
+
+# include <mln/topo/is_simple_2d.hh>
+
+
+// FIXME: Split this file?
+
+
+/** \brief An equivalent (for mln::image2d) of the
+ mln::topo::is_simple_cell functor, based on the mask-based
+ criterion mln::topo::is_simple_2d.
+
+ This functor acts as an adapter, since mln::topo::is_simple_2d
+ does not fit (yet) in the canvas of
+ mln::topo::skeleton::breadth_first_thinning. Moreover, this code
+ is a bit easier to read since it does not make use of a dual
+ neighborhood (having a long and complex type). */
+template <typename I, typename N>
+class is_simple_2d : public mln::Function_v2b< is_simple_2d<I, N> >
+{
+public:
+ /// Result type of the functor.
+ typedef bool result;
+
+ /// Build a functor.
+ ///
+ /// \param nbh_fg The foreground neighborhood.
+ /// \param nbh_bg The background neighborhood.
+ is_simple_2d(const mln::Neighborhood<N>& nbh_fg,
+ const mln::Neighborhood<N>& nbh_bg)
+ : nbh_fg_(mln::exact(nbh_fg)), nbh_bg_(mln::exact(nbh_bg)),
+ ima_(0)
+ {
+ }
+
+ /// Build a functor, and assign an image to it.
+ ///
+ /// \param nbh_fg The foreground neighborhood.
+ /// \param nbh_bg The background neighborhood.
+ /// \apram ima The image.
+ is_simple_2d(const mln::Neighborhood<N>& nbh_fg,
+ const mln::Neighborhood<N>& nbh_bg,
+ const mln::Image<I>& ima)
+ : nbh_fg_(mln::exact(nbh_fg)), nbh_bg_(mln::exact(nbh_bg)),
+ ima_(mln::exact(&ima))
+ {
+ }
+
+ /// Set the underlying image.
+ void set_image(const mln::Image<I>& ima)
+ {
+ ima_ = mln::exact(&ima);
+ }
+
+ /// Based on connectivity numbers.
+ bool operator()(const mln_psite(I)& p) const
+ {
+ return
+ mln::connectivity_number_2d(*ima_, nbh_fg_, p, true ) == 1 &&
+ mln::connectivity_number_2d(*ima_, nbh_bg_, p, false) == 1;
+ }
+
+private:
+ /// The foreground neighborhood.
+ const N& nbh_fg_;
+ /// The background neighborhood.
+ const N& nbh_bg_;
+ /// The image.
+ const I* ima_;
+};
+
+
+template <typename I>
+class detach
+{
+public:
+ /// Build a functor.
+ detach()
+ : ima_(0)
+ {
+ }
+
+ /// Build a functor, and assign an image to it.
+ ///
+ /// \apram ima The image.
+ detach(mln::Image<I>& ima)
+ : ima_(mln::exact(&ima))
+ {
+ }
+
+ /// Set the underlying image.
+ void set_image(mln::Image<I>& ima)
+ {
+ ima_ = mln::exact(&ima);
+ }
+
+ void operator()(const mln_psite(I)& p) const
+ {
+ (*ima_)(p) = false;
+ }
+
+private:
+ /// The image.
+ I* ima_;
+};
+
+
+template <typename I, typename N>
+struct is_not_end_point : public mln::Function_v2b< is_not_end_point<I, N> >
+{
+ /// Build a functor, and assign an image to it.
+ ///
+ /// \param nbh_fg The foreground neighborhood.
+ /// \apram ima The image.
+ is_not_end_point(const mln::Neighborhood<N>& nbh,
+ const mln::Image<I>& ima)
+ : nbh_(mln::exact(nbh)),
+ ima_(mln::exact(ima))
+ {
+ }
+
+ // Is \a p not a end point?
+ bool operator()(const mln_psite(I)& p) const
+ {
+ // Number of foreground neighbors pixels.
+ unsigned nneighbs = 0;
+ mln_niter(N) n(nbh_, p);
+ for_all(n)
+ if (ima_.has(n) && ima_(n))
+ ++nneighbs;
+ return nneighbs != 1;
+ }
+
+private:
+ /// The foreground neighborhood.
+ const N& nbh_;
+ /// The image.
+ const I& ima_;
+};
+
+
+#endif // ! APPS_GENERIC_SKEL_IMAGE2D_SKEL_HH
diff --git a/milena/apps/mesh-segm-skel/test-mesh-complex-2-collapse.in b/milena/apps/generic-skel/test-image2d-skel-unconstrained.in
similarity index 71%
copy from milena/apps/mesh-segm-skel/test-mesh-complex-2-collapse.in
copy to milena/apps/generic-skel/test-image2d-skel-unconstrained.in
index d2a286b..b9f6b44 100644
--- a/milena/apps/mesh-segm-skel/test-mesh-complex-2-collapse.in
+++ b/milena/apps/generic-skel/test-image2d-skel-unconstrained.in
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -18,6 +18,7 @@
set -ex
-mesh_dir=@top_srcdir@/milena/mesh
+img_dir=@top_srcdir@/milena/img
-time ./mesh-complex-2-collapse $mesh_dir/pseudo-manifold.vtk pseudo-manifold-2-collapse.vtk
+./image2d-skel-unconstrained $img_dir/tiny.pbm tiny-skel-unconstrained.pbm
+./image2d-skel-unconstrained $img_dir/picasso.pbm picasso-skel-unconstrained.pbm
diff --git a/milena/apps/mesh-segm-skel/test-mesh-complex-2-collapse.in b/milena/apps/generic-skel/test-image2d-skel-with-end-points.in
similarity index 70%
copy from milena/apps/mesh-segm-skel/test-mesh-complex-2-collapse.in
copy to milena/apps/generic-skel/test-image2d-skel-with-end-points.in
index d2a286b..946e8fd 100644
--- a/milena/apps/mesh-segm-skel/test-mesh-complex-2-collapse.in
+++ b/milena/apps/generic-skel/test-image2d-skel-with-end-points.in
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -18,6 +18,7 @@
set -ex
-mesh_dir=@top_srcdir@/milena/mesh
+img_dir=@top_srcdir@/milena/img
-time ./mesh-complex-2-collapse $mesh_dir/pseudo-manifold.vtk pseudo-manifold-2-collapse.vtk
+./image2d-skel-with-end-points $img_dir/tiny.pbm tiny-skel-with-end-points.pbm
+./image2d-skel-with-end-points $img_dir/picasso.pbm picasso-skel-with-end-points.pbm
--
1.5.6.5
1
0