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

14 Mar '11
* 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
1
0
* scribo/convert/from_base64.hh,
* scribo/io/xml/save.hh: Here.
---
scribo/ChangeLog | 7 +++++++
scribo/scribo/convert/from_base64.hh | 12 ++++++++++++
scribo/scribo/io/xml/save.hh | 13 ++++++++++++-
3 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 935e5d1..714874c 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2011-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add HAVE_QT guards.
+
+ * scribo/convert/from_base64.hh,
+ * scribo/io/xml/save.hh: Here.
+
+2011-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Small fixes in viewer.
* demo/viewer/main.cc: Add more includes.
diff --git a/scribo/scribo/convert/from_base64.hh b/scribo/scribo/convert/from_base64.hh
index 5eeeb53..753883d 100644
--- a/scribo/scribo/convert/from_base64.hh
+++ b/scribo/scribo/convert/from_base64.hh
@@ -63,6 +63,10 @@
#include <cstdio>
#include <cstdlib>
+# ifdef HAVE_QT
+# include <QString>
+# endif // ! HAVE_QT
+
# include <mln/border/resize.hh>
# include <mln/core/image/image2d.hh>
# include <mln/util/array.hh>
@@ -82,9 +86,13 @@ namespace scribo
Image<I>& output);
+# ifdef HAVE_QT
+
template <typename I>
void from_base64(const QString& data64, Image<I>& output_);
+# endif // ! HAVE_QT
+
# ifndef MLN_INCLUDE_ONLY
@@ -187,6 +195,8 @@ namespace scribo
}
+# ifdef HAVE_QT
+
template <typename I>
void
from_base64(const QString& data64, Image<I>& output_)
@@ -199,6 +209,8 @@ namespace scribo
trace::exiting("scribo::convert::to_base64");
}
+# endif // ! HAVE_QT
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/io/xml/save.hh b/scribo/scribo/io/xml/save.hh
index 7428e5d..54afa79 100644
--- a/scribo/scribo/io/xml/save.hh
+++ b/scribo/scribo/io/xml/save.hh
@@ -39,7 +39,10 @@
# include <scribo/core/document.hh>
-# include <scribo/io/xml/internal/full_xml_visitor.hh>
+# ifdef HAVE_QT
+# include <scribo/io/xml/internal/full_xml_visitor.hh>
+# endif // ! HAVE_QT
+
# include <scribo/io/xml/internal/extended_page_xml_visitor.hh>
# include <scribo/io/xml/internal/page_xml_visitor.hh>
@@ -66,7 +69,11 @@ namespace scribo
{
Page,
PageExtended,
+
+# ifdef HAVE_QT
Full
+# endif // ! HAVE_QT
+
//Hocr
};
@@ -100,12 +107,14 @@ namespace scribo
doc.accept(f);
}
+# ifdef HAVE_QT
template <typename L>
void save_full(const document<L>& doc, std::ofstream& output)
{
scribo::io::xml::internal::full_xml_visitor f(output);
doc.accept(f);
}
+# endif // ! HAVE_QT
} // end of namespace scribo::io::xml::internal
@@ -143,9 +152,11 @@ namespace scribo
internal::save_page_extended(doc, output);
break;
+# ifdef HAVE_QT
case Full:
internal::save_full(doc, output);
break;
+# endif // ! HAVE_QT
default:
trace::warning("scribo::io::xml::save - Invalid XML format! Skip saving...");
--
1.5.6.5
1
0
* demo/viewer/main.cc: Add more includes.
* demo/viewer/viewer.cc: Add debug output.
---
scribo/ChangeLog | 8 ++++++++
scribo/demo/viewer/main.cc | 5 ++++-
scribo/demo/viewer/viewer.cc | 8 +++++++-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index b54b162..935e5d1 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Small fixes in viewer.
+
+ * demo/viewer/main.cc: Add more includes.
+
+ * demo/viewer/viewer.cc: Add debug output.
+
2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
* scribo/io/xml/internal/extended_page_xml_visitor.hh: Save
diff --git a/scribo/demo/viewer/main.cc b/scribo/demo/viewer/main.cc
index 6d1cb18..069d5e9 100644
--- a/scribo/demo/viewer/main.cc
+++ b/scribo/demo/viewer/main.cc
@@ -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.
//
@@ -23,6 +24,8 @@
#include <mln/math/pi.hh>
#include <mln/io/magick/load.hh>
#include <scribo/make/debug_filename.hh>
+#include <mln/debug/filename.hh>
+#include <mln/literal/white.hh>
int main(int argc, char** argv)
{
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index f34b3e7..173cb3b 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -372,7 +372,10 @@ Viewer::add_text(QDomNode line)
coords = coords.nextSibling();
if (coords.isNull())
+ {
+ qDebug() << "Warning : textline without coordinates...";
return;
+ }
QDomNode point = coords.firstChild();
@@ -393,7 +396,7 @@ Viewer::add_text(QDomNode line)
point = point.nextSibling();
}
- QString text = line.toElement().attribute("text", "none");
+ QString text = line.toElement().attribute("text", "");
QFont font("Times");
font.setPixelSize(a_height + d_height);
QGraphicsTextItem* text_item = scene_->addText(text, font);
@@ -417,7 +420,10 @@ Viewer::add_region(QDomNode father, QString attr_id)
coords = coords.nextSibling();
if (coords.isNull())
+ {
+ qDebug() << "Warning : add_region - region without coordinates";
return;
+ }
QDomNode point = coords.firstChild();
QVector<QPoint> points;
--
1.5.6.5
1
0

09 Mar '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 msvc-support has been created
at 32e45a0a26e94d9d5f7c3162b46321448fee7430 (commit)
- Log -----------------------------------------------------------------
32e45a0 Compilation on windows
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0
Signed-off-by: Guillaume Lazzara <z(a)lrde.epita.fr>
---
milena/mln/algebra/vec.hh | 2 +-
milena/mln/convert/from_to.hxx | 2 +-
milena/mln/core/concept/proxy.hxx | 10 +++++-
milena/mln/core/dpoint.hh | 13 +++------
milena/mln/core/image/vmorph/thru_image.hh | 4 +-
milena/mln/core/internal/exact.hh | 4 +-
milena/mln/core/internal/force_exact.hh | 30 +++++++++++++++++++++
milena/mln/geom/chamfer.hh | 2 +-
milena/mln/metal/converts_to.hh | 6 ++--
milena/mln/metal/is.hh | 3 +-
milena/mln/metal/is_a.hh | 3 +-
milena/mln/morpho/tree/compute_attribute_image.hh | 4 +-
milena/mln/morpho/tree/data.hh | 11 ++++++-
milena/mln/trace/quiet.hh | 8 +++++-
14 files changed, 74 insertions(+), 28 deletions(-)
diff --git a/milena/mln/algebra/vec.hh b/milena/mln/algebra/vec.hh
index 22ebc02..b63b0da 100644
--- a/milena/mln/algebra/vec.hh
+++ b/milena/mln/algebra/vec.hh
@@ -55,7 +55,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..85f939c 100644
--- a/milena/mln/convert/from_to.hxx
+++ b/milena/mln/convert/from_to.hxx
@@ -68,7 +68,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/core/concept/proxy.hxx b/milena/mln/core/concept/proxy.hxx
index 2f77cec..057ad60 100644
--- a/milena/mln/core/concept/proxy.hxx
+++ b/milena/mln/core/concept/proxy.hxx
@@ -117,6 +117,7 @@ namespace mln
{
typedef mln_exact(mlc_unqualif(O))& ret;
static ret on(O& obj);
+
};
@@ -310,17 +311,22 @@ namespace mln
template <typename P>
inline
- mln_exact(P)::HOT_actual_subject
+ // Fixme: This is a fix for compilation on MSVC.
+ typename helper_unproxy_rec< P, true >::ret
+ //Was: mln_exact(P)::HOT_actual_subject
helper_unproxy_rec< P, true >::on(P& p)
{
return unproxy_rec(exact(p).unproxy_());
}
+
// helper_unprox_rec
template <typename P>
inline
- mlc_const(mln_exact(P)::HOT_actual_subject)
+ // Fixme: This is a fix for compilation on MSVC.
+ typename helper_unproxy_rec< const P, true >::ret
+ //Was: mlc_const(mln_exact(P)::HOT_actual_subject)
helper_unproxy_rec< const P, true >::on(const P& p)
{
return unproxy_rec(exact(p).unproxy_());
diff --git a/milena/mln/core/dpoint.hh b/milena/mln/core/dpoint.hh
index f4d603e..dd43db6 100644
--- a/milena/mln/core/dpoint.hh
+++ b/milena/mln/core/dpoint.hh
@@ -119,7 +119,10 @@ namespace mln
/// Conversion towards a algebra::vec.
template <typename Q>
- operator mln::algebra::vec<dpoint<G,C>::dim, Q>() const;
+ operator mln::algebra::vec<dpoint<G,C>::dim, Q>() const
+ {
+ return to_vec();
+ }
/// Explicit conversion.
vec to_vec() const;
@@ -252,14 +255,6 @@ namespace mln
}
template <typename G, typename C>
- template <typename Q>
- inline
- dpoint<G,C>::operator mln::algebra::vec<dpoint<G,C>::dim, Q> () const
- {
- return to_vec();
- }
-
- template <typename G, typename C>
inline
typename dpoint<G,C>::vec
dpoint<G,C>::to_vec() const
diff --git a/milena/mln/core/image/vmorph/thru_image.hh b/milena/mln/core/image/vmorph/thru_image.hh
index 2691d38..c6a5ad1 100644
--- a/milena/mln/core/image/vmorph/thru_image.hh
+++ b/milena/mln/core/image/vmorph/thru_image.hh
@@ -284,7 +284,7 @@ namespace mln
}
template <typename I, typename F>
- thru_image<const I, F> thru(const mln::Function<F>& f,
+ const thru_image<const I, F> thru(const mln::Function<F>& f,
const Image<I>& ima)
{
thru_image<const I, F> tmp(exact(ima), exact(f));
@@ -302,7 +302,7 @@ namespace mln
}
template <typename I, typename M>
- thru_image<const I, mln_fun_with(M, mln_value(I))>
+ const thru_image<const I, mln_fun_with(M, mln_value(I))>
thru(const mln::Meta_Function<M>& f, const Image<I>& ima)
{
typedef mln_fun_with(M, mln_value(I)) F;
diff --git a/milena/mln/core/internal/exact.hh b/milena/mln/core/internal/exact.hh
index e483cf3..5d3628b 100644
--- a/milena/mln/core/internal/exact.hh
+++ b/milena/mln/core/internal/exact.hh
@@ -75,7 +75,7 @@ namespace mln
template <typename E>
yes_ exact_selector_(Object<E>*);
- no_ exact_selector_(void*);
+ no_ exact_selector_(...);
template <typename E, typename T>
E* exact_run_(Object<E>* t, T*);
@@ -123,7 +123,7 @@ namespace mln
inline
E* exact_run_(Object<E>* t, T*)
{
- return (E*)(void*)t;
+ return static_cast<E*>(t);
}
template <typename T>
diff --git a/milena/mln/core/internal/force_exact.hh b/milena/mln/core/internal/force_exact.hh
index fdcad01..3843b62 100644
--- a/milena/mln/core/internal/force_exact.hh
+++ b/milena/mln/core/internal/force_exact.hh
@@ -46,6 +46,35 @@ namespace mln
doing.
\see mln::exact. */
+
+
+ template <typename S, typename D>
+ struct safe_c_cast
+ {
+ static D* run(S* s, D* a = static_cast<D*>((S*)0))
+ {
+ return static_cast<D*>(s);
+ }
+ static D* run(S* s, ...)
+ {
+/* static const E* exact_obj;
+ static const T& exact_obj_ref = *exact_obj;
+ static const ptrdiff_t exact_offset =
+ (const char*)(void*)(&exact_obj_ref)
+ - (const char*)(void*)(exact_obj);
+ return *(E*)((char*)(s) - exact_offset);*/
+ return *reinterpret_cast<E*>(s);
+ }
+
+ };
+
+ template <typename E, typename T>
+ E& force_exact(const T& ref)
+ {
+ return *safe_c_cast<T, E>::run(const_cast<T*>(&ref), (E*)0);
+ }
+
+ /*
template <typename E, typename T>
E& force_exact(const T& ref)
{
@@ -56,6 +85,7 @@ namespace mln
- (const char*)(void*)(exact_obj);
return *(E*)((char*)(&ref) - exact_offset);
}
+ */
} // end of namespace mln::internal
diff --git a/milena/mln/geom/chamfer.hh b/milena/mln/geom/chamfer.hh
index 9603605..d62d9a1 100644
--- a/milena/mln/geom/chamfer.hh
+++ b/milena/mln/geom/chamfer.hh
@@ -111,7 +111,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/metal/converts_to.hh b/milena/mln/metal/converts_to.hh
index 25be3e9..89e80c9 100644
--- a/milena/mln/metal/converts_to.hh
+++ b/milena/mln/metal/converts_to.hh
@@ -67,6 +67,8 @@ namespace mln
{
static yes_ selector(U, int);
static no_ selector(eat, ...);
+ enum { ret = sizeof(selector(*internal::make_<mlc_const(T)>::ptr(), 0)) };
+
};
} // end of namespace mln::metal::internal
@@ -75,9 +77,7 @@ namespace mln
/// \brief "converts-to" check.
template <typename T, typename U>
- struct converts_to : bool_<( sizeof(internal::helper_converts_to_<T, U>
- ::selector(*internal::make_<mlc_const(T)>::ptr(),
- 0) )
+ struct converts_to : bool_<( internal::helper_converts_to_<T, U>::ret
==
sizeof(internal::yes_) )>
{};
diff --git a/milena/mln/metal/is.hh b/milena/mln/metal/is.hh
index 10db237..16ac7e0 100644
--- a/milena/mln/metal/is.hh
+++ b/milena/mln/metal/is.hh
@@ -51,6 +51,7 @@ namespace mln
{
static yes_ selector(U*const);
static no_ selector(...);
+ enum { ret = sizeof(selector(internal::make_< T >::ptr())) };
};
} // end of namespace mln::metal::internal
@@ -61,7 +62,7 @@ namespace mln
/// Check whether T inherits from U.
//
template <typename T, typename U>
- struct is : bool_<( sizeof(internal::helper_is_<T, U>::selector(internal::make_<T>::ptr()))
+ struct is : bool_<( internal::helper_is_<T, U>::ret
==
sizeof(internal::yes_) )>
{
diff --git a/milena/mln/metal/is_a.hh b/milena/mln/metal/is_a.hh
index 2244c33..8cfc345 100644
--- a/milena/mln/metal/is_a.hh
+++ b/milena/mln/metal/is_a.hh
@@ -81,6 +81,7 @@ namespace mln
template<class V>
static yes_ selector(M<V>*);
static no_ selector(...);
+ enum { ret = sizeof(selector(internal::make_< T >::ptr())) };
};
} // end of namespace mln::metal::internal
@@ -92,7 +93,7 @@ namespace mln
/// Check whether T inherits from _CONCEPT_ M.
//
template <typename T, template <class> class M>
- struct is_a : bool_<( sizeof( internal::helper_is_a_< T, M >::selector(internal::make_< T >::ptr()) )
+ struct is_a : bool_<( internal::helper_is_a_< T, M >::ret
==
sizeof( internal::yes_ ) )>
{};
diff --git a/milena/mln/morpho/tree/compute_attribute_image.hh b/milena/mln/morpho/tree/compute_attribute_image.hh
index 9126bf1..9116c2c 100644
--- a/milena/mln/morpho/tree/compute_attribute_image.hh
+++ b/milena/mln/morpho/tree/compute_attribute_image.hh
@@ -215,7 +215,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 +233,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..1551574 100644
--- a/milena/mln/morpho/tree/data.hh
+++ b/milena/mln/morpho/tree/data.hh
@@ -470,7 +470,9 @@ namespace mln
template <typename I, typename S>
inline
- mln_rvalue_(mln_ch_value(I, mln_psite(I)))
+ // Fixme
+ // Was: mln_rvalue_(mln_ch_value(I, mln_psite(I)))
+ typename data<I,S>::parent_t::rvalue
data<I,S>::parent(const mln_psite(I)& p) const
{
mln_precondition(parent_.domain().has(p));
@@ -479,7 +481,10 @@ namespace mln
template <typename I, typename S>
inline
+ // Fixme
+ // Was: const mln_ch_value(I, mln_psite(I))&
const mln_ch_value(I, mln_psite(I))&
+ //mln_rvalue(typename data<I,S>::parent_t)
data<I,S>::parent_image() const
{
mln_precondition(is_valid());
@@ -588,7 +593,9 @@ namespace mln
template <typename I, typename S>
inline
- mln_rvalue_(mln_ch_value(I, p_array<mln_psite(I)>))
+ // Fixme
+ // Was: mln_rvalue_(mln_ch_value(I, p_array<mln_psite(I)>))
+ typename data<I,S>::children_t::rvalue
data<I,S>::children(const mln_psite(I)& p) const
{
mln_precondition(is_a_node(p));
diff --git a/milena/mln/trace/quiet.hh b/milena/mln/trace/quiet.hh
index f76e8d2..a982a43 100644
--- a/milena/mln/trace/quiet.hh
+++ b/milena/mln/trace/quiet.hh
@@ -32,7 +32,13 @@
*/
# include <ctime>
-# include <sys/time.h>
+
+# ifndef _WIN32
+# include <sys/time.h>
+# else
+# define NOMINMAX
+# include <windows.h>
+# endif
namespace mln
{
--
1.5.6.5
1
0

last-svn-commit-791-g88a5659 scribo/io/xml/internal/extended_page_xml_visitor.hh: Save separators data.
by Guillaume Lazzara 04 Mar '11
by Guillaume Lazzara 04 Mar '11
04 Mar '11
---
scribo/ChangeLog | 5 +++++
.../io/xml/internal/extended_page_xml_visitor.hh | 4 ++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 41f167a..b54b162 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,10 @@
2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh: Save
+ separators data.
+
+2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* scribo/io/xml/internal/full_xml_visitor.hh: Do not copy image
data.
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index 4da0755..f573d88 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -113,6 +113,10 @@ namespace scribo
if (doc.has_elements())
doc.elements().accept(*this);
+ // line seraparators
+ if (doc.has_line_seps())
+ doc.line_seps_comps().accept(*this);
+
// Whitespace seraparators
if (doc.has_whitespace_seps())
doc.whitespace_seps_comps().accept(*this);
--
1.5.6.5
1
0

last-svn-commit-790-g55dec68 scribo/io/xml/internal/full_xml_visitor.hh: Do not copy image data.
by Guillaume Lazzara 04 Mar '11
by Guillaume Lazzara 04 Mar '11
04 Mar '11
---
scribo/ChangeLog | 5 +++++
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 11 ++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 98076cf..41f167a 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,10 @@
2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * scribo/io/xml/internal/full_xml_visitor.hh: Do not copy image
+ data.
+
+2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Make OCR step optional in viewer.
* demo/viewer/Makefile.am: Add new files.
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 2b09b3a..8576c27 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -279,8 +279,9 @@ namespace scribo
// FIXME: Try to avoid that!
border::resize(lbl, 0);
- QByteArray lbl64((const char *)lbl.buffer(),
- lbl.nelements() * sizeof(mln_value(L)));
+ QByteArray
+ lbl64 = QByteArray::fromRawData((const char *)lbl.buffer(),
+ lbl.nelements() * sizeof(mln_value(L)));
lbl64 = qCompress(lbl64, COMPRESSION_LEVEL);
lbl64 = lbl64.toBase64();
@@ -299,8 +300,9 @@ namespace scribo
<< "<
04 Mar '11
* demo/viewer/Makefile.am: Add new files.
* demo/viewer/config.cc,
* demo/viewer/config.hh: Add OCR settings.
* demo/viewer/toolchain_options.cc,
* demo/viewer/toolchain_options.hh,
* demo/viewer/toolchain_options.ui: Remove.
* demo/viewer/ocr_options.cc,
* demo/viewer/ocr_options.hh,
* demo/viewer/ocr_options.ui,
* demo/viewer/preprocessing_options.cc,
* demo/viewer/preprocessing_options.hh,
* demo/viewer/preprocessing_options.ui,
* demo/viewer/segmentation_options.cc,
* demo/viewer/segmentation_options.hh,
* demo/viewer/segmentation_options.ui: New option widgets.
* demo/viewer/preferences_dialog.cc: Insert new widgets.
* demo/viewer/runner.cc: Take OCR settings into account.
---
scribo/ChangeLog | 30 +++++++-
scribo/demo/viewer/Makefile.am | 20 ++++-
scribo/demo/viewer/config.cc | 28 ++++++-
scribo/demo/viewer/config.hh | 11 ++-
scribo/demo/viewer/ocr_options.cc | 74 ++++++++++++++++
scribo/demo/viewer/ocr_options.hh | 40 +++++++++
scribo/demo/viewer/ocr_options.ui | 62 ++++++++++++++
scribo/demo/viewer/preferences_dialog.cc | 26 +++++-
scribo/demo/viewer/preprocessing_options.cc | 66 +++++++++++++++
scribo/demo/viewer/preprocessing_options.hh | 38 +++++++++
scribo/demo/viewer/preprocessing_options.ui | 76 +++++++++++++++++
scribo/demo/viewer/runner.cc | 3 +-
scribo/demo/viewer/segmentation_options.cc | 56 ++++++++++++
scribo/demo/viewer/segmentation_options.hh | 37 ++++++++
scribo/demo/viewer/segmentation_options.ui | 52 ++++++++++++
scribo/demo/viewer/toolchain_options.cc | 75 -----------------
scribo/demo/viewer/toolchain_options.hh | 37 --------
scribo/demo/viewer/toolchain_options.ui | 121 ---------------------------
18 files changed, 605 insertions(+), 247 deletions(-)
create mode 100644 scribo/demo/viewer/ocr_options.cc
create mode 100644 scribo/demo/viewer/ocr_options.hh
create mode 100644 scribo/demo/viewer/ocr_options.ui
create mode 100644 scribo/demo/viewer/preprocessing_options.cc
create mode 100644 scribo/demo/viewer/preprocessing_options.hh
create mode 100644 scribo/demo/viewer/preprocessing_options.ui
create mode 100644 scribo/demo/viewer/segmentation_options.cc
create mode 100644 scribo/demo/viewer/segmentation_options.hh
create mode 100644 scribo/demo/viewer/segmentation_options.ui
delete mode 100644 scribo/demo/viewer/toolchain_options.cc
delete mode 100644 scribo/demo/viewer/toolchain_options.hh
delete mode 100644 scribo/demo/viewer/toolchain_options.ui
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f870519..98076cf 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,6 +1,34 @@
2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
- * scribo/toolchain/internal/content_in_doc_functor.hh: Make OCR step optional.
+ Make OCR step optional in viewer.
+
+ * demo/viewer/Makefile.am: Add new files.
+
+ * demo/viewer/config.cc,
+ * demo/viewer/config.hh: Add OCR settings.
+
+ * demo/viewer/toolchain_options.cc,
+ * demo/viewer/toolchain_options.hh,
+ * demo/viewer/toolchain_options.ui: Remove.
+
+ * demo/viewer/ocr_options.cc,
+ * demo/viewer/ocr_options.hh,
+ * demo/viewer/ocr_options.ui,
+ * demo/viewer/preprocessing_options.cc,
+ * demo/viewer/preprocessing_options.hh,
+ * demo/viewer/preprocessing_options.ui,
+ * demo/viewer/segmentation_options.cc,
+ * demo/viewer/segmentation_options.hh,
+ * demo/viewer/segmentation_options.ui: New option widgets.
+
+ * demo/viewer/preferences_dialog.cc: Insert new widgets.
+
+ * demo/viewer/runner.cc: Take OCR settings into account.
+
+2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * scribo/toolchain/internal/content_in_doc_functor.hh: Make OCR
+ step optional.
2011-03-03 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/demo/viewer/Makefile.am b/scribo/demo/viewer/Makefile.am
index 2c5e4cf..09d9ecc 100644
--- a/scribo/demo/viewer/Makefile.am
+++ b/scribo/demo/viewer/Makefile.am
@@ -30,7 +30,9 @@ scribo_viewer_SOURCES = viewer.cc \
image_region.cc \
help_dialog.cc \
step_widget.cc \
- toolchain_options.cc \
+ preprocessing_options.cc\
+ segmentation_options.cc \
+ ocr_options.cc \
runner.cc \
preprocess.cc \
process.cc \
@@ -65,8 +67,12 @@ BUILT_SOURCES = viewer.moc.cc \
image_region.moc.cc \
help_dialog.ui.h \
step_widget.moc.cc \
- toolchain_options.moc.cc \
- toolchain_options.ui.h \
+ preprocessing_options.moc.cc \
+ preprocessing_options.ui.h \
+ segmentation_options.moc.cc \
+ segmentation_options.ui.h \
+ ocr_options.moc.cc \
+ ocr_options.ui.h \
runner.moc.cc \
preprocess.moc.cc \
process.moc.cc \
@@ -91,7 +97,9 @@ noinst_HEADERS = viewer.hh \
common.hh \
help_dialog.hh \
step_widget.hh \
- toolchain_options.hh \
+ preprocessing_options.hh\
+ segmentation_options.hh\
+ ocr_options.hh \
runner.hh \
preprocess.hh \
process.hh \
@@ -121,7 +129,9 @@ EXTRA_DIST = \
general_options.ui \
preferences_dialog.ui \
README \
- toolchain_options.ui \
+ preprocessing_options.ui\
+ segmentation_options.ui \
+ ocr_options.ui \
help_dialog.ui \
demodir.hh.in
diff --git a/scribo/demo/viewer/config.cc b/scribo/demo/viewer/config.cc
index bf12e95..6bdcd35 100644
--- a/scribo/demo/viewer/config.cc
+++ b/scribo/demo/viewer/config.cc
@@ -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.
//
@@ -108,6 +109,31 @@ void config::set_segmentation_find_seps(int seps)
}
+// OCR
+
+bool config::ocr_enabled()
+{
+ return value("ocr/enabled", true).toBool();
+}
+
+void config::set_ocr_enabled(bool b)
+{
+ setValue("ocr/enabled", b);
+}
+
+
+
+QString config::ocr_language()
+{
+ return value("ocr/language", 0).toString();
+}
+
+void config::set_ocr_language(const QString& lang)
+{
+ setValue("ocr/language", lang);
+}
+
+
// General options
diff --git a/scribo/demo/viewer/config.hh b/scribo/demo/viewer/config.hh
index 07d193c..74dab3b 100644
--- a/scribo/demo/viewer/config.hh
+++ b/scribo/demo/viewer/config.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.
//
@@ -49,6 +50,14 @@ public:
void set_segmentation_find_seps(int seps);
+ // OCR
+ bool ocr_enabled();
+ void set_ocr_enabled(bool b);
+
+ QString ocr_language();
+ void set_ocr_language(const QString& lang);
+
+
// General options
bool general_save_xml_enabled();
void set_general_save_xml_enabled(bool b);
diff --git a/scribo/demo/viewer/ocr_options.cc b/scribo/demo/viewer/ocr_options.cc
new file mode 100644
index 0000000..0ff09d9
--- /dev/null
+++ b/scribo/demo/viewer/ocr_options.cc
@@ -0,0 +1,74 @@
+// 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/>.
+
+#include "defs.hh"
+#include "ocr_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+
+static const char *language[][2] = {
+ { "English", "eng" },
+ { "French", "fra" },
+ { 0, 0 }
+};
+
+
+ocr_options::ocr_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ for (unsigned i = 0; language[i][0]; ++i)
+ ocr_language->insertItem(i, language[i][0]);
+
+ load_config();
+}
+
+ocr_options::~ocr_options()
+{
+}
+
+
+int ocr_options::find_index(const QString& lang)
+{
+ for (unsigned i = 0; language[i][0]; ++i)
+ if (lang == language[i][1])
+ return i;
+ return 0;
+}
+
+
+void ocr_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ enable_ocr->setChecked(conf->ocr_enabled());
+ ocr_language->setCurrentIndex(find_index(conf->ocr_language()));
+}
+
+
+void ocr_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_ocr_enabled(enable_ocr->isChecked());
+ conf->set_ocr_language(language[ocr_language->currentIndex()][1]);
+}
diff --git a/scribo/demo/viewer/ocr_options.hh b/scribo/demo/viewer/ocr_options.hh
new file mode 100644
index 0000000..67ab4ef
--- /dev/null
+++ b/scribo/demo/viewer/ocr_options.hh
@@ -0,0 +1,40 @@
+// 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/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_OCR_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_OCR_OPTIONS_HH
+
+# include <QtGui>
+# include <ocr_options.ui.h>
+# include "option_widget.hh"
+
+class ocr_options : public OptionWidget, private Ui::OcrOptions
+{
+ Q_OBJECT;
+
+public:
+ ocr_options(QWidget *parent = 0);
+ ~ocr_options();
+
+ void load_config();
+ void save_config();
+
+private:
+ int find_index(const QString& lang);
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_OCR_OPTIONS_HH
diff --git a/scribo/demo/viewer/ocr_options.ui b/scribo/demo/viewer/ocr_options.ui
new file mode 100644
index 0000000..d001c64
--- /dev/null
+++ b/scribo/demo/viewer/ocr_options.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OcrOptions</class>
+ <widget class="QWidget" name="OcrOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>366</width>
+ <height>112</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="enable_ocr">
+ <property name="title">
+ <string>Enable OCR</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Language</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="ocr_language"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/preferences_dialog.cc b/scribo/demo/viewer/preferences_dialog.cc
index dfd6061..1eb80a7 100644
--- a/scribo/demo/viewer/preferences_dialog.cc
+++ b/scribo/demo/viewer/preferences_dialog.cc
@@ -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.
//
@@ -15,8 +16,10 @@
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
#include "preferences_dialog.hh"
-#include "toolchain_options.hh"
#include "general_options.hh"
+#include "ocr_options.hh"
+#include "preprocessing_options.hh"
+#include "segmentation_options.hh"
@@ -41,7 +44,7 @@ preferences_dialog::~preferences_dialog()
void preferences_dialog::load_option_list()
{
- static const char *options[] = { "General", "Toolchain", 0 };
+ static const char *options[] = { "General", "Preprocessing", "Segmentation", "OCR", 0 };
int i;
for (i = 0; options[i]; ++i)
@@ -66,19 +69,32 @@ void preferences_dialog::select_option_widget(int row)
if (!widgets_[row])
{
+ QWidget *widget = 0;
+
switch (row)
{
case 0:
- widgets_[0] = new general_options(this);
+ widget = new general_options(this);
break;
case 1:
- widgets_[1] = new toolchain_options(this);
+ widget = new preprocessing_options(this);
+ break;
+
+ case 2:
+ widget = new segmentation_options(this);
+ break;
+
+ case 3:
+ widget = new ocr_options(this);
break;
default:
qDebug() << "select_option_widget - Hu? Something wrong...";
}
+
+ if (widget)
+ widgets_[row] = widget;
}
if (horizontalLayout_2->count() == 2)
diff --git a/scribo/demo/viewer/preprocessing_options.cc b/scribo/demo/viewer/preprocessing_options.cc
new file mode 100644
index 0000000..2d55fea
--- /dev/null
+++ b/scribo/demo/viewer/preprocessing_options.cc
@@ -0,0 +1,66 @@
+// Copyright (C) 2010, 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/>.
+
+#include "defs.hh"
+#include "preprocessing_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+preprocessing_options::preprocessing_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ bin_algoCbox->insertItem(Convert, "Violent convert");
+ bin_algoCbox->insertItem(Sauvola, "Local threshold");
+ bin_algoCbox->insertItem(SauvolaMs,
+ "Local threshold multiscale");
+
+ load_config();
+}
+
+preprocessing_options::~preprocessing_options()
+{
+}
+
+
+void preprocessing_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ subsampleCb->setChecked(conf->preprocessing_subsample());
+ remove_bgCb->setChecked(conf->preprocessing_remove_bg());
+ deskewCb->setChecked(conf->preprocessing_deskew());
+ remove_noiseCb->setChecked(conf->preprocessing_remove_noise());
+ bin_algoCbox->setCurrentIndex(conf->preprocessing_bin_algo());
+}
+
+
+void preprocessing_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_preprocessing_subsample(subsampleCb->isChecked());
+ conf->set_preprocessing_remove_bg(remove_bgCb->isChecked());
+ conf->set_preprocessing_deskew(deskewCb->isChecked());
+ conf->set_preprocessing_remove_noise(remove_noiseCb->isChecked());
+ conf->set_preprocessing_bin_algo(bin_algoCbox->currentIndex());
+}
diff --git a/scribo/demo/viewer/preprocessing_options.hh b/scribo/demo/viewer/preprocessing_options.hh
new file mode 100644
index 0000000..c676880
--- /dev/null
+++ b/scribo/demo/viewer/preprocessing_options.hh
@@ -0,0 +1,38 @@
+// Copyright (C) 2010, 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/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_PREPROCESSING_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_PREPROCESSING_OPTIONS_HH
+
+# include <QtGui>
+# include <preprocessing_options.ui.h>
+# include "option_widget.hh"
+
+class preprocessing_options : public OptionWidget, private Ui::PreprocessingOptions
+{
+ Q_OBJECT;
+
+public:
+ preprocessing_options(QWidget *parent = 0);
+ ~preprocessing_options();
+
+ void load_config();
+ void save_config();
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_PREPROCESSING_OPTIONS_HH
diff --git a/scribo/demo/viewer/preprocessing_options.ui b/scribo/demo/viewer/preprocessing_options.ui
new file mode 100644
index 0000000..962cf49
--- /dev/null
+++ b/scribo/demo/viewer/preprocessing_options.ui
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreprocessingOptions</class>
+ <widget class="QWidget" name="PreprocessingOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>466</width>
+ <height>198</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure toolchain</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Binarization method:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="bin_algoCbox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="subsampleCb">
+ <property name="text">
+ <string>Run on subsampled image</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="remove_bgCb">
+ <property name="text">
+ <string>Remove background (slow)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="deskewCb">
+ <property name="text">
+ <string>Deskew</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="remove_noiseCb">
+ <property name="text">
+ <string>Remove noise</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>48</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/runner.cc b/scribo/demo/viewer/runner.cc
index a3cc883..e923db7 100644
--- a/scribo/demo/viewer/runner.cc
+++ b/scribo/demo/viewer/runner.cc
@@ -156,7 +156,8 @@ void runner::process(const image2d<value::rgb8>& original_ima,
|| find_seps == defs::LinesAndWhitespaces);
f.enable_whitespace_seps = (find_seps == defs::Whitespaces
|| find_seps == defs::LinesAndWhitespaces);
-
+ f.enable_ocr = conf->ocr_enabled();
+ f.ocr_language = conf->ocr_language().toAscii().data();
f.xml_format = scribo::io::xml::PageExtended;
diff --git a/scribo/demo/viewer/segmentation_options.cc b/scribo/demo/viewer/segmentation_options.cc
new file mode 100644
index 0000000..c120879
--- /dev/null
+++ b/scribo/demo/viewer/segmentation_options.cc
@@ -0,0 +1,56 @@
+// 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/>.
+
+#include "defs.hh"
+#include "segmentation_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+segmentation_options::segmentation_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ find_sepsCbox->insertItem(defs::Lines, "Lines");
+ find_sepsCbox->insertItem(defs::Whitespaces, "Whitespaces");
+ find_sepsCbox->insertItem(defs::LinesAndWhitespaces, "Lines and whitespaces");
+
+ load_config();
+}
+
+segmentation_options::~segmentation_options()
+{
+}
+
+
+void segmentation_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ find_sepsCbox->setCurrentIndex(conf->segmentation_find_seps());
+}
+
+
+void segmentation_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_segmentation_find_seps(find_sepsCbox->currentIndex());
+}
diff --git a/scribo/demo/viewer/segmentation_options.hh b/scribo/demo/viewer/segmentation_options.hh
new file mode 100644
index 0000000..bdf65f9
--- /dev/null
+++ b/scribo/demo/viewer/segmentation_options.hh
@@ -0,0 +1,37 @@
+// 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/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_SEGMENTATION_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_SEGMENTATION_OPTIONS_HH
+
+# include <QtGui>
+# include <segmentation_options.ui.h>
+# include "option_widget.hh"
+
+class segmentation_options : public OptionWidget, private Ui::SegmentationOptions
+{
+ Q_OBJECT;
+
+public:
+ segmentation_options(QWidget *parent = 0);
+ ~segmentation_options();
+
+ void load_config();
+ void save_config();
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_SEGMENTATION_OPTIONS_HH
diff --git a/scribo/demo/viewer/segmentation_options.ui b/scribo/demo/viewer/segmentation_options.ui
new file mode 100644
index 0000000..485e448
--- /dev/null
+++ b/scribo/demo/viewer/segmentation_options.ui
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SegmentationOptions</class>
+ <widget class="QWidget" name="SegmentationOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Find separators</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="find_sepsCbox">
+ <property name="editable">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>258</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/toolchain_options.cc b/scribo/demo/viewer/toolchain_options.cc
deleted file mode 100644
index 6024ff3..0000000
--- a/scribo/demo/viewer/toolchain_options.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// 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/>.
-
-#include "defs.hh"
-#include "toolchain_options.hh"
-#include "config.hh"
-
-// Defines enum of binarization algorithms
-# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
-
-using namespace scribo::toolchain::internal;
-
-toolchain_options::toolchain_options(QWidget *parent)
- : OptionWidget(parent)
-{
- setupUi(this);
-
- bin_algoCbox->insertItem(Convert, "Violent convert");
- bin_algoCbox->insertItem(Sauvola, "Local threshold");
- bin_algoCbox->insertItem(SauvolaMs,
- "Local threshold multiscale");
-
- find_sepsCbox->insertItem(defs::Lines, "Lines");
- find_sepsCbox->insertItem(defs::Whitespaces, "Whitespaces");
- find_sepsCbox->insertItem(defs::LinesAndWhitespaces, "Lines and whitespaces");
-
- load_config();
-}
-
-toolchain_options::~toolchain_options()
-{
-}
-
-
-void toolchain_options::load_config()
-{
- config * const conf = config::get_instance();
-
- // Preprocessing
- subsampleCb->setChecked(conf->preprocessing_subsample());
- remove_bgCb->setChecked(conf->preprocessing_remove_bg());
- deskewCb->setChecked(conf->preprocessing_deskew());
- remove_noiseCb->setChecked(conf->preprocessing_remove_noise());
- bin_algoCbox->setCurrentIndex(conf->preprocessing_bin_algo());
-
- // Page segmentation
- find_sepsCbox->setCurrentIndex(conf->segmentation_find_seps());
-}
-
-
-void toolchain_options::save_config()
-{
- config * const conf = config::get_instance();
-
- conf->set_preprocessing_subsample(subsampleCb->isChecked());
- conf->set_preprocessing_remove_bg(remove_bgCb->isChecked());
- conf->set_preprocessing_deskew(deskewCb->isChecked());
- conf->set_preprocessing_remove_noise(remove_noiseCb->isChecked());
- conf->set_preprocessing_bin_algo(bin_algoCbox->currentIndex());
-
- conf->set_segmentation_find_seps(find_sepsCbox->currentIndex());
-}
diff --git a/scribo/demo/viewer/toolchain_options.hh b/scribo/demo/viewer/toolchain_options.hh
deleted file mode 100644
index afad3e7..0000000
--- a/scribo/demo/viewer/toolchain_options.hh
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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/>.
-
-#ifndef SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
-# define SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
-
-# include <QtGui>
-# include <toolchain_options.ui.h>
-# include "option_widget.hh"
-
-class toolchain_options : public OptionWidget, private Ui::ToolchainOptions
-{
- Q_OBJECT;
-
-public:
- toolchain_options(QWidget *parent = 0);
- ~toolchain_options();
-
- void load_config();
- void save_config();
-
-};
-
-#endif // ! SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
diff --git a/scribo/demo/viewer/toolchain_options.ui b/scribo/demo/viewer/toolchain_options.ui
deleted file mode 100644
index 748696d..0000000
--- a/scribo/demo/viewer/toolchain_options.ui
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ToolchainOptions</class>
- <widget class="QWidget" name="ToolchainOptions">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>492</width>
- <height>264</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Configure toolchain</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Preprocessing</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="subsampleCb">
- <property name="text">
- <string>Run on subsampled image</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="remove_bgCb">
- <property name="text">
- <string>Remove background (slow)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="deskewCb">
- <property name="text">
- <string>Deskew</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="remove_noiseCb">
- <property name="text">
- <string>Remove noise</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Binarization method:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="bin_algoCbox"/>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Page segmentation</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Find separators</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="find_sepsCbox"/>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
--
1.5.6.5
1
0

last-svn-commit-788-gbe7296a scribo/toolchain/internal/content_in_doc_functor.hh: Make OCR step optional.
by Guillaume Lazzara 04 Mar '11
by Guillaume Lazzara 04 Mar '11
04 Mar '11
---
scribo/ChangeLog | 8 ++++++--
.../toolchain/internal/content_in_doc_functor.hh | 19 ++++++++++++-------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 7ae03ac..f870519 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,9 +1,13 @@
+2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * scribo/toolchain/internal/content_in_doc_functor.hh: Make OCR step optional.
+
2011-03-03 Guillaume Lazzara <z(a)lrde.epita.fr>
Compress image data in XML output.
- * scribo/scribo/io/xml/internal/full_xml_visitor.hh,
- * scribo/scribo/io/xml/load.hh: Here.
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/load.hh: Here.
2011-03-03 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
index dcbb4f7..40f013c 100644
--- a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
+++ b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
@@ -111,6 +111,7 @@ namespace scribo
bool enable_denoising;
bool enable_line_seps;
bool enable_whitespace_seps;
+ bool enable_ocr;
bool enable_debug;
bool save_doc_as_xml;
scribo::io::xml::Format xml_format;
@@ -136,6 +137,7 @@ namespace scribo
: enable_denoising(true),
enable_line_seps(true),
enable_whitespace_seps(true),
+ enable_ocr(true),
enable_debug(false),
save_doc_as_xml(false),
xml_format(scribo::io::xml::PageExtended),
@@ -373,11 +375,14 @@ namespace scribo
// Text recognition
- on_new_progress_label("Recognizing text");
- scribo::text::recognition(lines, ocr_language.c_str());
+ if (enable_ocr)
+ {
+ on_new_progress_label("Recognizing text");
- on_progress();
+ scribo::text::recognition(lines, ocr_language.c_str());
+ on_progress();
+ }
// Link text lines
on_new_progress_label("Linking text lines");
@@ -390,7 +395,7 @@ namespace scribo
image2d<value::rgb8> debug = data::convert(value::rgb8(), original_image);
for_all_lines(l, lines)
{
- if (! lines(l).is_valid() || lines(l).is_hidden() || lines(l).type() != line::Text)
+ if (! lines(l).is_textline())
continue;
mln::draw::box(debug, lines(l).bbox(), literal::blue);
@@ -427,7 +432,7 @@ namespace scribo
mln::util::array<accu::shape::bbox<point2d> > nbbox(llinks.nelements());
for_all_lines(i, lines)
{
- if (! lines(i).is_valid() || lines(i).is_hidden() || lines(i).type() != line::Text)
+ if (! lines(i).is_textline())
continue;
mln::draw::box(debug, lines(i).bbox(), literal::red);
@@ -497,8 +502,8 @@ namespace scribo
int
content_in_doc_functor<I>::nsteps() const
{
- return 11 + enable_denoising + enable_line_seps
- + enable_whitespace_seps + save_doc_as_xml;
+ return 10 + enable_denoising + enable_line_seps
+ + enable_whitespace_seps + enable_ocr + save_doc_as_xml;
}
--
1.5.6.5
1
0

03 Mar '11
* scribo/scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/scribo/io/xml/load.hh: Here.
---
scribo/ChangeLog | 7 ++++
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 34 ++++++++++++++------
scribo/scribo/io/xml/load.hh | 12 +++++--
3 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 7c29163..7ae03ac 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2011-03-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Compress image data in XML output.
+
+ * scribo/scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/scribo/io/xml/load.hh: Here.
+
+2011-03-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Small fixes in Scribo.
* scribo/convert/from_base64.hh: Remove guards HAVE_QT.
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 9c5bd1d..2b09b3a 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -31,6 +31,9 @@
/// XML serializer Visitor.
# include <fstream>
+
+# include <QByteArray>
+
# include <scribo/core/internal/doc_xml_serializer.hh>
# include <scribo/core/document.hh>
# include <scribo/core/component_set.hh>
@@ -40,11 +43,12 @@
# include <scribo/core/line_links.hh>
# include <scribo/core/line_info.hh>
-# include <scribo/convert/to_base64.hh>
-
# include <scribo/io/xml/internal/print_box_coords.hh>
# include <scribo/io/xml/internal/print_page_preambule.hh>
+// Compression level 0-9. 9 is the best but is slow.
+// 5 seems to be a good compromise.
+# define COMPRESSION_LEVEL 5
namespace scribo
{
@@ -273,15 +277,20 @@ namespace scribo
<< "\" width=\"" << lbl.domain().width() << "\">"
<< "<![CDATA[";
- util::array<unsigned char> lbl64;
- convert::to_base64(lbl, lbl64);
- output.write((const char *)lbl64.std_vector().data(),
- lbl64.nelements());
+ // FIXME: Try to avoid that!
+ border::resize(lbl, 0);
+ QByteArray lbl64((const char *)lbl.buffer(),
+ lbl.nelements() * sizeof(mln_value(L)));
+ lbl64 = qCompress(lbl64, COMPRESSION_LEVEL);
+ lbl64 = lbl64.toBase64();
+
+ output.write(lbl64.data(), lbl64.size());
output << "]]></labeled_image>" << std::endl;
}
// Save separators image
+ if (comp_set.has_separators())
{
const mln_ch_value(L,bool)& seps = comp_set.separators();
output << "<separators_image "
@@ -289,10 +298,13 @@ namespace scribo
<< "\" width=\"" << seps.domain().width() << "\">"
<< "<![CDATA[";
- util::array<unsigned char> seps64;
- convert::to_base64(seps, seps64);
- output.write((const char *)seps64.std_vector().data(),
- seps64.nelements());
+ border::resize(seps, 0);
+ QByteArray seps64((const char *)seps.buffer(),
+ seps.nelements() * sizeof(bool));
+ seps64 = qCompress(seps64, COMPRESSION_LEVEL);
+ seps64 = seps64.toBase64();
+
+ output.write(seps64.data(), seps64.size());
output << "]]></separators_image>" << std::endl;
}
@@ -453,4 +465,6 @@ namespace scribo
} // end of namespace scribo
+# undef COMPRESSION_LEVEL
+
#endif // SCRIBO_IO_XML_INTERNAL_FULL_XML_VISITOR_HH
diff --git a/scribo/scribo/io/xml/load.hh b/scribo/scribo/io/xml/load.hh
index e0f4548..8042c75 100644
--- a/scribo/scribo/io/xml/load.hh
+++ b/scribo/scribo/io/xml/load.hh
@@ -50,8 +50,6 @@
# include <scribo/core/line_set.hh>
# include <scribo/core/line_info.hh>
-# include <scribo/convert/from_base64.hh>
-
namespace scribo
{
@@ -405,13 +403,19 @@ namespace scribo
{
case LabeledImage:
{
- scribo::convert::from_base64(ch, comp_set_data->ima_);
+ QByteArray data = ch.toAscii();
+ data = QByteArray::fromBase64(data);
+ data = qUncompress(data);
+ memcpy((char *) comp_set_data->ima_.buffer(), data.data(), data.size());
}
break;
case SeparatorsImage:
{
- scribo::convert::from_base64(ch, comp_set_data->separators_);
+ QByteArray data = ch.toAscii();
+ data = QByteArray::fromBase64(data);
+ data = qUncompress(data);
+ memcpy((char *) comp_set_data->separators_.buffer(), data.data(), data.size());
}
break;
--
1.5.6.5
1
0