* core/object_groups.hh: Fix an invalid size.
* debug/save_bboxes_image.hh,
* filter/object_links_non_aligned_simple.hh,
* primitive/group/from_single_link.hh,
* subsampling/bilinear.hh,
* text/merging.hh,
* upsampling/bs2x.hh: Fix namespace ambiguities.
* primitive/group/from_double_link.hh: Fix comment.
* primitive/internal/find_root.hh: Fix guards.
* primitive/link/with_single_right_link_dmax_ratio.hh: Add a
missing include.
* primitive/remove/separators.hh: Improve computation time.
* preprocessing/rotate_90.hh: Add a fixme.
---
scribo/ChangeLog | 24 ++++++++++++++++++++
scribo/core/object_groups.hh | 16 ++++++++++--
scribo/debug/save_bboxes_image.hh | 2 +-
scribo/filter/object_links_non_aligned_simple.hh | 4 ++-
scribo/preprocessing/rotate_90.hh | 1 +
scribo/primitive/group/from_double_link.hh | 1 -
scribo/primitive/group/from_single_link.hh | 8 +++++-
scribo/primitive/internal/find_root.hh | 9 ++++---
.../link/with_single_right_link_dmax_ratio.hh | 1 +
scribo/primitive/remove/separators.hh | 14 ++++++++++-
scribo/subsampling/bilinear.hh | 2 +-
scribo/text/merging.hh | 2 +-
scribo/upsampling/bs2x.hh | 4 +-
13 files changed, 71 insertions(+), 17 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 4ce573a..eaa3502 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,29 @@
2010-05-25 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Small fixes.
+
+ * core/object_groups.hh: Fix an invalid size.
+
+ * debug/save_bboxes_image.hh,
+ * filter/object_links_non_aligned_simple.hh,
+ * primitive/group/from_single_link.hh,
+ * subsampling/bilinear.hh,
+ * text/merging.hh,
+ * upsampling/bs2x.hh: Fix namespace ambiguities.
+
+ * primitive/group/from_double_link.hh: Fix comment.
+
+ * primitive/internal/find_root.hh: Fix guards.
+
+ * primitive/link/with_single_right_link_dmax_ratio.hh: Add a
+ missing include.
+
+ * primitive/remove/separators.hh: Improve computation time.
+
+ * preprocessing/rotate_90.hh: Add a fixme.
+
+2010-05-25 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Store OCR results in the line_info structure.
* core/line_info.hh: Add a new attribute 'text'.
diff --git a/scribo/core/object_groups.hh b/scribo/core/object_groups.hh
index 97334f2..a7bb403 100644
--- a/scribo/core/object_groups.hh
+++ b/scribo/core/object_groups.hh
@@ -94,6 +94,8 @@ namespace scribo
object_groups<L> duplicate() const;
+ void init();
+
private: // attributes
mln::util::tracked_ptr<data_t> data_;
};
@@ -119,7 +121,7 @@ namespace scribo
template <typename L>
object_groups_data<L>::object_groups_data(const object_links<L>&
links)
- : comp_to_group_(unsigned(links.nelements()) + 1),
+ : comp_to_group_(unsigned(links.nelements())),
components_(links.components()), links_(links)
{
};
@@ -128,7 +130,7 @@ namespace scribo
template <typename L>
object_groups_data<L>::object_groups_data(const object_links<L>&
links,
unsigned value)
- : comp_to_group_(unsigned(links.nelements() + 1), value),
+ : comp_to_group_(unsigned(links.nelements()), value),
components_(links.components()), links_(links)
{
};
@@ -181,7 +183,7 @@ namespace scribo
bool
object_groups<L>::is_valid() const
{
- mln_assertion(data_->components_.nelements() == (nelements() - 1));
+ mln_assertion(data_->components_.nelements() == (nelements()));
return data_->links_.is_valid();
}
@@ -227,6 +229,14 @@ namespace scribo
return output;
}
+ template <typename L>
+ void
+ object_groups<L>::init()
+ {
+ for (unsigned i = 0; i < nelements(); ++i)
+ data_->comp_to_group_(i) = i;
+ }
+
template <typename L>
std::ostream&
diff --git a/scribo/debug/save_bboxes_image.hh b/scribo/debug/save_bboxes_image.hh
index 356ea6e..ee479cc 100644
--- a/scribo/debug/save_bboxes_image.hh
+++ b/scribo/debug/save_bboxes_image.hh
@@ -92,7 +92,7 @@ namespace scribo
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
draw::bounding_boxes(tmp, bboxes, value);
- io::ppm::save(tmp, filename);
+ mln::io::ppm::save(tmp, filename);
trace::exiting("scribo::debug::save_bboxes_image");
}
diff --git a/scribo/filter/object_links_non_aligned_simple.hh
b/scribo/filter/object_links_non_aligned_simple.hh
index ae63527..e9dc5f5 100644
--- a/scribo/filter/object_links_non_aligned_simple.hh
+++ b/scribo/filter/object_links_non_aligned_simple.hh
@@ -110,7 +110,9 @@ namespace scribo
float max_alpha_rad = (max_alpha / 180.0f) * math::pi;
for_all_comps(i, comps)
- if (!internal::component_aligned_rad(comps, i, links(i), anchor, max_alpha_rad))
+ if (!::scribo::filter::internal::component_aligned_rad(comps, i, links(i),
+ anchor,
+ max_alpha_rad))
output(i) = i;
diff --git a/scribo/preprocessing/rotate_90.hh b/scribo/preprocessing/rotate_90.hh
index 616c341..bf93062 100644
--- a/scribo/preprocessing/rotate_90.hh
+++ b/scribo/preprocessing/rotate_90.hh
@@ -37,6 +37,7 @@
// FIXME: not generic
# include <mln/core/alias/dpoint2d.hh>
+//FIXME: add more preconditions + a dispatch !?
namespace scribo
{
diff --git a/scribo/primitive/group/from_double_link.hh
b/scribo/primitive/group/from_double_link.hh
index 14c5972..9367cfa 100644
--- a/scribo/primitive/group/from_double_link.hh
+++ b/scribo/primitive/group/from_double_link.hh
@@ -64,7 +64,6 @@ namespace scribo
\param[in] components A component set.
\param[in] left_link The left neighbor of each line of text.
\param[in] right_link The right neighbor of each line of text.
- \param[in] parent_link The function used to group components.
\return Return object groups information.
*/
diff --git a/scribo/primitive/group/from_single_link.hh
b/scribo/primitive/group/from_single_link.hh
index ffb2938..05efdc7 100644
--- a/scribo/primitive/group/from_single_link.hh
+++ b/scribo/primitive/group/from_single_link.hh
@@ -88,7 +88,13 @@ namespace scribo
if (!links.components()(i).is_valid())
parent(i) = 0;
else
- primitive::internal::find_root(parent, i);
+ ::scribo::primitive::internal::find_root(parent, i);
+
+
+ // FIXME: useful?
+ // Make sure the root is propagated.
+ for_all_groups(g, parent)
+ internal::find_root(parent, g);
trace::exiting("scribo::primitive::group::from_single_link");
return parent;
diff --git a/scribo/primitive/internal/find_root.hh
b/scribo/primitive/internal/find_root.hh
index 4fa6d20..aafa4ee 100644
--- a/scribo/primitive/internal/find_root.hh
+++ b/scribo/primitive/internal/find_root.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -23,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_PRIMITIVE_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
-# define SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
+#ifndef SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_HH
+# define SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_HH
/// \file
///
@@ -70,4 +71,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_LINK_ARRAY_HH
+#endif // ! SCRIBO_PRIMITIVE_INTERNAL_FIND_ROOT_HH
diff --git a/scribo/primitive/link/with_single_right_link_dmax_ratio.hh
b/scribo/primitive/link/with_single_right_link_dmax_ratio.hh
index dea51d1..03e2840 100644
--- a/scribo/primitive/link/with_single_right_link_dmax_ratio.hh
+++ b/scribo/primitive/link/with_single_right_link_dmax_ratio.hh
@@ -48,6 +48,7 @@
# include <scribo/primitive/link/internal/link_single_dmax_ratio_base.hh>
# include <scribo/primitive/link/compute.hh>
+# include <scribo/primitive/link/internal/dmax_default.hh>
namespace scribo
diff --git a/scribo/primitive/remove/separators.hh
b/scribo/primitive/remove/separators.hh
index 9b45919..11e9fee 100644
--- a/scribo/primitive/remove/separators.hh
+++ b/scribo/primitive/remove/separators.hh
@@ -84,8 +84,18 @@ namespace scribo
mln_precondition(separators.is_valid());
mln_concrete(I) output = duplicate(input);
- data::fill((output | (pw::value(separators) == pw::cst(true))).rw(),
- false);
+
+ border::resize(separators, output.border());
+
+ typedef const mln_value(I)* sep_ptr_t;
+ sep_ptr_t
+ sep_ptr = separators.buffer(),
+ end_ptr = sep_ptr + input.nelements();
+ mln_value(I) *out_ptr = output.buffer();
+
+ for (; sep_ptr < end_ptr; ++out_ptr)
+ if (*sep_ptr++)
+ *out_ptr = false;
trace::exiting("scribo::primitive::remove::separators");
return output;
diff --git a/scribo/subsampling/bilinear.hh b/scribo/subsampling/bilinear.hh
index cb95a11..534865a 100644
--- a/scribo/subsampling/bilinear.hh
+++ b/scribo/subsampling/bilinear.hh
@@ -67,7 +67,7 @@ namespace scribo
mln_piter(I) p(output.domain());
mln_value(I) pixels[4];
- def::coord
+ mln::def::coord
x_offset = input.domain().pmin().col(),
y_offset = input.domain().pmin().row();
diff --git a/scribo/text/merging.hh b/scribo/text/merging.hh
index 7e943ef..8efd210 100644
--- a/scribo/text/merging.hh
+++ b/scribo/text/merging.hh
@@ -386,7 +386,7 @@ namespace scribo
// Special case
// Looking for alignement.
- def::coord
+ mln::def::coord
top_row = l_cur.bbox().pmin().row(),
bot_row = l_cur.bbox().pmax().row();
diff --git a/scribo/upsampling/bs2x.hh b/scribo/upsampling/bs2x.hh
index 6ff8546..c701e47 100644
--- a/scribo/upsampling/bs2x.hh
+++ b/scribo/upsampling/bs2x.hh
@@ -72,7 +72,7 @@ namespace scribo
typedef mln_value(I) V;
- def::coord
+ mln::def::coord
mrow = geom::min_row(input),
mcol = geom::min_col(input);
@@ -83,7 +83,7 @@ namespace scribo
mcol + 2 * input.ncols() - 1));
for_all(p)
{
- def::coord
+ mln::def::coord
row = mrow + 2 * (p.row() - mrow),
col = mcol + 2 * (p.col() - mcol);
--
1.5.6.5