Commit 8c069f07 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

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.
parent ca67a57f
2010-05-25 Guillaume Lazzara <z@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@lrde.epita.fr>
Store OCR results in the line_info structure.
......
......@@ -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&
......
......@@ -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");
}
......
......@@ -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;
......
......@@ -37,6 +37,7 @@
// FIXME: not generic
# include <mln/core/alias/dpoint2d.hh>
//FIXME: add more preconditions + a dispatch !?
namespace scribo
{
......
......@@ -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.
*/
......
......@@ -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;
......
// 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
......@@ -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
......
......@@ -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;
......
......@@ -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();
......
......@@ -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();
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment