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