Commit 898100c1 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Merge branch 'icdar/hdlac2011' into unstable/scribo

Conflicts:
	scribo/scribo/text/paragraphs.hh: Renamed as extract_paragraphs.hh.
parents 3a86ff37 98288f48
2011-06-07 Guillaume Lazzara <z@lrde.epita.fr>
* configure.ac: Configure scribo/src/util.
2011-06-07 Guillaume Lazzara <z@lrde.epita.fr>
* configure.ac: Configure ICDAR contests directories.
2011-05-05 Guillaume Lazzara <lazzara@fidji.lrde.epita.fr>
* configure.ac: Configure scribo/tests/util.
......
......@@ -323,6 +323,8 @@ AC_CONFIG_FILES([
scribo/src/binarization/Makefile
scribo/src/contest/Makefile
scribo/src/contest/hdibco-2010/Makefile
scribo/src/contest/hdlac-2011/Makefile
scribo/src/contest/DAE-2011/Makefile
scribo/src/debug/Makefile
scribo/src/filter/Makefile
scribo/src/misc/Makefile
......@@ -337,6 +339,7 @@ AC_CONFIG_FILES([
scribo/src/text/Makefile
scribo/src/toolchain/Makefile
scribo/src/toolchain/nepomuk/Makefile
scribo/src/util/Makefile
])
AC_CONFIG_FILES([scribo/tests/data.hh])
......
2011-06-28 Guillaume Lazzara <z@lrde.epita.fr>
* mln/morpho/skeleton_constrained.hh: Add a missing include.
2011-06-28 Guillaume Lazzara <z@lrde.epita.fr>
* mln/border/equalize.hh: Fix an invalid assertion.
2011-06-27 Guillaume Lazzara <z@lrde.epita.fr>
* mln/debug/draw_graph.hh: Limit the use of exact().
2011-06-07 Guillaume Lazzara <z@lrde.epita.fr>
* mln/draw/polygon.hh: New.
2011-06-07 Guillaume Lazzara <z@lrde.epita.fr>
Add a missing conversion routine for object ids.
* mln/convert/from_to.hxx,
* mln/util/object_id.hh: Here.
2011-05-26 Guillaume Lazzara <z@lrde.epita.fr>
* mln/draw/site_set.hh: new.
2011-05-17 Guillaume Lazzara <z@lrde.epita.fr>
Add new sample programs.
* src/debug/Makefile.am: New targets.
* src/debug/show_groups_bboxes_filtered.cc,
* src/debug/show_text_lines_wo_seps.cc: New.
2011-05-17 Guillaume Lazzara <z@lrde.epita.fr>
 
Fix precision issue with algebra::vec conversion.
......@@ -93,7 +93,7 @@ namespace mln
}
else
{
mln_assertion(b2 < min_thickness);
//mln_assertion(b2 < min_thickness); // why ?
mln_assertion(b1 >= min_thickness);
border::resize(ima2, b1);
}
......
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
......@@ -84,6 +84,7 @@ namespace mln
namespace util {
template <typename T> class array;
template <typename Tag, typename V> class object_id;
}
namespace value {
......@@ -473,6 +474,10 @@ namespace mln
from_to(from.second(), to.second());
}
// util::object_id<Tag,V> -> V.
template <typename Tag, typename V>
void from_to_(const util::object_id<Tag,V>& from, V& to_);
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
......
......@@ -37,6 +37,7 @@
# include <mln/util/line_graph.hh>
# include <mln/util/site_pair.hh>
# include <mln/draw/line.hh>
# include <mln/draw/box_plain.hh>
# include <mln/data/fill.hh>
# include <mln/metal/equal.hh>
......@@ -107,24 +108,27 @@ namespace mln
template <typename I, typename G, typename F>
inline
void
draw_graph(Image<I>& ima,
draw_graph(Image<I>& ima_,
const p_edges<G, F>& pe,
mln_value(I) vcolor,
mln_value(I) ecolor)
{
trace::entering("debug::draw_graph");
I& ima = exact(ima_);
mln_precondition(ima.is_valid());
// Draw edges.
typedef p_edges<G, F> pe_t;
mln_piter(pe_t) p(pe);
for_all(p)
{
if (exact(ima).has(p.first()) && exact(ima).has(p.second()))
draw::line(exact(ima), p.first(), p.second(), ecolor);
if (exact(ima).has(p.first()))
exact(ima)(p.first()) = vcolor;
if (exact(ima).has(p.second()))
exact(ima)(p.second()) = vcolor;
if (ima.has(p.first()) && ima.has(p.second()))
draw::line(ima, p.first(), p.second(), ecolor);
if (ima.has(p.first()))
ima(p.first()) = vcolor;
if (ima.has(p.second()))
ima(p.second()) = vcolor;
}
trace::exiting("debug::draw_graph");
......@@ -134,25 +138,28 @@ namespace mln
template <typename I, typename G, typename F>
inline
void
draw_graph(Image<I>& ima,
draw_graph(Image<I>& ima_,
const p_vertices<G, F>& pv,
mln_value(I) vcolor,
mln_value(I) ecolor)
{
trace::entering("debug::draw_graph");
I& ima = exact(ima_);
mln_precondition(ima.is_valid());
// Draw edges.
const G& g = pv.graph();
typedef p_vertices<G, F> pv_t;
mln_edge_iter(G) ei(g);
for_all(ei)
draw::line(exact(ima), pv(ei.v1()), pv(ei.v2()), ecolor);
draw::line(ima, pv(ei.v1()), pv(ei.v2()), ecolor);
// Draw vertices.
mln_piter(pv_t) p(pv);
for_all(p)
if (exact(ima).has(p))
exact(ima)(p) = vcolor;
if (ima.has(p))
ima(p) = vcolor;
trace::exiting("debug::draw_graph");
}
......@@ -162,27 +169,34 @@ namespace mln
template <typename I, typename G, typename F, typename V, typename E>
inline
void
draw_graph(Image<I>& ima,
draw_graph(Image<I>& ima_,
const p_vertices<G, F>& pv,
const Function<V>& vcolor_f_, const Function<E>& ecolor_f_)
{
trace::entering("debug::draw_graph");
I& ima = exact(ima_);
const V& vcolor_f = exact(vcolor_f_);
const E& ecolor_f = exact(ecolor_f_);
mln_precondition(ima.is_valid());
// Draw edges.
const G& g = pv.graph();
typedef p_vertices<G, F> pv_t;
mln_edge_iter(G) ei(g);
for_all(ei)
draw::line(exact(ima), pv(ei.v1()), pv(ei.v2()), ecolor_f(ei.id()));
if (ei.v1() != 0 && ei.v2() != 0)
draw::line(ima, pv(ei.v1()), pv(ei.v2()), ecolor_f(ei.id()));
// Draw vertices.
mln_piter(pv_t) p(pv);
for_all(p)
if (exact(ima).has(p))
exact(ima)(p) = vcolor_f(p);
if (ima.has(p) && p.id() != 0u)
{
box2d box(p + dpoint2d(-5, -5), p + dpoint2d(+5, +5));
draw::box_plain(ima, box, vcolor_f(p.id()));
}
trace::exiting("debug::draw_graph");
}
......@@ -192,15 +206,18 @@ namespace mln
template <typename I, typename G, typename F, typename V, typename E>
inline
void
draw_graph(Image<I>& ima,
draw_graph(Image<I>& ima_,
const p_vertices<util::line_graph<G>, F>& pv,
const Function<V>& vcolor_f_, const Function<E>& ecolor_f_)
{
trace::entering("debug::draw_graph");
I& ima = exact(ima_);
const V& vcolor_f = exact(vcolor_f_);
const E& ecolor_f = exact(ecolor_f_);
mln_precondition(ima.is_valid());
typedef util::line_graph<G> LG;
const LG& lg = pv.graph();
......@@ -211,13 +228,13 @@ namespace mln
{
p_line2d l = pv(vi.id());
// Draw edges (Line graph vertices).
draw::line(exact(ima), l.begin(), l.end(), ecolor_f(vi.id()));
draw::line(ima, l.begin(), l.end(), ecolor_f(vi.id()));
// Draw vertices (graph vertices).
if (exact(ima).has(l.begin()))
exact(ima)(l.begin()) = vcolor_f(g.edge(vi).v1());
if (exact(ima).has(l.end()))
exact(ima)(l.end()) = vcolor_f(g.edge(vi).v2());
if (ima.has(l.begin()))
ima(l.begin()) = vcolor_f(g.edge(vi).v1());
if (ima.has(l.end()))
ima(l.end()) = vcolor_f(g.edge(vi).v2());
}
trace::exiting("debug::draw_graph");
......
// 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/>.
//
// 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 inpolygon 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 MLN_DRAW_POLYGON_HH
# define MLN_DRAW_POLYGON_HH
/// \file
///
/// Draw a polygon in an image.
/// \fixme Add specializations for horizontal polygons (use pointers/memset).
# include <mln/core/concept/image.hh>
# include <mln/core/site_set/p_array.hh>
# include <mln/draw/line.hh>
namespace mln
{
namespace draw
{
/*! Draw a polygon at level \p v in image \p ima.
*
* \param[in,out] ima The image to be drawn.
* \param[in] par The polygon site set.
* \param[in] v The value to assign to all drawn pixels.
*
* \pre \p ima has to be initialized.
*
*/
template <typename I>
void polygon(Image<I>& ima,
const p_array<mln_site(I)>& par,
const mln_value(I)& v,
unsigned output_ratio);
// \overload
template <typename I>
void polygon(Image<I>& ima,
const p_array<mln_site(I)>& par,
const mln_value(I)& v);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
void polygon(Image<I>& ima_,
const p_array<mln_site(I)>& par,
const mln_value(I)& v,
unsigned output_ratio)
{
I& ima = exact(ima_);
mln_precondition(ima.is_valid());
mln_precondition(par.nelements() > 1);
mln_site(I) p_last, tmp;
mln_piter(p_array<mln_site(I)>) p(par);
p_last = par[0] / output_ratio;
for_all(p)
{
tmp = p / output_ratio;
draw::line(ima, p_last, tmp, v);
p_last = tmp;
}
}
template <typename I>
void polygon(Image<I>& ima,
const p_array<mln_site(I)>& par,
const mln_value(I)& v)
{
polygon(ima, par, v, 1);
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::draw
} // end of namespace mln
#endif // ! MLN_DRAW_POLYGON_HH
// 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/>.
//
// 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 MLN_DRAW_SITE_SET_HH
# define MLN_DRAW_SITE_SET_HH
/*! \file
*
* \brief Draw a site set in an image.
*
*/
# include <mln/core/concept/image.hh>
# include <mln/core/concept/site_set.hh>
namespace mln
{
namespace draw
{
/*! Draw a sites with value \p v in image \p ima
*
* \param[in,out] ima The image to be drawn.
* \param[in] b the site set to draw.
* \param[in] v The value to assign to all drawn pixels.
* \param[in] output_ratio size ratio between output image and the
* image from which the bboxes were calculated.
*
* \pre \p s is included in \p ima domain.
*
*/
template <typename I, typename S>
void site_set(Image<I>& ima,
const Site_Set<S>& s,
const mln_value(I)& v,
unsigned output_ratio = 1);
# ifndef MLN_INCLUDE_ONLY
template <typename I, typename S>
void site_set(Image<I>& ima_,
const Site_Set<S>& s_,
const mln_value(I)& v,
unsigned output_ratio)
{
mln_precondition(exact(ima).is_valid());
mln_precondition(exact(ima).domain() >= exact(s));
I& ima = exact(ima_);
const S& s = exact(s_);
mln_piter(S) p(s);
for_all(p)
ima(p / output_ratio) = v;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::draw
} // end of namespace mln
#endif // ! MLN_DRAW_SITE_SET_HH
......@@ -38,6 +38,7 @@
# include <mln/core/site_set/p_queue_fast.hh>
# include <mln/core/site_set/p_priority.hh>
# include <mln/extension/adjust_duplicate.hh>
# include <mln/extension/adjust_fill.hh>
# include <mln/data/fill.hh>
# include <mln/util/timer.hh>
......
......@@ -38,6 +38,24 @@
namespace mln
{
// Forward declaration
namespace util { template <typename Tag, typename V> class object_id; }
namespace convert
{
namespace over_load
{
// object_id<Tag,V> -> V.
template <typename Tag, typename V>
void from_to_(const util::object_id<Tag,V>& from, V& to_);
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
namespace util
{
......@@ -90,9 +108,12 @@ namespace mln
bool
operator<(const object_id<Tag,V>& lhs, const object_id<Tag,V>& rhs);
} // end of namespace mln::util
# ifndef MLN_INCLUDE_ONLY
namespace util
{
template <typename Tag, typename V>
inline
......@@ -205,10 +226,26 @@ namespace mln
return lhs.value() < rhs.value();
}
} // end of namespace mln::util
# endif // ! MLN_INCLUDE_ONLY
namespace convert
{
} // end of namespace mln::util
namespace over_load
{
// object_id<Tag,V> -> V.
template <typename Tag, typename V>
void from_to_(const util::object_id<Tag,V>& from, V& to_)
{
to_ = from.value();
}
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
......
2011-07-01 Guillaume Lazzara <z@lrde.epita.fr>
* scribo/text/paragraphs.hh: Adding horizontal separators check in
paragraphs construction.
2011-06-28 Guillaume Lazzara <z@lrde.epita.fr>
Regen generated files.
* headers.mk,
* tests/unit_test/unit-tests.mk: Here.
2011-06-28 Guillaume Lazzara <z@lrde.epita.fr>
Fix compilation.
* scribo/core/object_groups.hh,
* scribo/debug/logger.hh,
* scribo/estim/object_groups_mean_width.hh,
* src/debug/show_paragraph_blocks.cc,
* src/debug/show_text_lines.cc,
* src/non_text_components.cc,
* src/primitive/extract/alignments.cc,
* scribo/text/extract_paragraphs_hdoc.hh: Fix namespace ambiguities.
* scribo/core/object_links.hh: Remove useless find_root().
* scribo/debug/bboxes_enlarged_image.hh,
* scribo/debug/looks_like_a_text_line_image.hh: Update includes.
* scribo/filter/images_in_paragraph.hh,
* scribo/filter/paragraphs_bbox_overlap.hh,
* scribo/filter/paragraphs_in_image.hh,
* scribo/filter/separators_in_element.hh,
* scribo/filter/separators_in_paragraph.hh,
* scribo/io/img/internal/debug_img_visitor.hh,
* scribo/io/img/internal/full_img_visitor.hh,
* scribo/io/xml/internal/compute_text_colour.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh,
* scribo/io/xml/internal/time_info.hh,
* scribo/postprocessing/images_to_drop_capital.hh,
* scribo/primitive/remove/separators.hh,
* scribo/text/extract_paragraphs.hh,
* scribo/text/paragraphs_closing.hh,
* scribo/toolchain/internal/content_in_hdoc_functor.hh: Add
missing includes.
* scribo/io/xml/load.hh: Fix string conversions.
* scribo/primitive/group/from_double_link.hh
* scribo/primitive/link/with_several_left_links.hh
* scribo/primitive/link/with_several_right_links.hh
* src/afp/link.hh: Update according new API in
object_groups/links.
* src/text_in_picture.cc,
* src/text_in_picture_neg.cc,
* src/text_recognition_in_picture.cc: Update a routine name.
2011-06-27 Guillaume Lazzara <z@lrde.epita.fr>
* scribo/toolchain/internal/content_in_doc_functor.hh: Add a
timer.
2011-06-27 Guillaume Lazzara <z@lrde.epita.fr>
Fix XML output.
* demo/viewer/viewer.cc,
* demo/viewer/xml_widget.cc: Update tag names.
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/save.hh: Save component outlines.
2011-06-27 Guillaume Lazzara <z@lrde.epita.fr>
Fix compilation issues.
* scribo/core/component_features_data.hh,
* scribo/core/group_info.hh,
* scribo/io/xml/internal/compute_text_colour.hh,
* scribo/io/xml/internal/time_info.hh,
* scribo/util/color_to_hex.hh,
* scribo/util/component_precise_outline.hh: Add missing inline.
* scribo/toolchain/internal/text_in_doc_preprocess_functor.hh: Add
a missing include.
2011-06-20 Guillaume Lazzara <z@lrde.epita.fr>
Make different algorithms for doc and hdoc use cases.
* scribo/core/paragraph_set.hh: Add an overload of
make::paragraph().
* scribo/text/paragraphs.hh: Move...
* scribo/text/extract_paragraphs.hh,
* scribo/text/extract_paragraphs_hdoc.hh: ... here.
* scribo/text/merging.hh: Remove holder() calls.