---
scribo/ChangeLog | 9 ++
scribo/scribo/inverse_video/choose.hh | 118 ++++++++++++++++++++++
scribo/scribo/inverse_video/handle_collisions.hh | 15 ++--
scribo/scribo/inverse_video/nb_comps.hh | 103 +++++++++++++++++++
scribo/scribo/inverse_video/ratio_area.hh | 93 +++++++++++++++++
5 files changed, 331 insertions(+), 7 deletions(-)
create mode 100644 scribo/scribo/inverse_video/choose.hh
create mode 100644 scribo/scribo/inverse_video/nb_comps.hh
create mode 100644 scribo/scribo/inverse_video/ratio_area.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 0c7b65f..3fbee9e 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-27 Sylvain Lobry <lobry(a)lrde.epita.fr>
+
+ Added a choose function, to be used with handle_collisions.
+
+ * scribo/inverse_video/handle_collisions.hh: Prototype fixed.
+ * scribo/inverse_video/choose.hh,
+ * scribo/inverse_video/nb_comps.hh,
+ * scribo/inverse_video/ratio_area.hh: New.
+
2011-05-26 Coddy Levi <levi(a)lrde.epita.fr>
Bug corrected, several improvements, interface modified.
diff --git a/scribo/scribo/inverse_video/choose.hh b/scribo/scribo/inverse_video/choose.hh
new file mode 100644
index 0000000..9b0d46e
--- /dev/null
+++ b/scribo/scribo/inverse_video/choose.hh
@@ -0,0 +1,118 @@
+// 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 SCRIBO_INVERSE_VIDEO_CHOOSE_HH
+# define SCRIBO_INVERSE_VIDEO_CHOOSE_HH
+
+/// \file
+///
+/// \brief Choose beetwen two lines.
+
+# include <scribo/core/line_set.hh>
+# include <scribo/inverse_video/nb_comps.hh>
+# include <scribo/inverse_video/ratio_area.hh>
+# include <iostream>
+
+namespace scribo
+{
+
+ namespace inverse_video
+ {
+ /// Choose the most meaningful line between two.
+ /*!
+ ** \param[in] input The input image.
+ ** \param[in] line The first line.
+ ** \param[in] line_inverse The second line
+ **
+ ** \return void
+ */
+ template <typename L, typename I>
+ static inline
+ void
+ choose (mln::image2d<I>& input,
+ scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+ template <typename I, typename L>
+ static inline
+ void
+ handle_score (double score,
+ I& image,
+ scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse)
+ {
+ if (score > 0.5)
+ {
+ mln::draw::box(image, line.bbox(), mln::literal::green);
+ mln::draw::box(image, line_inverse.bbox(), mln::literal::red);
+ line_inverse.update_tag(scribo::line::Ignored);
+ line_inverse.set_hidden(true);
+ std::cout << "normal choosed" << std::endl;
+ }
+ else
+ {
+ mln::draw::box(image, line_inverse.bbox(), mln::literal::green);
+ mln::draw::box(image, line.bbox(), mln::literal::red);
+ line.update_tag(scribo::line::Ignored);
+ line.set_hidden(true);
+ std::cout << "inverse choosed" << std::endl;
+ }
+ }
+ } // end of namespace scribo::text::internal
+
+ template <typename L, typename I>
+ static inline
+ void
+ choose (mln::image2d<I>& input,
+ scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse)
+ {
+ mln::trace::entering("scribo::inverse_video::choose");
+
+ double score = 0;
+
+ double score_nb_comps = scribo::inverse_video::nb_comps(line, line_inverse);
+ double score_ratio_area = scribo::inverse_video::ratio_area(line, line_inverse);
+
+ score =
+ score_nb_comps * 0.5 +
+ score_ratio_area * 0.5;
+
+ scribo::inverse_video::internal::handle_score (score, input, line, line_inverse);
+
+ mln::trace::exiting("scribo::inverse_video::choose");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::inverse_video
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_INVERSE_VIDEO_CHOOSE_HH
diff --git a/scribo/scribo/inverse_video/handle_collisions.hh b/scribo/scribo/inverse_video/handle_collisions.hh
index 4a772c3..3d27599 100644
--- a/scribo/scribo/inverse_video/handle_collisions.hh
+++ b/scribo/scribo/inverse_video/handle_collisions.hh
@@ -44,14 +44,14 @@ namespace scribo
{
template <typename I,
- typename L,
- typename F>
+ typename L>
void
- handle_collisions(const image2d<I>& input,
+ handle_collisions(image2d<I>& input,
scribo::line_set<L>& ls1,
scribo::line_set<L>& ls2,
- F choose);
-
+ void (*choose)(image2d<I>&,
+ scribo::line_info<L>&,
+ scribo::line_info<L>&));
# ifndef MLN_INCLUDE_ONLY
namespace internal
@@ -90,7 +90,8 @@ namespace scribo
handle_collisions(image2d<I>& input,
scribo::line_set<L>& ls1,
scribo::line_set<L>& ls2,
- void (*choose)(scribo::line_info<L>&,
+ void (*choose)(image2d<I>&,
+ scribo::line_info<L>&,
scribo::line_info<L>&))
{
mln::trace::entering("scribo::inverse_video::handle_collisions");
@@ -158,7 +159,7 @@ namespace scribo
|| !l_tested.is_valid() || l_tested.is_hidden())
continue;
- choose(ls(l), l_tested);
+ choose(input, ls(l), l_tested);
if (ls(l).is_hidden())
break;
diff --git a/scribo/scribo/inverse_video/nb_comps.hh b/scribo/scribo/inverse_video/nb_comps.hh
new file mode 100644
index 0000000..e067d1a
--- /dev/null
+++ b/scribo/scribo/inverse_video/nb_comps.hh
@@ -0,0 +1,103 @@
+// 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 SCRIBO_INVERSE_VIDEO_NB_COMPS_HH
+# define SCRIBO_INVERSE_VIDEO_NB_COMPS_HH
+
+/// \file
+///
+/// \brief Choose beetwen two lines according to the number of
+/// components they have.
+
+# include <scribo/core/line_set.hh>
+
+namespace scribo
+{
+
+ namespace inverse_video
+ {
+ /// Count the number of big enough components in each line and
+ /// choose the one which have the most.
+ /*!
+ ** \param[in] line The first line.
+ ** \param[in] line_inverse The second line
+ **
+ ** \return A double : if it is close to 0, it means the second line is
+ ** more likely to be the right one. As opposite, if it is closer
+ ** to 1, it means the first one should be the good one.
+ */
+ template <typename L>
+ double
+ nb_comps (scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ double
+ nb_comps (scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse)
+ {
+ mln::trace::entering("scribo::inverse_video::nb_comps");
+ unsigned max_normal = 0;
+ unsigned nb_comps_normal = 0;
+ unsigned max_inverse = 0;
+ unsigned nb_comps_inverse = 0;
+
+
+ const scribo::component_set<L> comps_normal = line.holder ().components ();
+ const scribo::component_set<L> comps_inverse = line_inverse.holder ().components ();
+
+
+ for (unsigned i = 0; i < line.component_ids().nelements(); ++i)
+ if (comps_normal((line.component_ids())[i]).bbox().nsites() > max_normal)
+ max_normal = comps_normal((line.component_ids())[i]).bbox().nsites();
+
+ for (unsigned i = 0; i < line_inverse.component_ids().nelements(); ++i)
+ if (comps_inverse((line_inverse.component_ids())[i]).bbox().nsites() > max_inverse)
+ max_inverse = comps_inverse((line_inverse.component_ids())[i]).bbox().nsites();
+
+
+
+ for (unsigned i = 0; i < line.component_ids().nelements(); ++i)
+ if (comps_normal((line.component_ids())[i]).bbox().nsites() > max_normal / 30)
+ ++nb_comps_normal;
+
+ for (unsigned i = 0; i < line_inverse.component_ids().nelements(); ++i)
+ if (comps_inverse((line_inverse.component_ids())[i]).bbox().nsites() > max_inverse / 30)
+ ++nb_comps_inverse;
+
+
+ mln::trace::exiting("scribo::inverse_video::nb_comps");
+ return (double)(nb_comps_normal) / (double)((nb_comps_normal + nb_comps_inverse));
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::inverse_video
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_INVERSE_VIDEO_NB_COMPS_HH
diff --git a/scribo/scribo/inverse_video/ratio_area.hh b/scribo/scribo/inverse_video/ratio_area.hh
new file mode 100644
index 0000000..db39f36
--- /dev/null
+++ b/scribo/scribo/inverse_video/ratio_area.hh
@@ -0,0 +1,93 @@
+// 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 SCRIBO_INVERSE_VIDEO_RATIO_AREA_HH
+# define SCRIBO_INVERSE_VIDEO_RATIO_AREA_HH
+
+/// \file
+///
+/// \brief Choose beetwen two lines according to the ratio of
+/// components area on the total area.
+
+# include <scribo/core/line_set.hh>
+
+namespace scribo
+{
+
+ namespace inverse_video
+ {
+ /// Choose the line where the ratio of components area is the highest
+ /*!
+ ** \param[in] line The first line.
+ ** \param[in] line_inverse The second line
+ **
+ ** \return A double : if it is close to 0, it means the second line is
+ ** more likely to be the right one. As opposite, if it is closer
+ ** to 1, it means the first one should be the good one.
+ */
+ template <typename L>
+ double
+ ratio_area (scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ double
+ ratio_area (scribo::line_info<L>& line,
+ scribo::line_info<L>& line_inverse)
+ {
+ mln::trace::entering("scribo::inverse_video::ratio_area");
+
+ double area_comps_normal = 0;
+ double area_comps_inverse = 0;
+
+ const scribo::component_set<L> comps_normal = line.holder ().components ();
+ const scribo::component_set<L> comps_inverse = line_inverse.holder ().components ();
+
+ const mln::util::array<scribo::component_id_t>& comps_id_normal = line.component_ids();
+ const mln::util::array<scribo::component_id_t>& comps_id_inverse = line_inverse.component_ids();
+
+ for (unsigned i = 0; i < comps_id_normal.nelements(); ++i)
+ area_comps_normal += comps_normal(comps_id_normal[i]).bbox().nsites();
+
+ for (unsigned i = 0; i < comps_id_inverse.nelements(); ++i)
+ area_comps_inverse += comps_inverse(comps_id_inverse[i]).bbox().nsites();
+
+ area_comps_inverse /= line_inverse.bbox().nsites();
+ area_comps_normal /= line.bbox().nsites();
+
+ mln::trace::exiting("scribo::inverse_video::ratio_area");
+
+ return (area_comps_normal / (area_comps_normal + area_comps_inverse));
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::inverse_video
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_INVERSE_VIDEO_RATIO_AREA_HH
--
1.5.6.5
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 coddy has been updated
via 48ee1a9e41f4ae7bbea18551d5cf69bc88e82ac0 (commit)
from 9a5768720038f180173bc7c600fdf6b77bbfe7ab (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
48ee1a9 Bug corrected, several improvements, interface modified.
-----------------------------------------------------------------------
Summary of changes:
scribo/ChangeLog | 6 +++
scribo/scribo/inverse_video/handle_collisions.hh | 50 +++++++--------------
2 files changed, 23 insertions(+), 33 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
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 icdar/hdlac2011 has been updated
via d777dff6866692be0fd5311f6c950011e0d86318 (commit)
from 7415119f80fca7ad9dd1b015c8c91e15030d0588 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
d777dff Paragraphs closing
-----------------------------------------------------------------------
Summary of changes:
scribo/scribo/core/line_info.hh | 2 -
scribo/scribo/core/paragraph_info.hh | 18 +++
scribo/scribo/core/paragraph_set.hh | 84 +++++++++++-
scribo/scribo/core/stats.hh | 40 ++++--
scribo/scribo/draw/line_components.hh | 113 ++++++++++++++++
scribo/scribo/text/paragraphs.hh | 65 +---------
scribo/scribo/text/paragraphs_closing.hh | 208 ++++++++++++++++++++++++++++++
7 files changed, 443 insertions(+), 87 deletions(-)
create mode 100644 scribo/scribo/draw/line_components.hh
create mode 100644 scribo/scribo/text/paragraphs_closing.hh
hooks/post-receive
--
Olena, a generic and efficient image processing platform
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 icdar/hdlac2011 has been updated
via 7415119f80fca7ad9dd1b015c8c91e15030d0588 (commit)
from 58b6a662ab8baecf54514930cebe761fbd9e0e32 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
7415119 scribo/util/component_precise_outline.hh: Fix namespace ambiguity.
-----------------------------------------------------------------------
Summary of changes:
scribo/ChangeLog | 5 +++++
scribo/scribo/util/component_precise_outline.hh | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
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 icdar/hdlac2011 has been updated
discards 118f203ff8c90a367f78502c3b5ecc1883180f86 (commit)
discards 12da563c7ea1fba00e47b8cdb9adf526421218d2 (commit)
discards ebfb6d5d15d50abe54ce41cb88b243c7b03b1935 (commit)
via 58b6a662ab8baecf54514930cebe761fbd9e0e32 (commit)
via 46636f57bf3f360ae661412a50f2b2a808e14f90 (commit)
via 3a15c0260477b4d491a594cc852f8994dd1eef1d (commit)
via 532805f671d39082c9c62414be4c3266e03609bf (commit)
via 9f7843c9c01df078d600f898bf0ea5d2398aebd1 (commit)
via 0a594b3dad7545235b2997ea4ba4547363f4c1ab (commit)
via eb7b2bd077b0fc4256545e37e19af37ed9c4d25e (commit)
via e32f2ebf7a08cee79f727ac55ea902dbd58cd515 (commit)
via 1d411c7c9dd03993cf3e45f9e2835bba1d1b6e5d (commit)
via e06be54cf5ffe080b2268704caf56e2962ff4d2c (commit)
via f28dd55983ff67c868ef37ddecfc7a29da91c61f (commit)
via 02ab025088bb3639de1f2d934900311915267254 (commit)
via efa07ad7381d92b81cc58e2b0acb780f3922be6e (commit)
via 0d80a703e96d8c16a09f592f4dfa2846eadd696e (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (118f203ff8c90a367f78502c3b5ecc1883180f86)
\
N -- N -- N (58b6a662ab8baecf54514930cebe761fbd9e0e32)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
58b6a66 Improve XML output.
46636f5 Improve and cleanup Results in hdoc toolchain.
3a15c02 scribo/primitive/extract/lines_h_thick_and_thin.hh: Improve result quality.
532805f Add new hooks in toolchain functors.
9f7843c scribo/util/component_precise_outline.hh: New. Precise component outline extraction.
0a594b3 Add new element filters.
eb7b2bd Add util::box_intersection.
e32f2eb mln/draw/site_set.hh: new.
1d411c7 Various small fixes in Scribo.
e06be54 Introduce paragraph_id_t type.
f28dd55 Share document structure data.
02ab025 Deep modifications and clean correction of the previous bug.
efa07ad Further correction of the component outlining bug.
0d80a70 Correct a bug in the compononent outlining algorithm.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 4 +
milena/mln/draw/site_set.hh | 88 ++++++
scribo/ChangeLog | 104 +++++++
scribo/scribo/core/document.hh | 171 +++++++----
scribo/scribo/core/paragraph_info.hh | 15 +-
scribo/scribo/core/paragraph_set.hh | 49 +++-
scribo/scribo/core/tag/line.hh | 2 +-
scribo/scribo/core/tag/paragraph.hh | 43 +++
scribo/scribo/debug/line_info_image.hh | 5 +-
scribo/scribo/filter/images_in_paragraph.hh | 119 ++++++++
scribo/scribo/filter/object_links_bbox_overlap.hh | 25 +--
scribo/scribo/filter/paragraphs_bbox_overlap.hh | 176 +++++++++++
scribo/scribo/filter/paragraphs_in_image.hh | 129 ++++++++
scribo/scribo/filter/separators_in_element.hh | 151 ++++++++++
scribo/scribo/filter/separators_in_paragraph.hh | 151 ++++++++++
scribo/scribo/io/img/internal/debug_img_visitor.hh | 130 +++++----
scribo/scribo/io/img/internal/full_img_visitor.hh | 42 ++--
.../io/xml/internal/extended_page_xml_visitor.hh | 81 +++---
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 79 +++---
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 58 ++--
scribo/scribo/primitive/extract/alignments.hh | 12 +-
.../primitive/extract/lines_h_thick_and_thin.hh | 16 +-
scribo/scribo/primitive/extract/lines_pattern.hh | 2 +-
scribo/scribo/primitive/extract/non_text_hdoc.hh | 34 ++-
.../primitive/extract/separators_nonvisible.hh | 6 +-
.../scribo/primitive/group/from_double_link_any.hh | 7 +-
scribo/scribo/text/link_lines.hh | 2 +-
scribo/scribo/text/merging.hh | 37 ++-
scribo/scribo/text/paragraphs.hh | 18 +-
.../toolchain/internal/content_in_doc_functor.hh | 4 +
.../toolchain/internal/content_in_hdoc_functor.hh | 201 +++++++-------
.../toolchain/internal/text_in_doc_functor.hh | 4 +
.../internal/text_in_doc_preprocess_functor.hh | 53 ++++-
.../scribo/toolchain/internal/toolchain_functor.hh | 28 ++-
scribo/scribo/util/box_intersection.hh | 85 ++++++
scribo/scribo/util/component_precise_outline.hh | 309 ++++++++++++++++++++
.../primitive/extract/lines_h_thick_and_thin.cc | 1 +
scribo/tests/primitive/extract/Makefile.am | 2 +-
38 files changed, 2007 insertions(+), 436 deletions(-)
create mode 100644 milena/mln/draw/site_set.hh
create mode 100644 scribo/scribo/core/tag/paragraph.hh
create mode 100644 scribo/scribo/filter/images_in_paragraph.hh
create mode 100644 scribo/scribo/filter/paragraphs_bbox_overlap.hh
create mode 100644 scribo/scribo/filter/paragraphs_in_image.hh
create mode 100644 scribo/scribo/filter/separators_in_element.hh
create mode 100644 scribo/scribo/filter/separators_in_paragraph.hh
create mode 100644 scribo/scribo/util/box_intersection.hh
create mode 100644 scribo/scribo/util/component_precise_outline.hh
hooks/post-receive
--
Olena, a generic and efficient image processing platform