* scribo/debug/save_bboxes_image.hh,
* scribo/debug/save_linked_bboxes_image.hh: Rename as...
* scribo/debug/bboxes_image.hh,
* scribo/debug/linked_bboxes_image.hh: ... this.
* scribo/debug/links_image.hh: New.
* scribo/debug/several_links_decision_image.hh:
Remove. Deprecated.
* scribo/debug/alignment_decision_image.hh: Make use of
compute_anchor routine.
* scribo/debug/all.hh,
* scribo/table/extract.hh,
* scribo/toolchain/text_in_picture.hh,
* src/debug/show_links_several_right_overlap.cc,
* src/debug/show_links_single_down.cc,
* src/debug/show_links_single_down_left_aligned.cc,
* src/debug/show_links_single_down_right_aligned.cc,
* src/debug/show_links_single_left.cc,
* src/debug/show_links_single_left_dmax_ratio.cc,
* src/debug/show_links_single_right.cc,
* src/debug/show_links_single_right_dmax_ratio.cc,
* src/debug/show_links_single_up.cc,
* src/debug/show_links_single_up_left_aligned.cc,
* src/debug/show_links_single_up_right_aligned.cc,
* src/debug/show_separators.cc,
* src/primitive/group/group_from_double_link.cc,
* src/primitive/group/group_from_double_several_links.cc,
* src/primitive/group/group_from_several_left_links.cc,
* src/primitive/group/group_from_single_link.cc,
* src/text_in_picture.cc,
* src/text_in_picture_neg.cc,
* src/text_recognition_in_picture.cc,
* tests/filter/components_large.cc,
* tests/filter/components_small.cc: Update includes.
---
scribo/ChangeLog | 34 +++
scribo/scribo/debug/alignment_decision_image.hh | 87 ++-------
scribo/scribo/debug/all.hh | 7 +-
.../{save_bboxes_image.hh => bboxes_image.hh} | 82 ++++----
...nked_bboxes_image.hh => linked_bboxes_image.hh} | 213 +++++++++-----------
.../{links_decision_image.hh => links_image.hh} | 77 ++++----
.../scribo/debug/several_links_decision_image.hh | 179 ----------------
scribo/scribo/table/extract.hh | 6 +-
scribo/scribo/toolchain/text_in_picture.hh | 20 +-
.../src/debug/show_links_several_right_overlap.cc | 6 +-
scribo/src/debug/show_links_single_down.cc | 5 +-
.../debug/show_links_single_down_left_aligned.cc | 11 +-
.../debug/show_links_single_down_right_aligned.cc | 14 +-
scribo/src/debug/show_links_single_left.cc | 5 +-
.../src/debug/show_links_single_left_dmax_ratio.cc | 5 +-
scribo/src/debug/show_links_single_right.cc | 5 +-
.../debug/show_links_single_right_dmax_ratio.cc | 5 +-
scribo/src/debug/show_links_single_up.cc | 5 +-
.../src/debug/show_links_single_up_left_aligned.cc | 15 +-
.../debug/show_links_single_up_right_aligned.cc | 15 +-
scribo/src/debug/show_separators.cc | 6 +-
.../src/primitive/group/group_from_double_link.cc | 28 ++--
.../group/group_from_double_several_links.cc | 25 ++-
.../group/group_from_several_left_links.cc | 23 +-
.../src/primitive/group/group_from_single_link.cc | 36 ++--
scribo/src/text_in_picture.cc | 17 +-
scribo/src/text_in_picture_neg.cc | 2 -
scribo/src/text_recognition_in_picture.cc | 2 -
scribo/tests/filter/components_large.cc | 8 +-
scribo/tests/filter/components_small.cc | 8 +-
30 files changed, 357 insertions(+), 594 deletions(-)
rename scribo/scribo/debug/{save_bboxes_image.hh => bboxes_image.hh} (65%)
rename scribo/scribo/debug/{save_linked_bboxes_image.hh => linked_bboxes_image.hh}
(54%)
copy scribo/scribo/debug/{links_decision_image.hh => links_image.hh} (58%)
delete mode 100644 scribo/scribo/debug/several_links_decision_image.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 32a53f7..8de7299 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,37 @@
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Rename debug routines.
+
+ * scribo/debug/save_bboxes_image.hh,
+ * scribo/debug/save_linked_bboxes_image.hh: Rename as...
+ * scribo/debug/bboxes_image.hh,
+ * scribo/debug/linked_bboxes_image.hh: ... this.
+
+ * scribo/debug/all.hh,
+ * scribo/table/extract.hh,
+ * scribo/toolchain/text_in_picture.hh,
+ * src/debug/show_links_several_right_overlap.cc,
+ * src/debug/show_links_single_down.cc,
+ * src/debug/show_links_single_down_left_aligned.cc,
+ * src/debug/show_links_single_down_right_aligned.cc,
+ * src/debug/show_links_single_left.cc,
+ * src/debug/show_links_single_left_dmax_ratio.cc,
+ * src/debug/show_links_single_right.cc,
+ * src/debug/show_links_single_right_dmax_ratio.cc,
+ * src/debug/show_links_single_up.cc,
+ * src/debug/show_links_single_up_left_aligned.cc,
+ * src/debug/show_links_single_up_right_aligned.cc,
+ * src/debug/show_separators.cc,
+ * src/primitive/group/group_from_double_link.cc,
+ * src/primitive/group/group_from_double_several_links.cc,
+ * src/primitive/group/group_from_several_left_links.cc,
+ * src/primitive/group/group_from_single_link.cc,
+ * src/text_in_picture.cc,
+ * src/text_in_picture_neg.cc,
+ * src/text_recognition_in_picture.cc,
+ * tests/filter/components_large.cc,
+ * tests/filter/components_small.cc: Update includes.
+
2011-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
Add HAVE_QT guards.
diff --git a/scribo/scribo/debug/alignment_decision_image.hh
b/scribo/scribo/debug/alignment_decision_image.hh
index 841bd38..450091d 100644
--- a/scribo/scribo/debug/alignment_decision_image.hh
+++ b/scribo/scribo/debug/alignment_decision_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.
//
@@ -36,12 +37,12 @@
# include <mln/literal/colors.hh>
# include <mln/util/array.hh>
# include <mln/util/couple.hh>
-# include <mln/norm/l1.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/object_groups.hh>
# include <scribo/draw/bounding_boxes.hh>
+# include <scribo/primitive/link/internal/compute_anchor.hh>
namespace scribo
{
@@ -51,8 +52,6 @@ namespace scribo
using namespace mln;
- enum Alignment { top, center, bottom };
-
/*! \brief Save a color image showing the difference between to
object links.
@@ -70,54 +69,17 @@ namespace scribo
alignment_decision_image(const Image<I>& input_,
const object_links<L>& links,
const object_links<L>& filtered_links,
- const Alignment& alignment);
+ const anchor::Type& anchor);
# ifndef MLN_INCLUDE_ONLY
-
- namespace internal
- {
-
- template <typename L>
- mln::util::couple<mln_site(L),mln_site(L)>
- find_anchors(const component_set<L>& components,
- unsigned i,
- unsigned link_i,
- const Alignment& alignment)
- {
- mln_site(L)
- a1 = components(i).bbox().pcenter(),
- a2 = components(link_i).bbox().pcenter();
-
- switch (alignment)
- {
- case top:
- a1.row() = components(i).bbox().pmin().row();
- a2.row() = components(link_i).bbox().pmin().row();
- break;
-
- case center:
- break;
-
- case bottom:
- a1.row() = components(i).bbox().pmax().row();
- a2.row() = components(link_i).bbox().pmax().row();
- break;
-
- }
- return make::couple(a1, a2);
- }
-
- }
-
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- alignment_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links,
- const Alignment& alignment,
- unsigned max_link_length)
+ alignment_decision_image(const Image<I>& input_,
+ const object_links<L>& links,
+ const object_links<L>& filtered_links,
+ const anchor::Type& anchor)
{
trace::entering("scribo::debug::alignment_decision_image");
const I& input = exact(input_);
@@ -138,43 +100,26 @@ namespace scribo
typedef mln_site(L) P;
for_all_links(i, links)
- {
if (links(i) != i)
{
value::rgb8 value = literal::green;
+ P
+ anchor_i = primitive::link::internal::compute_anchor(components,
+ i, anchor),
+ anchor_li = primitive::link::internal::compute_anchor(components,
+ links(i),
+ anchor);
+
if (links(i) != filtered_links(i))
value = literal::red;
- mln::util::couple<P,P>
- anchors = internal::find_anchors(components, i, links(i), alignment);
- if (mln::norm::l1_distance(anchors.first().to_vec(), anchors.second().to_vec()) <
max_link_length)
- mln::draw::line(decision_image,
- anchors.first(),
- anchors.second(),
- value);
+ mln::draw::line(decision_image, anchor_i, anchor_li, value);
}
- }
trace::exiting("scribo::debug::alignment_decision_image");
return decision_image;
}
-
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- alignment_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links,
- const Alignment& alignment)
- {
- return alignment_decision_image(input_,
- links,
- filtered_links,
- alignment,
- mln_max(unsigned));
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::debug
diff --git a/scribo/scribo/debug/all.hh b/scribo/scribo/debug/all.hh
index f7ffe1c..7181ec1 100644
--- a/scribo/scribo/debug/all.hh
+++ b/scribo/scribo/debug/all.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.
//
@@ -41,9 +42,9 @@ namespace scribo
} // end of namespace scribo
-# include <scribo/debug/save_bboxes_image.hh>
+# include <scribo/debug/bboxes_image.hh>
# include <scribo/debug/save_label_image.hh>
-# include <scribo/debug/save_linked_bboxes_image.hh>
+# include <scribo/debug/linked_bboxes_image.hh>
# include <scribo/debug/save_table_image.hh>
#endif // ! SCRIBO_DEBUG_ALL_HH
diff --git a/scribo/scribo/debug/save_bboxes_image.hh
b/scribo/scribo/debug/bboxes_image.hh
similarity index 65%
rename from scribo/scribo/debug/save_bboxes_image.hh
rename to scribo/scribo/debug/bboxes_image.hh
index ee781c1..ca3d646 100644
--- a/scribo/scribo/debug/save_bboxes_image.hh
+++ b/scribo/scribo/debug/bboxes_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.
//
@@ -24,8 +24,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
-# define SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
+#ifndef SCRIBO_DEBUG_BBOXES_IMAGE_HH
+# define SCRIBO_DEBUG_BBOXES_IMAGE_HH
/// \file
///
@@ -53,18 +53,16 @@ namespace scribo
/// Draw a list of bounding boxes
template <typename I>
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const mln::util::array< box<mln_site(I)> >& bboxes,
- const std::string& filename,
const value::rgb8& value);
template <typename I, typename L>
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const line_set<L>& lines,
- const std::string& filename,
const value::rgb8& value);
/// \overload
@@ -72,50 +70,46 @@ namespace scribo
//
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const std::string& filename);
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const line_set<L>& lines);
/// \overload.
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const component_set<L>& comps,
- const std::string& filename,
const value::rgb8& value);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const mln::util::array< box<mln_site(I)> >& bboxes,
- const std::string& filename,
- const value::rgb8& value)
+ 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)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
draw::bounding_boxes(tmp, bboxes, value);
- mln::io::ppm::save(tmp, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return tmp;
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const line_set<L>& lines,
- const std::string& filename,
const value::rgb8& value)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I, value::rgb8)
@@ -125,31 +119,29 @@ namespace scribo
if (! lines(l).is_hidden())
mln::draw::box(output, lines(l).bbox(), value);
- mln::io::ppm::save(output, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return output;
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const std::string& filename)
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const line_set<L>& lines)
{
- return save_bboxes_image(input, lines, filename, literal::red);
+ return bboxes_image(input, lines, literal::red);
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const component_set<L>& comps,
- const std::string& filename,
- const value::rgb8& value)
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const component_set<L>& comps,
+ const value::rgb8& value)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I, value::rgb8)
@@ -159,8 +151,8 @@ namespace scribo
if (comps(c).is_valid())
mln::draw::box(output, comps(c).bbox(), value);
- mln::io::ppm::save(output, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return output;
}
@@ -171,4 +163,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_BBOXES_IMAGE_HH
diff --git a/scribo/scribo/debug/save_linked_bboxes_image.hh
b/scribo/scribo/debug/linked_bboxes_image.hh
similarity index 54%
rename from scribo/scribo/debug/save_linked_bboxes_image.hh
rename to scribo/scribo/debug/linked_bboxes_image.hh
index d4c940a..2373405 100644
--- a/scribo/scribo/debug/save_linked_bboxes_image.hh
+++ b/scribo/scribo/debug/linked_bboxes_image.hh
@@ -24,12 +24,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
-# define SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
+#ifndef SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
+# define SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
/// \file
///
-/// Save the bounding box links image.
+/// Compute the bounding box links image.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/graph.hh>
@@ -56,54 +56,50 @@ namespace scribo
using namespace mln;
- /// Save the line of components links image.
+ /// Compute the line of components links image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] link_array Lines of components links.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
/// \param[in] anchor Anchor from where the links are drawn.
//
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& array,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& array,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
/// \overload
/// The default anchor type is set to anchor::Center.
//
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& array,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- const std::string& filename);
-
- /// Save the line of components left and right links image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& array,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value);
+
+ /// Compute the line of components left and right links image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] left_link Lines of components left links.
/// \param[in] right_link Lines of components right links.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
-
- /// Save the line of components left and right links image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
+
+ /// Compute the line of components left and right links image.
/// Draw also validated links.
///
/// \param[in,out] input The binary from where the components are extracted.
@@ -113,36 +109,34 @@ namespace scribo
/// \param[in] left_link_value Value used to draw line left links.
/// \param[in] right_link_value Value used to draw line left links.
/// \param[in] validated_link_value Value used to draw line validated links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& left_link_value,
- const value::rgb8& right_link_value,
- const value::rgb8& validated_link_value,
- anchor::Type anchor,
- const std::string& filename);
-
-
- /// Save the line link graph image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& left_link_value,
+ const value::rgb8& right_link_value,
+ const value::rgb8& validated_link_value,
+ anchor::Type anchor);
+
+
+ /// Compute the line link graph image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] g The link graph.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L, typename G>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const Graph<G>& g,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const Graph<G>& g,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
# ifndef MLN_INCLUDE_ONLY
@@ -150,15 +144,14 @@ namespace scribo
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& links,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& links,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
@@ -166,63 +159,58 @@ namespace scribo
draw::bounding_boxes(tmp, links.components(), box_value);
draw::bounding_box_links(tmp, links, link_value, anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& links,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& links,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value)
{
- save_linked_bboxes_image(input, links, box_value,
- link_value, anchor::Center, filename);
+ return linked_bboxes_image(input, links, box_value,
+ link_value, anchor::Center);
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& value,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& value)
{
- save_linked_bboxes_image(input,
- left_link,
- right_link,
- box_value,
- literal::yellow,
- literal::cyan,
- value,
- anchor::Center,
- filename);
+ return linked_bboxes_image(input,
+ left_link,
+ right_link,
+ box_value,
+ literal::yellow,
+ literal::cyan,
+ value,
+ anchor::Center);
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& left_link_value,
- const value::rgb8& right_link_value,
- const value::rgb8& validated_link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& left_link_value,
+ const value::rgb8& right_link_value,
+ const value::rgb8& validated_link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
@@ -234,24 +222,22 @@ namespace scribo
validated_link_value,
anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
template <typename I, typename L, typename G>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const Graph<G>& g,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const Graph<G>& g,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(g).is_valid());
mln_precondition(exact(input).is_valid());
@@ -261,9 +247,8 @@ namespace scribo
draw::bounding_box_links(tmp, exact(g).components(), g, link_value,
anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
@@ -274,4 +259,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
diff --git a/scribo/scribo/debug/links_decision_image.hh
b/scribo/scribo/debug/links_image.hh
similarity index 58%
copy from scribo/scribo/debug/links_decision_image.hh
copy to scribo/scribo/debug/links_image.hh
index 387cd7f..76447b7 100644
--- a/scribo/scribo/debug/links_decision_image.hh
+++ b/scribo/scribo/debug/links_image.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,21 +23,23 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
-# define SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
+#ifndef SCRIBO_DEBUG_LINKS_IMAGE_HH
+# define SCRIBO_DEBUG_LINKS_IMAGE_HH
/// \file
///
-/// Save a color image showing the difference between to object groups.
+/// Save a color image showing components links.
# include <mln/core/concept/image.hh>
+# include <mln/accu/center.hh>
# include <mln/data/convert.hh>
# include <mln/value/rgb8.hh>
# include <mln/literal/colors.hh>
-# include <mln/draw/box.hh>
# include <mln/draw/line.hh>
# include <scribo/core/object_links.hh>
+# include <scribo/draw/bounding_boxes.hh>
+# include <scribo/primitive/link/internal/compute_anchor.hh>
namespace scribo
@@ -52,52 +53,46 @@ namespace scribo
/// FIXME: DOC!
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links);
+ links_image(const Image<I>& input_,
+ const object_links<L>& links,
+ anchor::Type anchor);
+
# ifndef MLN_INCLUDE_ONLY
+
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links)
+ links_image(const Image<I>& input_,
+ const object_links<L>& links,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::links_decision_image");
+ trace::entering("scribo::debug::links_image");
const I& input = exact(input_);
- const component_set<L>& comps = links.components();
-
mln_precondition(input.is_valid());
- mln_precondition(comps.is_valid());
mln_precondition(links.is_valid());
- mln_precondition(filtered_links.is_valid());
- mln_precondition(links.size() == filtered_links.size());
- /// Fixme: check that objects has been computed from input.
-
- image2d<value::rgb8>
- links_decision_image = data::convert(value::rgb8(), input);
- for_all_comps(i, comps)
- mln::draw::box(links_decision_image, comps(i).bbox(), literal::blue);
-
- for_all_links(i, links)
- if (links(i) != i)
- {
- value::rgb8 value = literal::green;
- if (links(i) != filtered_links(i))
- value = literal::red;
-
- mln_site(I)
- p1 = comps(i).mass_center(),
- p2 = comps(links(i)).mass_center();
-
- mln::draw::line(links_decision_image, p1, p2, value);
- }
+ const component_set<L>& comps = links.components();
- trace::exiting("scribo::debug::links_decision_image");
- return links_decision_image;
+ image2d<value::rgb8>
+ links_image = data::convert(value::rgb8(), input);
+
+ scribo::draw::bounding_boxes(links_image, comps, literal::blue);
+
+ for_all_links(l, links)
+ if (links(l) != l)
+ mln::draw::line(links_image,
+ primitive::link::internal::compute_anchor(comps,
+ l,
+ anchor),
+ primitive::link::internal::compute_anchor(comps,
+ links(l),
+ anchor),
+ literal::green);
+
+ trace::exiting("scribo::debug::links_image");
+ return links_image;
}
@@ -108,4 +103,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_LINKS_IMAGE_HH
diff --git a/scribo/scribo/debug/several_links_decision_image.hh
b/scribo/scribo/debug/several_links_decision_image.hh
deleted file mode 100644
index 73e66a1..0000000
--- a/scribo/scribo/debug/several_links_decision_image.hh
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
-# define SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
-
-/// \file
-///
-/// Save a color image showing the difference between to object groups.
-
-# include <mln/core/concept/image.hh>
-# include <mln/accu/center.hh>
-# include <mln/data/convert.hh>
-# include <mln/value/rgb8.hh>
-# include <mln/literal/colors.hh>
-# include <mln/util/array.hh>
-
-# include <scribo/core/object_groups.hh>
-# include <scribo/draw/bounding_boxes.hh>
-
-
-namespace scribo
-{
-
- namespace debug
- {
-
- using namespace mln;
-
- /// FIXME: DOC!
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- several_links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
-
- namespace internal
- {
-
- template <typename L, typename I>
- bool
- draw_line(const L& objects, I& output,
- unsigned link,
- const mln_site(L)& p1, const mln_site(L)& p2,
- const mln_value(I)& value)
- {
-
- if (objects.domain().has(p2))
- if (objects(p2) == link)
- {
- mln::draw::line(output, p1, p2, value);
- return true;
- }
- return false;
- }
-
- }
-
-
-
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- several_links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links)
- {
- trace::entering("scribo::debug::several_links_decision_image");
- const I& input = exact(input_);
-
- const component_set<L>& comps = links.components();
-
- mln_precondition(input.is_valid());
- mln_precondition(links.is_valid());
- mln_precondition(filtered_links.is_valid());
-
- /// Fixme: check that objects has been computed from input.
-
- image2d<value::rgb8>
- links_decision_image = data::convert(value::rgb8(), input);
-
- for_all_comps(c, comps)
- mln::draw::box(links_decision_image, comps(c).bbox(), literal::blue);
-
- for_all_links(l, links)
- {
- if (links(l) != l)
- {
- value::rgb8 value = literal::green;
- if (links(l) != filtered_links(l))
- value = literal::red;
-
- mln_site(L) c = comps(l).bbox().pcenter();
-
- // Right link from the top anchor.
- mln_site(L) a1 = c;
- a1.row() = comps(l).bbox().pmin().row()
- + (c.row() - comps(l).bbox().pmin().row()) / 4;
-
- // Right link from the central site
- mln_site(I) p1 = comps(l).mass_center();
-
- // Right link from the bottom anchor.
- mln_site(L) a2 = c;
- a2.row() = comps(l).bbox().pmax().row()
- - (c.row() - comps(l).bbox().pmin().row()) / 4;
-
- mln_site(L)
- a1_bak = a1,
- a2_bak = a2;
-
- const L& lbl_ima = comps.labeled_image();
-
- mln_site(L) tmp;
- while(lbl_ima.domain().has(a1)
- || lbl_ima.domain().has(a2)
- || lbl_ima.domain().has(p1))
- {
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- a1_bak, a1, value))
- break;
- else
- ++a1.col();
-
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- comps(l).mass_center(), p1, value))
- break;
- else
- ++p1.col();
-
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- a2_bak, a2, value))
- break;
- else
- ++a2.col();
-
- }
- }
- }
-
- trace::exiting("scribo::debug::several_links_decision_image");
- return links_decision_image;
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::debug
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
diff --git a/scribo/scribo/table/extract.hh b/scribo/scribo/table/extract.hh
index 49a7d50..a87667f 100644
--- a/scribo/scribo/table/extract.hh
+++ b/scribo/scribo/table/extract.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.
//
@@ -45,8 +45,6 @@
# include <scribo/primitive/extract/lines_v_pattern.hh>
# include <scribo/primitive/extract/components.hh>
-# include <scribo/debug/save_bboxes_image.hh>
-
namespace scribo
{
diff --git a/scribo/scribo/toolchain/text_in_picture.hh
b/scribo/scribo/toolchain/text_in_picture.hh
index 9746645..42e69db 100644
--- a/scribo/scribo/toolchain/text_in_picture.hh
+++ b/scribo/scribo/toolchain/text_in_picture.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.
//
@@ -74,7 +74,7 @@
# include <scribo/filter/object_groups_v_thickness.hh>
# include <scribo/debug/decision_image.hh>
-# include <scribo/debug/save_linked_bboxes_image.hh>
+# include <scribo/debug/linked_bboxes_image.hh>
# include <scribo/debug/usage.hh>
@@ -321,13 +321,13 @@ namespace scribo
if (debug)
{
std::cerr << "BEFORE - ncomponents = " <<
filtered_components.nelements() << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan,
- literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
}
#endif
diff --git a/scribo/src/debug/show_links_several_right_overlap.cc
b/scribo/src/debug/show_links_several_right_overlap.cc
index ae27e55..5559fec 100644
--- a/scribo/src/debug/show_links_several_right_overlap.cc
+++ b/scribo/src/debug/show_links_several_right_overlap.cc
@@ -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.
//
@@ -48,8 +48,6 @@
#include <scribo/primitive/link/compute_several.hh>
#include <scribo/draw/bounding_boxes.hh>
-
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_down.cc
b/scribo/src/debug/show_links_single_down.cc
index f1ed130..8ea3d6a 100644
--- a/scribo/src/debug/show_links_single_down.cc
+++ b/scribo/src/debug/show_links_single_down.cc
@@ -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.
//
@@ -46,7 +46,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_down_left_aligned.cc
b/scribo/src/debug/show_links_single_down_left_aligned.cc
index ea31db7..5804799 100644
--- a/scribo/src/debug/show_links_single_down_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_left_aligned.cc
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -94,8 +94,9 @@ int main(int argc, char* argv[])
down_links = filter::object_links_left_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, down_links,
- literal::blue, literal::green,
- anchor::ActualLeft,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, down_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictLeft),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_down_right_aligned.cc
b/scribo/src/debug/show_links_single_down_right_aligned.cc
index d261e5c..38cc335 100644
--- a/scribo/src/debug/show_links_single_down_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_right_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -95,8 +95,8 @@ int main(int argc, char* argv[])
down_links = filter::object_links_right_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, down_links,
- literal::blue, literal::green,
- anchor::ActualRight,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, down_links,
+ literal::blue, literal::green,
+ anchor::StrictRight),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_left.cc
b/scribo/src/debug/show_links_single_left.cc
index 2211ce1..dfcb07b 100644
--- a/scribo/src/debug/show_links_single_left.cc
+++ b/scribo/src/debug/show_links_single_left.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_left_dmax_ratio.cc
b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
index 9b48a42..c1d6b01 100644
--- a/scribo/src/debug/show_links_single_left_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_right.cc
b/scribo/src/debug/show_links_single_right.cc
index 2392e62..9b37c44 100644
--- a/scribo/src/debug/show_links_single_right.cc
+++ b/scribo/src/debug/show_links_single_right.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_right_dmax_ratio.cc
b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
index 5b292ed..133fe82 100644
--- a/scribo/src/debug/show_links_single_right_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_up.cc
b/scribo/src/debug/show_links_single_up.cc
index db9d3e7..1933af1 100644
--- a/scribo/src/debug/show_links_single_up.cc
+++ b/scribo/src/debug/show_links_single_up.cc
@@ -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.
//
@@ -46,7 +46,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_up_left_aligned.cc
b/scribo/src/debug/show_links_single_up_left_aligned.cc
index d0df1e4..839aad8 100644
--- a/scribo/src/debug/show_links_single_up_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_left_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -96,8 +96,9 @@ int main(int argc, char* argv[])
up_links = filter::object_links_left_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, up_links,
- literal::blue, literal::green,
- anchor::ActualLeft,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, up_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictLeft),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_up_right_aligned.cc
b/scribo/src/debug/show_links_single_up_right_aligned.cc
index 3f40daf..561fbe9 100644
--- a/scribo/src/debug/show_links_single_up_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_right_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -94,8 +94,9 @@ int main(int argc, char* argv[])
up_links = filter::object_links_right_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, up_links,
- literal::blue, literal::green,
- anchor::ActualRight,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, up_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictRight),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_separators.cc b/scribo/src/debug/show_separators.cc
index ef80da6..40e2fde 100644
--- a/scribo/src/debug/show_separators.cc
+++ b/scribo/src/debug/show_separators.cc
@@ -18,13 +18,15 @@
#include <mln/core/alias/box2d.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/io/pbm/all.hh>
+#include <mln/io/ppm/save.hh>
#include <mln/arith/plus.hh>
#include <mln/labeling/foreground.hh>
+#include <mln/labeling/compute.hh>
#include <scribo/primitive/extract/lines_h_pattern.hh>
#include <scribo/primitive/extract/lines_v_pattern.hh>
#include <scribo/debug/usage.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
const char *args_desc[][2] =
@@ -90,7 +92,7 @@ int main(int argc, char *argv[])
image2d<value::int_u8> lbl = labeling::foreground(v_lines, c4(), nlabels);
mln::util::array<box2d>
bbox = labeling::compute(accu::shape::bbox<point2d>(), lbl, nlabels);
- scribo::debug::save_bboxes_image(input, bbox, argv[4], literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, bbox, literal::red), argv[4]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/group/group_from_double_link.cc
b/scribo/src/primitive/group/group_from_double_link.cc
index 39b1bb9..ec4e180 100644
--- a/scribo/src/primitive/group/group_from_double_link.cc
+++ b/scribo/src/primitive/group/group_from_double_link.cc
@@ -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.
//
@@ -41,11 +41,11 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -95,12 +95,14 @@ int main(int argc, char *argv[])
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan, literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red,
+ literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
// With validation.
object_groups<L> groups
@@ -116,8 +118,8 @@ int main(int argc, char *argv[])
std::cout << "AFTER double grouping - nbboxes = "
<< grouped_text.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_text,
- scribo::make::debug_filename("bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_text,
+ literal::red),
+ scribo::make::debug_filename("bboxes.ppm"));
}
diff --git a/scribo/src/primitive/group/group_from_double_several_links.cc
b/scribo/src/primitive/group/group_from_double_several_links.cc
index 2a49b33..86b3cf4 100644
--- a/scribo/src/primitive/group/group_from_double_several_links.cc
+++ b/scribo/src/primitive/group/group_from_double_several_links.cc
@@ -41,11 +41,11 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/link/with_several_right_links.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -89,12 +89,15 @@ int main(int argc, char* argv[])
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan, literal::yellow,
- literal::green,
- anchor::Center,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ right_link,
+ literal::red,
+ literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::Center),
+ scribo::make::debug_filename("links.ppm"));
// With validation.
std::cout << "Group from double link" << std::endl;
@@ -111,8 +114,8 @@ int main(int argc, char* argv[])
std::cout << "AFTER double grouping - nbboxes = " <<
grouped_comps.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("bboxes.ppm"));
}
diff --git a/scribo/src/primitive/group/group_from_several_left_links.cc
b/scribo/src/primitive/group/group_from_several_left_links.cc
index ef70a19..42ad98a 100644
--- a/scribo/src/primitive/group/group_from_several_left_links.cc
+++ b/scribo/src/primitive/group/group_from_several_left_links.cc
@@ -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.
//
@@ -46,8 +46,8 @@
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/group/from_single_link.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -80,10 +80,11 @@ int main(int argc, char* argv[])
= primitive::link::with_several_left_links(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("left_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ literal::red,
+ literal::cyan),
+ scribo::make::debug_filename("left_links.ppm"));
object_groups<L>
@@ -96,9 +97,9 @@ int main(int argc, char* argv[])
grouped_comps.labeled_image(),
grouped_comps.nelements()),
scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("left_bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("left_bboxes.ppm"));
}
}
diff --git a/scribo/src/primitive/group/group_from_single_link.cc
b/scribo/src/primitive/group/group_from_single_link.cc
index 5b5f710..fc904a0 100644
--- a/scribo/src/primitive/group/group_from_single_link.cc
+++ b/scribo/src/primitive/group/group_from_single_link.cc
@@ -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.
//
@@ -44,8 +44,8 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/primitive/group/apply.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -80,10 +80,11 @@ int main(int argc, char* argv[])
= primitive::link::with_single_left_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("left_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ literal::red,
+ literal::cyan),
+ scribo::make::debug_filename("left_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
// comps,
// comps.nlabels()),
@@ -99,8 +100,9 @@ int main(int argc, char* argv[])
grouped_comps.labeled_image(),
grouped_comps.nelements()),
scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("left_bboxes.ppm"), literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("left_bboxes.ppm"));
}
{
@@ -109,10 +111,10 @@ int main(int argc, char* argv[])
= primitive::link::with_single_right_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- right_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("right_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ right_link,
+ literal::red, literal::cyan),
+ scribo::make::debug_filename("right_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
// comps,
// comps.nlabels()),
@@ -129,9 +131,9 @@ int main(int argc, char* argv[])
scribo::make::debug_filename("right_label_color.ppm"));
std::cout << "AFTER - nbboxes = " << grouped_comps.nelements()
<< std::endl;
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("right_bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("right_bboxes.ppm"));
}
diff --git a/scribo/src/text_in_picture.cc b/scribo/src/text_in_picture.cc
index 77cf7b6..af00c4f 100644
--- a/scribo/src/text_in_picture.cc
+++ b/scribo/src/text_in_picture.cc
@@ -75,8 +75,7 @@
#include <scribo/debug/text_areas_image.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -342,13 +341,13 @@ int main(int argc, char* argv[])
if (debug)
{
std::cerr << "BEFORE - ncomponents = " <<
filtered_components.nelements() << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan,
- literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
}
#endif
diff --git a/scribo/src/text_in_picture_neg.cc b/scribo/src/text_in_picture_neg.cc
index 8d818e0..2b06a72 100644
--- a/scribo/src/text_in_picture_neg.cc
+++ b/scribo/src/text_in_picture_neg.cc
@@ -92,8 +92,6 @@
#include <scribo/debug/text_areas_image.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/text_recognition_in_picture.cc
b/scribo/src/text_recognition_in_picture.cc
index 8b76f48..de7a9ed 100644
--- a/scribo/src/text_recognition_in_picture.cc
+++ b/scribo/src/text_recognition_in_picture.cc
@@ -95,8 +95,6 @@
#include <scribo/debug/highlight_text_area.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/tests/filter/components_large.cc
b/scribo/tests/filter/components_large.cc
index 543b90d..4a7a10b 100644
--- a/scribo/tests/filter/components_large.cc
+++ b/scribo/tests/filter/components_large.cc
@@ -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.
//
@@ -40,10 +40,6 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/objects_large.hh>
-#include <scribo/make/debug_filename.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
-
#include "tests/data.hh"
int main()
diff --git a/scribo/tests/filter/components_small.cc
b/scribo/tests/filter/components_small.cc
index d9b5325..d5d466c 100644
--- a/scribo/tests/filter/components_small.cc
+++ b/scribo/tests/filter/components_small.cc
@@ -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.
//
@@ -40,10 +40,6 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/make/debug_filename.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
-
#include "tests/data.hh"
--
1.5.6.5