Olena-patches
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
14 Mar '11
* scribo/core/internal/doc_xml_serializer.hh: Rename as...
* scribo/core/internal/doc_serializer.hh: ... this.
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh: Update inheritance.
---
scribo/ChangeLog | 11 +++++++++
.../{doc_xml_serializer.hh => doc_serializer.hh} | 24 ++++++++++----------
.../io/xml/internal/extended_page_xml_visitor.hh | 3 +-
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 4 +-
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 4 +-
5 files changed, 29 insertions(+), 17 deletions(-)
rename scribo/scribo/core/internal/{doc_xml_serializer.hh => doc_serializer.hh} (80%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 33b036a..1de58fe 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,16 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Rename document serializer base class.
+
+ * scribo/core/internal/doc_xml_serializer.hh: Rename as...
+ * scribo/core/internal/doc_serializer.hh: ... this.
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh,
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/internal/page_xml_visitor.hh: Update inheritance.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Store more information in scribo::document.
* scribo/core/document.hh: Make a distinction between horizontal
diff --git a/scribo/scribo/core/internal/doc_xml_serializer.hh b/scribo/scribo/core/internal/doc_serializer.hh
similarity index 80%
rename from scribo/scribo/core/internal/doc_xml_serializer.hh
rename to scribo/scribo/core/internal/doc_serializer.hh
index b64c9d4..2655100 100644
--- a/scribo/scribo/core/internal/doc_xml_serializer.hh
+++ b/scribo/scribo/core/internal/doc_serializer.hh
@@ -23,8 +23,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH
-# define SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH
+#ifndef SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH
+# define SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH
/// \file
///
@@ -46,7 +46,7 @@ namespace scribo
/// \brief Link functor concept.
template <typename E>
- class doc_xml_serializer : public SerializeVisitor<E>
+ class doc_serializer : public SerializeVisitor<E>
{
public:
// Visit overloads
@@ -80,55 +80,55 @@ namespace scribo
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const document<L>& doc) const
+ doc_serializer<E>::visit(const document<L>& doc) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const line_links<L>& llinks) const
+ doc_serializer<E>::visit(const line_links<L>& llinks) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const object_groups<L>& groups) const
+ doc_serializer<E>::visit(const object_groups<L>& groups) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const object_links<L>& links) const
+ doc_serializer<E>::visit(const object_links<L>& links) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const component_set<L>& comp_set) const
+ doc_serializer<E>::visit(const component_set<L>& comp_set) const
{
}
template <typename E>
void
- doc_xml_serializer<E>::visit(const component_info& info) const
+ doc_serializer<E>::visit(const component_info& info) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const paragraph_set<L>& parset) const
+ doc_serializer<E>::visit(const paragraph_set<L>& parset) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const line_info<L>& line) const
+ doc_serializer<E>::visit(const line_info<L>& line) const
{
}
@@ -137,4 +137,4 @@ namespace scribo
} // end of namespace scribo
-#endif // SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH
+#endif // SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index 51e7ad3..e8c7689 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -32,6 +32,7 @@
# include <fstream>
# include <scribo/core/internal/doc_xml_serializer.hh>
+# include <scribo/core/internal/doc_serializer.hh>
# include <scribo/core/document.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/paragraph_set.hh>
@@ -57,7 +58,7 @@ namespace scribo
{
- class extended_page_xml_visitor : public doc_xml_serializer<extended_page_xml_visitor>
+ class extended_page_xml_visitor : public doc_serializer<extended_page_xml_visitor>
{
public:
// Constructor
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index d466b34..28f43e9 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -34,7 +34,7 @@
# include <QByteArray>
-# include <scribo/core/internal/doc_xml_serializer.hh>
+# include <scribo/core/internal/doc_serializer.hh>
# include <scribo/core/document.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/paragraph_set.hh>
@@ -63,7 +63,7 @@ namespace scribo
{
- class full_xml_visitor : public doc_xml_serializer<full_xml_visitor>
+ class full_xml_visitor : public doc_serializer<full_xml_visitor>
{
public:
// Constructor
diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
index 9dec1e7..19665d6 100644
--- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
@@ -32,7 +32,7 @@
# include <fstream>
-# include <scribo/core/internal/doc_xml_serializer.hh>
+# include <scribo/core/internal/doc_serializer.hh>
# include <scribo/convert/to_base64.hh>
# include <scribo/io/xml/internal/print_box_coords.hh>
@@ -63,7 +63,7 @@ namespace scribo
http://schema.primaresearch.org/PAGE/gts/pagecontent/2009-03-16/pagecontent…
*/
- class page_xml_visitor : public doc_xml_serializer<page_xml_visitor>
+ class page_xml_visitor : public doc_serializer<page_xml_visitor>
{
public:
// Constructor
--
1.5.6.5
1
0
14 Mar '11
* scribo/core/internal/doc_xml_serializer.hh: Rename as...
* scribo/core/internal/doc_serializer.hh: ... this.
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh: Update inheritance.
---
scribo/ChangeLog | 11 +++++++++
.../{doc_xml_serializer.hh => doc_serializer.hh} | 24 ++++++++++----------
.../io/xml/internal/extended_page_xml_visitor.hh | 3 +-
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 4 +-
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 4 +-
5 files changed, 29 insertions(+), 17 deletions(-)
rename scribo/scribo/core/internal/{doc_xml_serializer.hh => doc_serializer.hh} (80%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 213fa0a..f0bff06 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,16 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Rename document serializer base class.
+
+ * scribo/core/internal/doc_xml_serializer.hh: Rename as...
+ * scribo/core/internal/doc_serializer.hh: ... this.
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh,
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/internal/page_xml_visitor.hh: Update inheritance.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Store more information in scribo::document.
* scribo/core/document.hh: Make a distinction between horizontal
diff --git a/scribo/scribo/core/internal/doc_xml_serializer.hh b/scribo/scribo/core/internal/doc_serializer.hh
similarity index 80%
rename from scribo/scribo/core/internal/doc_xml_serializer.hh
rename to scribo/scribo/core/internal/doc_serializer.hh
index b64c9d4..2655100 100644
--- a/scribo/scribo/core/internal/doc_xml_serializer.hh
+++ b/scribo/scribo/core/internal/doc_serializer.hh
@@ -23,8 +23,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH
-# define SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH
+#ifndef SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH
+# define SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH
/// \file
///
@@ -46,7 +46,7 @@ namespace scribo
/// \brief Link functor concept.
template <typename E>
- class doc_xml_serializer : public SerializeVisitor<E>
+ class doc_serializer : public SerializeVisitor<E>
{
public:
// Visit overloads
@@ -80,55 +80,55 @@ namespace scribo
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const document<L>& doc) const
+ doc_serializer<E>::visit(const document<L>& doc) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const line_links<L>& llinks) const
+ doc_serializer<E>::visit(const line_links<L>& llinks) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const object_groups<L>& groups) const
+ doc_serializer<E>::visit(const object_groups<L>& groups) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const object_links<L>& links) const
+ doc_serializer<E>::visit(const object_links<L>& links) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const component_set<L>& comp_set) const
+ doc_serializer<E>::visit(const component_set<L>& comp_set) const
{
}
template <typename E>
void
- doc_xml_serializer<E>::visit(const component_info& info) const
+ doc_serializer<E>::visit(const component_info& info) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const paragraph_set<L>& parset) const
+ doc_serializer<E>::visit(const paragraph_set<L>& parset) const
{
}
template <typename E>
template <typename L>
void
- doc_xml_serializer<E>::visit(const line_info<L>& line) const
+ doc_serializer<E>::visit(const line_info<L>& line) const
{
}
@@ -137,4 +137,4 @@ namespace scribo
} // end of namespace scribo
-#endif // SCRIBO_CORE_INTERNAL_DOC_XML_SERIALIZER_HH
+#endif // SCRIBO_CORE_INTERNAL_DOC_SERIALIZER_HH
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index 51e7ad3..e8c7689 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -32,6 +32,7 @@
# include <fstream>
# include <scribo/core/internal/doc_xml_serializer.hh>
+# include <scribo/core/internal/doc_serializer.hh>
# include <scribo/core/document.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/paragraph_set.hh>
@@ -57,7 +58,7 @@ namespace scribo
{
- class extended_page_xml_visitor : public doc_xml_serializer<extended_page_xml_visitor>
+ class extended_page_xml_visitor : public doc_serializer<extended_page_xml_visitor>
{
public:
// Constructor
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index d466b34..28f43e9 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -34,7 +34,7 @@
# include <QByteArray>
-# include <scribo/core/internal/doc_xml_serializer.hh>
+# include <scribo/core/internal/doc_serializer.hh>
# include <scribo/core/document.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/paragraph_set.hh>
@@ -63,7 +63,7 @@ namespace scribo
{
- class full_xml_visitor : public doc_xml_serializer<full_xml_visitor>
+ class full_xml_visitor : public doc_serializer<full_xml_visitor>
{
public:
// Constructor
diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
index 9dec1e7..19665d6 100644
--- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
@@ -32,7 +32,7 @@
# include <fstream>
-# include <scribo/core/internal/doc_xml_serializer.hh>
+# include <scribo/core/internal/doc_serializer.hh>
# include <scribo/convert/to_base64.hh>
# include <scribo/io/xml/internal/print_box_coords.hh>
@@ -63,7 +63,7 @@ namespace scribo
http://schema.primaresearch.org/PAGE/gts/pagecontent/2009-03-16/pagecontent…
*/
- class page_xml_visitor : public doc_xml_serializer<page_xml_visitor>
+ class page_xml_visitor : public doc_serializer<page_xml_visitor>
{
public:
// Constructor
--
1.5.6.5
1
0
last-svn-commit-796-g9721b83 Store more information in scribo::document.
by Guillaume Lazzara 14 Mar '11
by Guillaume Lazzara 14 Mar '11
14 Mar '11
* scribo/core/document.hh: Make a distinction between horizontal
and vertical lines. Store the binary image.
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh,
* scribo/toolchain/internal/content_in_doc_functor.hh: Make use of
that new methods and information.
---
scribo/ChangeLog | 13 ++
scribo/scribo/core/document.hh | 137 ++++++++++++++-----
.../io/xml/internal/extended_page_xml_visitor.hh | 6 +-
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 14 +-
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 6 +-
.../toolchain/internal/content_in_doc_functor.hh | 20 +++-
6 files changed, 145 insertions(+), 51 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 1928592..33b036a 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,18 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Store more information in scribo::document.
+
+ * scribo/core/document.hh: Make a distinction between horizontal
+ and vertical lines. Store the binary image.
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh,
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/internal/page_xml_visitor.hh,
+ * scribo/toolchain/internal/content_in_doc_functor.hh: Make use of
+ that new methods and information.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Rename line_info::components() to line_info::component_ids.
* scribo/core/line_info.hh: Here.
diff --git a/scribo/scribo/core/document.hh b/scribo/scribo/core/document.hh
index 689d0e3..f38b20b 100644
--- a/scribo/scribo/core/document.hh
+++ b/scribo/scribo/core/document.hh
@@ -85,23 +85,34 @@ namespace scribo
const component_set<L>& elements() const;
void set_elements(const component_set<L>& elements);
- const mln::image2d<value::rgb8>& image() const;
- void set_image(const mln::image2d<value::rgb8>& image);
-
bool has_whitespace_seps() const;
const mln::image2d<bool>& whitespace_seps() const;
const component_set<L>& whitespace_seps_comps() const;
void set_whitespace_separators(const image2d<bool>& whitespace_seps);
- bool has_line_seps() const;
- const mln::image2d<bool>& line_seps() const;
- const component_set<L>& line_seps_comps() const;
- void set_line_separators(const image2d<bool>& line_seps);
+ // Horizontal separators
+ bool has_hline_seps() const;
+ const mln::image2d<bool>& hline_seps() const;
+ const component_set<L>& hline_seps_comps() const;
+ void set_hline_separators(const image2d<bool>& line_seps);
+
+ // Vertical separators
+ bool has_vline_seps() const;
+ const mln::image2d<bool>& vline_seps() const;
+ const component_set<L>& vline_seps_comps() const;
+ void set_vline_separators(const image2d<bool>& line_seps);
+
+ const mln::image2d<value::rgb8>& image() const;
+ void set_image(const mln::image2d<value::rgb8>& image);
+
+ const mln::image2d<bool>& binary_image() const;
+ void set_binary_image(const mln::image2d<bool>& binary_image);
private:
std::string filename_;
mln::image2d<mln::value::rgb8> image_;
+ mln::image2d<bool> binary_image_;
paragraph_set<L> parset_;
component_set<L> elements_;
@@ -109,8 +120,11 @@ namespace scribo
mln::image2d<bool> whitespace_seps_;
component_set<L> whitespace_seps_comps_;
- mln::image2d<bool> line_seps_;
- component_set<L> line_seps_comps_;
+ mln::image2d<bool> hline_seps_;
+ component_set<L> hline_seps_comps_;
+
+ mln::image2d<bool> vline_seps_;
+ component_set<L> vline_seps_comps_;
};
@@ -251,97 +265,148 @@ namespace scribo
elements_ = elements;
}
+ template <typename L>
+ bool
+ document<L>::has_whitespace_seps() const
+ {
+ return whitespace_seps_.is_valid();
+ }
+
template <typename L>
- const mln::image2d<value::rgb8>&
- document<L>::image() const
+ const mln::image2d<bool>&
+ document<L>::whitespace_seps() const
{
- return image_;
+ return whitespace_seps_;
+ }
+
+
+ template <typename L>
+ const component_set<L>&
+ document<L>::whitespace_seps_comps() const
+ {
+ return whitespace_seps_comps_;
}
template <typename L>
void
- document<L>::set_image(const mln::image2d<value::rgb8>& image)
+ document<L>::set_whitespace_separators(const image2d<bool>& whitespace_seps)
{
- image_ = image;
+ whitespace_seps_ = whitespace_seps;
+
+ mln_value(L) ncomps;
+ whitespace_seps_comps_ = primitive::extract::components(whitespace_seps,
+ mln::c8(), ncomps,
+ component::WhitespaceSeparator);
}
template <typename L>
bool
- document<L>::has_whitespace_seps() const
+ document<L>::has_hline_seps() const
{
- return whitespace_seps_.is_valid();
+ return hline_seps_.is_valid();
}
template <typename L>
const mln::image2d<bool>&
- document<L>::whitespace_seps() const
+ document<L>::hline_seps() const
{
- return whitespace_seps_;
+ return hline_seps_;
}
template <typename L>
const component_set<L>&
- document<L>::whitespace_seps_comps() const
+ document<L>::hline_seps_comps() const
{
- return whitespace_seps_comps_;
+ return hline_seps_comps_;
}
template <typename L>
void
- document<L>::set_whitespace_separators(const image2d<bool>& whitespace_seps)
+ document<L>::set_hline_separators(const image2d<bool>& hline_seps)
{
- whitespace_seps_ = whitespace_seps;
+ hline_seps_ = hline_seps;
mln_value(L) ncomps;
- whitespace_seps_comps_ = primitive::extract::components(whitespace_seps,
- mln::c8(), ncomps,
- component::WhitespaceSeparator);
+ hline_seps_comps_ = primitive::extract::components(hline_seps,
+ mln::c8(), ncomps,
+ component::LineSeparator);
}
template <typename L>
bool
- document<L>::has_line_seps() const
+ document<L>::has_vline_seps() const
{
- return line_seps_.is_valid();
+ return vline_seps_.is_valid();
}
template <typename L>
const mln::image2d<bool>&
- document<L>::line_seps() const
+ document<L>::vline_seps() const
{
- return line_seps_;
+ return vline_seps_;
}
template <typename L>
const component_set<L>&
- document<L>::line_seps_comps() const
+ document<L>::vline_seps_comps() const
{
- return line_seps_comps_;
+ return vline_seps_comps_;
}
template <typename L>
void
- document<L>::set_line_separators(const image2d<bool>& line_seps)
+ document<L>::set_vline_separators(const image2d<bool>& vline_seps)
{
- line_seps_ = line_seps;
+ vline_seps_ = vline_seps;
mln_value(L) ncomps;
- line_seps_comps_ = primitive::extract::components(line_seps,
- mln::c8(), ncomps,
- component::LineSeparator);
+ vline_seps_comps_ = primitive::extract::components(vline_seps,
+ mln::c8(), ncomps,
+ component::LineSeparator);
+ }
+
+
+ template <typename L>
+ const mln::image2d<value::rgb8>&
+ document<L>::image() const
+ {
+ return image_;
}
+ template <typename L>
+ void
+ document<L>::set_image(const mln::image2d<value::rgb8>& image)
+ {
+ image_ = image;
+ }
+
+
+ template <typename L>
+ const mln::image2d<bool>&
+ document<L>::binary_image() const
+ {
+ return binary_image_;
+ }
+
+
+ template <typename L>
+ void
+ document<L>::set_binary_image(const mln::image2d<bool>& binary_image)
+ {
+ binary_image_ = binary_image;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index f573d88..51e7ad3 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -114,8 +114,10 @@ namespace scribo
doc.elements().accept(*this);
// line seraparators
- if (doc.has_line_seps())
- doc.line_seps_comps().accept(*this);
+ if (doc.has_vline_seps())
+ doc.vline_seps_comps().accept(*this);
+ if (doc.has_hline_seps())
+ doc.hline_seps_comps().accept(*this);
// Whitespace seraparators
if (doc.has_whitespace_seps())
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 701c1b7..d466b34 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -164,14 +164,12 @@ namespace scribo
// line seraparators
- if (doc.has_line_seps())
- {
- const component_set<L>&
- line_seps_comps = doc.line_seps_comps();
-
- for_all_comps(c, line_seps_comps)
- line_seps_comps(c).accept(*this);
- }
+ if (doc.has_hline_seps())
+ for_all_comps(c, doc.hline_seps_comps())
+ doc.hline_seps_comps()(c).accept(*this);
+ if (doc.has_vline_seps())
+ for_all_comps(c, doc.vline_seps_comps())
+ doc.vline_seps_comps()(c).accept(*this);
// Whitespace seraparators
diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
index 52d8f12..9dec1e7 100644
--- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
@@ -116,8 +116,10 @@ namespace scribo
doc.elements().accept(*this);
// line seraparators
- if (doc.has_line_seps())
- doc.line_seps_comps().accept(*this);
+ if (doc.has_vline_seps())
+ doc.vline_seps_comps().accept(*this);
+ if (doc.has_hline_seps())
+ doc.hline_seps_comps().accept(*this);
output << " </page>" << std::endl;
output << "</pcGts>" << std::endl;
diff --git a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
index 40f013c..3e6668f 100644
--- a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
+++ b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
@@ -162,6 +162,7 @@ namespace scribo
mln_precondition(exact(processed_image).is_valid());
doc.set_image(exact(original_image));
+ doc.set_binary_image(exact(processed_image));
// Remove separators
mln_ch_value(I,bool)
@@ -169,17 +170,30 @@ namespace scribo
input_cleaned = exact(processed_image);
if (enable_line_seps)
{
+ // FIXME: SLOW
on_new_progress_label("Find vertical and horizontal separators...");
// Vertical and horizontal separators
- separators = primitive::extract::separators(processed_image, 81);
+ {
+ mln_ch_value(I,bool)
+ vseparators = primitive::extract::vertical_separators(processed_image, 81),
+ hseparators = primitive::extract::horizontal_separators(processed_image, 81);
+
+ doc.set_vline_separators(vseparators);
+ doc.set_hline_separators(hseparators);
+
+ separators = vseparators;
+ separators += hseparators;
+
+ border::resize(processed_image, border::thickness);
+ }
on_progress();
on_new_progress_label("Remove separators...");
- input_cleaned = primitive::remove::separators(processed_image, separators);
- doc.set_line_separators(separators);
+ input_cleaned = primitive::remove::separators(processed_image,
+ separators);
on_progress();
}
--
1.5.6.5
1
0
last-svn-commit-796-g20da74d Store more information in scribo::document.
by Guillaume Lazzara 14 Mar '11
by Guillaume Lazzara 14 Mar '11
14 Mar '11
* scribo/core/document.hh: Make a distinction between horizontal
and vertical lines. Store the binary image.
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh,
* scribo/toolchain/internal/content_in_doc_functor.hh: Make use of
that new methods and information.
---
scribo/ChangeLog | 13 ++
scribo/scribo/core/document.hh | 137 ++++++++++++++-----
.../io/xml/internal/extended_page_xml_visitor.hh | 6 +-
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 14 +-
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 6 +-
.../toolchain/internal/content_in_doc_functor.hh | 20 +++-
6 files changed, 145 insertions(+), 51 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 1928592..33b036a 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,18 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Store more information in scribo::document.
+
+ * scribo/core/document.hh: Make a distinction between horizontal
+ and vertical lines. Store the binary image.
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh,
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/internal/page_xml_visitor.hh,
+ * scribo/toolchain/internal/content_in_doc_functor.hh: Make use of
+ that new methods and information.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Rename line_info::components() to line_info::component_ids.
* scribo/core/line_info.hh: Here.
diff --git a/scribo/scribo/core/document.hh b/scribo/scribo/core/document.hh
index 689d0e3..f38b20b 100644
--- a/scribo/scribo/core/document.hh
+++ b/scribo/scribo/core/document.hh
@@ -85,23 +85,34 @@ namespace scribo
const component_set<L>& elements() const;
void set_elements(const component_set<L>& elements);
- const mln::image2d<value::rgb8>& image() const;
- void set_image(const mln::image2d<value::rgb8>& image);
-
bool has_whitespace_seps() const;
const mln::image2d<bool>& whitespace_seps() const;
const component_set<L>& whitespace_seps_comps() const;
void set_whitespace_separators(const image2d<bool>& whitespace_seps);
- bool has_line_seps() const;
- const mln::image2d<bool>& line_seps() const;
- const component_set<L>& line_seps_comps() const;
- void set_line_separators(const image2d<bool>& line_seps);
+ // Horizontal separators
+ bool has_hline_seps() const;
+ const mln::image2d<bool>& hline_seps() const;
+ const component_set<L>& hline_seps_comps() const;
+ void set_hline_separators(const image2d<bool>& line_seps);
+
+ // Vertical separators
+ bool has_vline_seps() const;
+ const mln::image2d<bool>& vline_seps() const;
+ const component_set<L>& vline_seps_comps() const;
+ void set_vline_separators(const image2d<bool>& line_seps);
+
+ const mln::image2d<value::rgb8>& image() const;
+ void set_image(const mln::image2d<value::rgb8>& image);
+
+ const mln::image2d<bool>& binary_image() const;
+ void set_binary_image(const mln::image2d<bool>& binary_image);
private:
std::string filename_;
mln::image2d<mln::value::rgb8> image_;
+ mln::image2d<bool> binary_image_;
paragraph_set<L> parset_;
component_set<L> elements_;
@@ -109,8 +120,11 @@ namespace scribo
mln::image2d<bool> whitespace_seps_;
component_set<L> whitespace_seps_comps_;
- mln::image2d<bool> line_seps_;
- component_set<L> line_seps_comps_;
+ mln::image2d<bool> hline_seps_;
+ component_set<L> hline_seps_comps_;
+
+ mln::image2d<bool> vline_seps_;
+ component_set<L> vline_seps_comps_;
};
@@ -251,97 +265,148 @@ namespace scribo
elements_ = elements;
}
+ template <typename L>
+ bool
+ document<L>::has_whitespace_seps() const
+ {
+ return whitespace_seps_.is_valid();
+ }
+
template <typename L>
- const mln::image2d<value::rgb8>&
- document<L>::image() const
+ const mln::image2d<bool>&
+ document<L>::whitespace_seps() const
{
- return image_;
+ return whitespace_seps_;
+ }
+
+
+ template <typename L>
+ const component_set<L>&
+ document<L>::whitespace_seps_comps() const
+ {
+ return whitespace_seps_comps_;
}
template <typename L>
void
- document<L>::set_image(const mln::image2d<value::rgb8>& image)
+ document<L>::set_whitespace_separators(const image2d<bool>& whitespace_seps)
{
- image_ = image;
+ whitespace_seps_ = whitespace_seps;
+
+ mln_value(L) ncomps;
+ whitespace_seps_comps_ = primitive::extract::components(whitespace_seps,
+ mln::c8(), ncomps,
+ component::WhitespaceSeparator);
}
template <typename L>
bool
- document<L>::has_whitespace_seps() const
+ document<L>::has_hline_seps() const
{
- return whitespace_seps_.is_valid();
+ return hline_seps_.is_valid();
}
template <typename L>
const mln::image2d<bool>&
- document<L>::whitespace_seps() const
+ document<L>::hline_seps() const
{
- return whitespace_seps_;
+ return hline_seps_;
}
template <typename L>
const component_set<L>&
- document<L>::whitespace_seps_comps() const
+ document<L>::hline_seps_comps() const
{
- return whitespace_seps_comps_;
+ return hline_seps_comps_;
}
template <typename L>
void
- document<L>::set_whitespace_separators(const image2d<bool>& whitespace_seps)
+ document<L>::set_hline_separators(const image2d<bool>& hline_seps)
{
- whitespace_seps_ = whitespace_seps;
+ hline_seps_ = hline_seps;
mln_value(L) ncomps;
- whitespace_seps_comps_ = primitive::extract::components(whitespace_seps,
- mln::c8(), ncomps,
- component::WhitespaceSeparator);
+ hline_seps_comps_ = primitive::extract::components(hline_seps,
+ mln::c8(), ncomps,
+ component::LineSeparator);
}
template <typename L>
bool
- document<L>::has_line_seps() const
+ document<L>::has_vline_seps() const
{
- return line_seps_.is_valid();
+ return vline_seps_.is_valid();
}
template <typename L>
const mln::image2d<bool>&
- document<L>::line_seps() const
+ document<L>::vline_seps() const
{
- return line_seps_;
+ return vline_seps_;
}
template <typename L>
const component_set<L>&
- document<L>::line_seps_comps() const
+ document<L>::vline_seps_comps() const
{
- return line_seps_comps_;
+ return vline_seps_comps_;
}
template <typename L>
void
- document<L>::set_line_separators(const image2d<bool>& line_seps)
+ document<L>::set_vline_separators(const image2d<bool>& vline_seps)
{
- line_seps_ = line_seps;
+ vline_seps_ = vline_seps;
mln_value(L) ncomps;
- line_seps_comps_ = primitive::extract::components(line_seps,
- mln::c8(), ncomps,
- component::LineSeparator);
+ vline_seps_comps_ = primitive::extract::components(vline_seps,
+ mln::c8(), ncomps,
+ component::LineSeparator);
+ }
+
+
+ template <typename L>
+ const mln::image2d<value::rgb8>&
+ document<L>::image() const
+ {
+ return image_;
}
+ template <typename L>
+ void
+ document<L>::set_image(const mln::image2d<value::rgb8>& image)
+ {
+ image_ = image;
+ }
+
+
+ template <typename L>
+ const mln::image2d<bool>&
+ document<L>::binary_image() const
+ {
+ return binary_image_;
+ }
+
+
+ template <typename L>
+ void
+ document<L>::set_binary_image(const mln::image2d<bool>& binary_image)
+ {
+ binary_image_ = binary_image;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index f573d88..51e7ad3 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -114,8 +114,10 @@ namespace scribo
doc.elements().accept(*this);
// line seraparators
- if (doc.has_line_seps())
- doc.line_seps_comps().accept(*this);
+ if (doc.has_vline_seps())
+ doc.vline_seps_comps().accept(*this);
+ if (doc.has_hline_seps())
+ doc.hline_seps_comps().accept(*this);
// Whitespace seraparators
if (doc.has_whitespace_seps())
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 701c1b7..d466b34 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -164,14 +164,12 @@ namespace scribo
// line seraparators
- if (doc.has_line_seps())
- {
- const component_set<L>&
- line_seps_comps = doc.line_seps_comps();
-
- for_all_comps(c, line_seps_comps)
- line_seps_comps(c).accept(*this);
- }
+ if (doc.has_hline_seps())
+ for_all_comps(c, doc.hline_seps_comps())
+ doc.hline_seps_comps()(c).accept(*this);
+ if (doc.has_vline_seps())
+ for_all_comps(c, doc.vline_seps_comps())
+ doc.vline_seps_comps()(c).accept(*this);
// Whitespace seraparators
diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
index 52d8f12..9dec1e7 100644
--- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
@@ -116,8 +116,10 @@ namespace scribo
doc.elements().accept(*this);
// line seraparators
- if (doc.has_line_seps())
- doc.line_seps_comps().accept(*this);
+ if (doc.has_vline_seps())
+ doc.vline_seps_comps().accept(*this);
+ if (doc.has_hline_seps())
+ doc.hline_seps_comps().accept(*this);
output << " </page>" << std::endl;
output << "</pcGts>" << std::endl;
diff --git a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
index 40f013c..3e6668f 100644
--- a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
+++ b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
@@ -162,6 +162,7 @@ namespace scribo
mln_precondition(exact(processed_image).is_valid());
doc.set_image(exact(original_image));
+ doc.set_binary_image(exact(processed_image));
// Remove separators
mln_ch_value(I,bool)
@@ -169,17 +170,30 @@ namespace scribo
input_cleaned = exact(processed_image);
if (enable_line_seps)
{
+ // FIXME: SLOW
on_new_progress_label("Find vertical and horizontal separators...");
// Vertical and horizontal separators
- separators = primitive::extract::separators(processed_image, 81);
+ {
+ mln_ch_value(I,bool)
+ vseparators = primitive::extract::vertical_separators(processed_image, 81),
+ hseparators = primitive::extract::horizontal_separators(processed_image, 81);
+
+ doc.set_vline_separators(vseparators);
+ doc.set_hline_separators(hseparators);
+
+ separators = vseparators;
+ separators += hseparators;
+
+ border::resize(processed_image, border::thickness);
+ }
on_progress();
on_new_progress_label("Remove separators...");
- input_cleaned = primitive::remove::separators(processed_image, separators);
- doc.set_line_separators(separators);
+ input_cleaned = primitive::remove::separators(processed_image,
+ separators);
on_progress();
}
--
1.5.6.5
1
0
last-svn-commit-797-gfffcde7 Store more information in scribo::document.
by Guillaume Lazzara 14 Mar '11
by Guillaume Lazzara 14 Mar '11
14 Mar '11
* scribo/core/document.hh: Make a distinction between horizontal
and vertical lines. Store the binary image.
* scribo/io/xml/internal/extended_page_xml_visitor.hh,
* scribo/io/xml/internal/full_xml_visitor.hh,
* scribo/io/xml/internal/page_xml_visitor.hh,
* scribo/toolchain/internal/content_in_doc_functor.hh: Make use of
that new methods and information.
---
scribo/ChangeLog | 13 ++
scribo/scribo/core/document.hh | 137 ++++++++++++++-----
.../io/xml/internal/extended_page_xml_visitor.hh | 6 +-
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 14 +-
scribo/scribo/io/xml/internal/page_xml_visitor.hh | 6 +-
.../toolchain/internal/content_in_doc_functor.hh | 20 +++-
6 files changed, 145 insertions(+), 51 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 52e3125..213fa0a 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,18 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Store more information in scribo::document.
+
+ * scribo/core/document.hh: Make a distinction between horizontal
+ and vertical lines. Store the binary image.
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh,
+ * scribo/io/xml/internal/full_xml_visitor.hh,
+ * scribo/io/xml/internal/page_xml_visitor.hh,
+ * scribo/toolchain/internal/content_in_doc_functor.hh: Make use of
+ that new methods and information.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Rename line_info::components() to line_info::component_ids.
* scribo/core/line_info.hh: Here.
diff --git a/scribo/scribo/core/document.hh b/scribo/scribo/core/document.hh
index 689d0e3..f38b20b 100644
--- a/scribo/scribo/core/document.hh
+++ b/scribo/scribo/core/document.hh
@@ -85,23 +85,34 @@ namespace scribo
const component_set<L>& elements() const;
void set_elements(const component_set<L>& elements);
- const mln::image2d<value::rgb8>& image() const;
- void set_image(const mln::image2d<value::rgb8>& image);
-
bool has_whitespace_seps() const;
const mln::image2d<bool>& whitespace_seps() const;
const component_set<L>& whitespace_seps_comps() const;
void set_whitespace_separators(const image2d<bool>& whitespace_seps);
- bool has_line_seps() const;
- const mln::image2d<bool>& line_seps() const;
- const component_set<L>& line_seps_comps() const;
- void set_line_separators(const image2d<bool>& line_seps);
+ // Horizontal separators
+ bool has_hline_seps() const;
+ const mln::image2d<bool>& hline_seps() const;
+ const component_set<L>& hline_seps_comps() const;
+ void set_hline_separators(const image2d<bool>& line_seps);
+
+ // Vertical separators
+ bool has_vline_seps() const;
+ const mln::image2d<bool>& vline_seps() const;
+ const component_set<L>& vline_seps_comps() const;
+ void set_vline_separators(const image2d<bool>& line_seps);
+
+ const mln::image2d<value::rgb8>& image() const;
+ void set_image(const mln::image2d<value::rgb8>& image);
+
+ const mln::image2d<bool>& binary_image() const;
+ void set_binary_image(const mln::image2d<bool>& binary_image);
private:
std::string filename_;
mln::image2d<mln::value::rgb8> image_;
+ mln::image2d<bool> binary_image_;
paragraph_set<L> parset_;
component_set<L> elements_;
@@ -109,8 +120,11 @@ namespace scribo
mln::image2d<bool> whitespace_seps_;
component_set<L> whitespace_seps_comps_;
- mln::image2d<bool> line_seps_;
- component_set<L> line_seps_comps_;
+ mln::image2d<bool> hline_seps_;
+ component_set<L> hline_seps_comps_;
+
+ mln::image2d<bool> vline_seps_;
+ component_set<L> vline_seps_comps_;
};
@@ -251,97 +265,148 @@ namespace scribo
elements_ = elements;
}
+ template <typename L>
+ bool
+ document<L>::has_whitespace_seps() const
+ {
+ return whitespace_seps_.is_valid();
+ }
+
template <typename L>
- const mln::image2d<value::rgb8>&
- document<L>::image() const
+ const mln::image2d<bool>&
+ document<L>::whitespace_seps() const
{
- return image_;
+ return whitespace_seps_;
+ }
+
+
+ template <typename L>
+ const component_set<L>&
+ document<L>::whitespace_seps_comps() const
+ {
+ return whitespace_seps_comps_;
}
template <typename L>
void
- document<L>::set_image(const mln::image2d<value::rgb8>& image)
+ document<L>::set_whitespace_separators(const image2d<bool>& whitespace_seps)
{
- image_ = image;
+ whitespace_seps_ = whitespace_seps;
+
+ mln_value(L) ncomps;
+ whitespace_seps_comps_ = primitive::extract::components(whitespace_seps,
+ mln::c8(), ncomps,
+ component::WhitespaceSeparator);
}
template <typename L>
bool
- document<L>::has_whitespace_seps() const
+ document<L>::has_hline_seps() const
{
- return whitespace_seps_.is_valid();
+ return hline_seps_.is_valid();
}
template <typename L>
const mln::image2d<bool>&
- document<L>::whitespace_seps() const
+ document<L>::hline_seps() const
{
- return whitespace_seps_;
+ return hline_seps_;
}
template <typename L>
const component_set<L>&
- document<L>::whitespace_seps_comps() const
+ document<L>::hline_seps_comps() const
{
- return whitespace_seps_comps_;
+ return hline_seps_comps_;
}
template <typename L>
void
- document<L>::set_whitespace_separators(const image2d<bool>& whitespace_seps)
+ document<L>::set_hline_separators(const image2d<bool>& hline_seps)
{
- whitespace_seps_ = whitespace_seps;
+ hline_seps_ = hline_seps;
mln_value(L) ncomps;
- whitespace_seps_comps_ = primitive::extract::components(whitespace_seps,
- mln::c8(), ncomps,
- component::WhitespaceSeparator);
+ hline_seps_comps_ = primitive::extract::components(hline_seps,
+ mln::c8(), ncomps,
+ component::LineSeparator);
}
template <typename L>
bool
- document<L>::has_line_seps() const
+ document<L>::has_vline_seps() const
{
- return line_seps_.is_valid();
+ return vline_seps_.is_valid();
}
template <typename L>
const mln::image2d<bool>&
- document<L>::line_seps() const
+ document<L>::vline_seps() const
{
- return line_seps_;
+ return vline_seps_;
}
template <typename L>
const component_set<L>&
- document<L>::line_seps_comps() const
+ document<L>::vline_seps_comps() const
{
- return line_seps_comps_;
+ return vline_seps_comps_;
}
template <typename L>
void
- document<L>::set_line_separators(const image2d<bool>& line_seps)
+ document<L>::set_vline_separators(const image2d<bool>& vline_seps)
{
- line_seps_ = line_seps;
+ vline_seps_ = vline_seps;
mln_value(L) ncomps;
- line_seps_comps_ = primitive::extract::components(line_seps,
- mln::c8(), ncomps,
- component::LineSeparator);
+ vline_seps_comps_ = primitive::extract::components(vline_seps,
+ mln::c8(), ncomps,
+ component::LineSeparator);
+ }
+
+
+ template <typename L>
+ const mln::image2d<value::rgb8>&
+ document<L>::image() const
+ {
+ return image_;
}
+ template <typename L>
+ void
+ document<L>::set_image(const mln::image2d<value::rgb8>& image)
+ {
+ image_ = image;
+ }
+
+
+ template <typename L>
+ const mln::image2d<bool>&
+ document<L>::binary_image() const
+ {
+ return binary_image_;
+ }
+
+
+ template <typename L>
+ void
+ document<L>::set_binary_image(const mln::image2d<bool>& binary_image)
+ {
+ binary_image_ = binary_image;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index f573d88..51e7ad3 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -114,8 +114,10 @@ namespace scribo
doc.elements().accept(*this);
// line seraparators
- if (doc.has_line_seps())
- doc.line_seps_comps().accept(*this);
+ if (doc.has_vline_seps())
+ doc.vline_seps_comps().accept(*this);
+ if (doc.has_hline_seps())
+ doc.hline_seps_comps().accept(*this);
// Whitespace seraparators
if (doc.has_whitespace_seps())
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 701c1b7..d466b34 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -164,14 +164,12 @@ namespace scribo
// line seraparators
- if (doc.has_line_seps())
- {
- const component_set<L>&
- line_seps_comps = doc.line_seps_comps();
-
- for_all_comps(c, line_seps_comps)
- line_seps_comps(c).accept(*this);
- }
+ if (doc.has_hline_seps())
+ for_all_comps(c, doc.hline_seps_comps())
+ doc.hline_seps_comps()(c).accept(*this);
+ if (doc.has_vline_seps())
+ for_all_comps(c, doc.vline_seps_comps())
+ doc.vline_seps_comps()(c).accept(*this);
// Whitespace seraparators
diff --git a/scribo/scribo/io/xml/internal/page_xml_visitor.hh b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
index 52d8f12..9dec1e7 100644
--- a/scribo/scribo/io/xml/internal/page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/page_xml_visitor.hh
@@ -116,8 +116,10 @@ namespace scribo
doc.elements().accept(*this);
// line seraparators
- if (doc.has_line_seps())
- doc.line_seps_comps().accept(*this);
+ if (doc.has_vline_seps())
+ doc.vline_seps_comps().accept(*this);
+ if (doc.has_hline_seps())
+ doc.hline_seps_comps().accept(*this);
output << " </page>" << std::endl;
output << "</pcGts>" << std::endl;
diff --git a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
index 40f013c..3e6668f 100644
--- a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
+++ b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh
@@ -162,6 +162,7 @@ namespace scribo
mln_precondition(exact(processed_image).is_valid());
doc.set_image(exact(original_image));
+ doc.set_binary_image(exact(processed_image));
// Remove separators
mln_ch_value(I,bool)
@@ -169,17 +170,30 @@ namespace scribo
input_cleaned = exact(processed_image);
if (enable_line_seps)
{
+ // FIXME: SLOW
on_new_progress_label("Find vertical and horizontal separators...");
// Vertical and horizontal separators
- separators = primitive::extract::separators(processed_image, 81);
+ {
+ mln_ch_value(I,bool)
+ vseparators = primitive::extract::vertical_separators(processed_image, 81),
+ hseparators = primitive::extract::horizontal_separators(processed_image, 81);
+
+ doc.set_vline_separators(vseparators);
+ doc.set_hline_separators(hseparators);
+
+ separators = vseparators;
+ separators += hseparators;
+
+ border::resize(processed_image, border::thickness);
+ }
on_progress();
on_new_progress_label("Remove separators...");
- input_cleaned = primitive::remove::separators(processed_image, separators);
- doc.set_line_separators(separators);
+ input_cleaned = primitive::remove::separators(processed_image,
+ separators);
on_progress();
}
--
1.5.6.5
1
0
last-svn-commit-795-g2cd9b01 Rename line_info::components() to line_info::component_ids.
by Guillaume Lazzara 14 Mar '11
by Guillaume Lazzara 14 Mar '11
14 Mar '11
* scribo/core/line_info.hh: Here.
* scribo/debug/char_space_image.hh,
* scribo/text/recognition.hh,
* src/debug/show_text_lines.cc,
* scribo/io/xml/internal/full_xml_visitor.hh: Update calls to that
method.
---
scribo/ChangeLog | 22 ++++++++++++++++++++-
scribo/scribo/core/line_info.hh | 8 +++---
scribo/scribo/debug/char_space_image.hh | 8 +++---
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 4 +-
scribo/scribo/text/recognition.hh | 4 +-
scribo/src/debug/show_text_lines.cc | 2 +-
6 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 439db69..1928592 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,12 +1,32 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
- Rename debug routines.
+ Rename line_info::components() to line_info::component_ids.
+
+ * scribo/core/line_info.hh: Here.
+
+ * scribo/debug/char_space_image.hh,
+ * scribo/text/recognition.hh,
+ * src/debug/show_text_lines.cc,
+ * scribo/io/xml/internal/full_xml_visitor.hh: Update calls to that
+ method.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Some changes in debug routines.
* scribo/debug/save_bboxes_image.hh,
* scribo/debug/save_linked_bboxes_image.hh: Rename as...
* scribo/debug/bboxes_image.hh,
* scribo/debug/linked_bboxes_image.hh: ... this.
+ * scribo/debug/links_image.hh: New.
+
+ * scribo/debug/several_links_decision_image.hh:
+ Remove. Deprecated.
+
+ * scribo/debug/alignment_decision_image.hh: Make use of
+ compute_anchor routine.
+
* scribo/debug/all.hh,
* scribo/table/extract.hh,
* scribo/toolchain/text_in_picture.hh,
diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh
index 46ba720..4def6fe 100644
--- a/scribo/scribo/core/line_info.hh
+++ b/scribo/scribo/core/line_info.hh
@@ -172,7 +172,7 @@ namespace scribo
//
const mln::box2d& ebbox() const;
- const mln::util::array<component_id_t>& components() const;
+ const mln::util::array<component_id_t>& component_ids() const;
unsigned card() const;
int baseline() const;
@@ -481,7 +481,7 @@ namespace scribo
template <typename L>
const mln::util::array<typename line_info<L>::component_id_t>&
- line_info<L>::components() const
+ line_info<L>::component_ids() const
{
return data_->components_;
}
@@ -856,7 +856,7 @@ namespace scribo
// Update bbox and ebbox
update_bbox_and_ebox(other);
- data_->components_.append(other.components());
+ data_->components_.append(other.component_ids());
}
@@ -1023,7 +1023,7 @@ namespace scribo
<< ", type=" << info.type()
<< ", bbox=" << info.bbox()
<< ", ebbox=" << info.ebbox()
- << ", components=" << info.components()
+ << ", components=" << info.component_ids()
<< ", baseline=" << info.baseline()
<< ", meanline=" << info.meanline()
<< ", ascent=" << info.ascent()
diff --git a/scribo/scribo/debug/char_space_image.hh b/scribo/scribo/debug/char_space_image.hh
index 6dc6f8f..53fc303 100644
--- a/scribo/scribo/debug/char_space_image.hh
+++ b/scribo/scribo/debug/char_space_image.hh
@@ -76,16 +76,16 @@ namespace scribo
for_all_lines(l, line)
{
if (! line(l).is_valid() || line(l).is_hidden()
- || line(l).components().size() < 2)
+ || line(l).component_ids().size() < 2)
continue;
- for_all_elements(i, line(l).components())
+ for_all_elements(i, line(l).component_ids())
{
- if (i == line(l).components().nelements() - 1)
+ if (i == line(l).component_ids().nelements() - 1)
continue;
- unsigned c = line(l).components()[i];
+ unsigned c = line(l).component_ids()[i];
point2d
beg = comps(c).bbox().pmax(),
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 8576c27..701c1b7 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -447,9 +447,9 @@ namespace scribo
output << " <compid_list>" << std::endl;
- for_all_line_comps(c, line.components())
+ for_all_line_comps(c, line.component_ids())
output << " <compid value=\""
- << line.components()(c) << "\" />" << std::endl;
+ << line.component_ids()(c) << "\" />" << std::endl;
output << " </compid_list>" << std::endl;
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index 3a9742b..1e11a3e 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -144,8 +144,8 @@ namespace scribo
const L& lbl = comp_set.labeled_image();
// Extract each character components to create the line image.
- const mln::util::array<component_id_t>& comps = lines(i).components();
- for_all_elements(e, lines(i).components())
+ const mln::util::array<component_id_t>& comps = lines(i).component_ids();
+ for_all_elements(e, lines(i).component_ids())
{
unsigned comp_id = comps(e);
data::fill(((text_ima | comp_set(comp_id).bbox()).rw() | (pw::value(lbl) == pw::cst(comp_id))).rw(),
diff --git a/scribo/src/debug/show_text_lines.cc b/scribo/src/debug/show_text_lines.cc
index 368f375..d5a5c8f 100644
--- a/scribo/src/debug/show_text_lines.cc
+++ b/scribo/src/debug/show_text_lines.cc
@@ -110,7 +110,7 @@ int main(int argc, char* argv[])
for_all_lines(l, lines)
if (lines(l).is_textline())
{
- const util::array<component_id_t>& comps = lines(l).components();
+ const util::array<component_id_t>& comps = lines(l).component_ids();
const L& lbl = lines.components().labeled_image();
for_all_elements(c, comps)
data::fill((output | lines.components()(comps(c)).bbox()).rw(),
--
1.5.6.5
1
0
last-svn-commit-795-g881caef Rename line_info::components() to line_info::component_ids.
by Guillaume Lazzara 14 Mar '11
by Guillaume Lazzara 14 Mar '11
14 Mar '11
* scribo/core/line_info.hh: Here.
* scribo/debug/char_space_image.hh,
* scribo/text/recognition.hh,
* src/debug/show_text_lines.cc,
* scribo/io/xml/internal/full_xml_visitor.hh: Update calls to that
method.
---
scribo/ChangeLog | 22 ++++++++++++++++++++-
scribo/scribo/core/line_info.hh | 8 +++---
scribo/scribo/debug/char_space_image.hh | 8 +++---
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 4 +-
scribo/scribo/text/recognition.hh | 4 +-
scribo/src/debug/show_text_lines.cc | 2 +-
6 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 439db69..1928592 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,12 +1,32 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
- Rename debug routines.
+ Rename line_info::components() to line_info::component_ids.
+
+ * scribo/core/line_info.hh: Here.
+
+ * scribo/debug/char_space_image.hh,
+ * scribo/text/recognition.hh,
+ * src/debug/show_text_lines.cc,
+ * scribo/io/xml/internal/full_xml_visitor.hh: Update calls to that
+ method.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Some changes in debug routines.
* scribo/debug/save_bboxes_image.hh,
* scribo/debug/save_linked_bboxes_image.hh: Rename as...
* scribo/debug/bboxes_image.hh,
* scribo/debug/linked_bboxes_image.hh: ... this.
+ * scribo/debug/links_image.hh: New.
+
+ * scribo/debug/several_links_decision_image.hh:
+ Remove. Deprecated.
+
+ * scribo/debug/alignment_decision_image.hh: Make use of
+ compute_anchor routine.
+
* scribo/debug/all.hh,
* scribo/table/extract.hh,
* scribo/toolchain/text_in_picture.hh,
diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh
index 46ba720..4def6fe 100644
--- a/scribo/scribo/core/line_info.hh
+++ b/scribo/scribo/core/line_info.hh
@@ -172,7 +172,7 @@ namespace scribo
//
const mln::box2d& ebbox() const;
- const mln::util::array<component_id_t>& components() const;
+ const mln::util::array<component_id_t>& component_ids() const;
unsigned card() const;
int baseline() const;
@@ -481,7 +481,7 @@ namespace scribo
template <typename L>
const mln::util::array<typename line_info<L>::component_id_t>&
- line_info<L>::components() const
+ line_info<L>::component_ids() const
{
return data_->components_;
}
@@ -856,7 +856,7 @@ namespace scribo
// Update bbox and ebbox
update_bbox_and_ebox(other);
- data_->components_.append(other.components());
+ data_->components_.append(other.component_ids());
}
@@ -1023,7 +1023,7 @@ namespace scribo
<< ", type=" << info.type()
<< ", bbox=" << info.bbox()
<< ", ebbox=" << info.ebbox()
- << ", components=" << info.components()
+ << ", components=" << info.component_ids()
<< ", baseline=" << info.baseline()
<< ", meanline=" << info.meanline()
<< ", ascent=" << info.ascent()
diff --git a/scribo/scribo/debug/char_space_image.hh b/scribo/scribo/debug/char_space_image.hh
index 6dc6f8f..53fc303 100644
--- a/scribo/scribo/debug/char_space_image.hh
+++ b/scribo/scribo/debug/char_space_image.hh
@@ -76,16 +76,16 @@ namespace scribo
for_all_lines(l, line)
{
if (! line(l).is_valid() || line(l).is_hidden()
- || line(l).components().size() < 2)
+ || line(l).component_ids().size() < 2)
continue;
- for_all_elements(i, line(l).components())
+ for_all_elements(i, line(l).component_ids())
{
- if (i == line(l).components().nelements() - 1)
+ if (i == line(l).component_ids().nelements() - 1)
continue;
- unsigned c = line(l).components()[i];
+ unsigned c = line(l).component_ids()[i];
point2d
beg = comps(c).bbox().pmax(),
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 8576c27..701c1b7 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -447,9 +447,9 @@ namespace scribo
output << " <compid_list>" << std::endl;
- for_all_line_comps(c, line.components())
+ for_all_line_comps(c, line.component_ids())
output << " <compid value=\""
- << line.components()(c) << "\" />" << std::endl;
+ << line.component_ids()(c) << "\" />" << std::endl;
output << " </compid_list>" << std::endl;
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index 3a9742b..1e11a3e 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -144,8 +144,8 @@ namespace scribo
const L& lbl = comp_set.labeled_image();
// Extract each character components to create the line image.
- const mln::util::array<component_id_t>& comps = lines(i).components();
- for_all_elements(e, lines(i).components())
+ const mln::util::array<component_id_t>& comps = lines(i).component_ids();
+ for_all_elements(e, lines(i).component_ids())
{
unsigned comp_id = comps(e);
data::fill(((text_ima | comp_set(comp_id).bbox()).rw() | (pw::value(lbl) == pw::cst(comp_id))).rw(),
diff --git a/scribo/src/debug/show_text_lines.cc b/scribo/src/debug/show_text_lines.cc
index 368f375..d5a5c8f 100644
--- a/scribo/src/debug/show_text_lines.cc
+++ b/scribo/src/debug/show_text_lines.cc
@@ -110,7 +110,7 @@ int main(int argc, char* argv[])
for_all_lines(l, lines)
if (lines(l).is_textline())
{
- const util::array<component_id_t>& comps = lines(l).components();
+ const util::array<component_id_t>& comps = lines(l).component_ids();
const L& lbl = lines.components().labeled_image();
for_all_elements(c, comps)
data::fill((output | lines.components()(comps(c)).bbox()).rw(),
--
1.5.6.5
1
0
last-svn-commit-796-gdd1061b Rename line_info::components() to line_info::component_ids.
by Guillaume Lazzara 14 Mar '11
by Guillaume Lazzara 14 Mar '11
14 Mar '11
* scribo/core/line_info.hh: Here.
* scribo/debug/char_space_image.hh,
* scribo/text/recognition.hh,
* src/debug/show_text_lines.cc,
* scribo/io/xml/internal/full_xml_visitor.hh: Update calls to that
method.
---
scribo/ChangeLog | 22 ++++++++++++++++++++-
scribo/scribo/core/line_info.hh | 8 +++---
scribo/scribo/debug/char_space_image.hh | 8 +++---
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 4 +-
scribo/scribo/text/recognition.hh | 4 +-
scribo/src/debug/show_text_lines.cc | 2 +-
6 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 8de7299..52e3125 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,12 +1,32 @@
2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
- Rename debug routines.
+ Rename line_info::components() to line_info::component_ids.
+
+ * scribo/core/line_info.hh: Here.
+
+ * scribo/debug/char_space_image.hh,
+ * scribo/text/recognition.hh,
+ * src/debug/show_text_lines.cc,
+ * scribo/io/xml/internal/full_xml_visitor.hh: Update calls to that
+ method.
+
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Some changes in debug routines.
* scribo/debug/save_bboxes_image.hh,
* scribo/debug/save_linked_bboxes_image.hh: Rename as...
* scribo/debug/bboxes_image.hh,
* scribo/debug/linked_bboxes_image.hh: ... this.
+ * scribo/debug/links_image.hh: New.
+
+ * scribo/debug/several_links_decision_image.hh:
+ Remove. Deprecated.
+
+ * scribo/debug/alignment_decision_image.hh: Make use of
+ compute_anchor routine.
+
* scribo/debug/all.hh,
* scribo/table/extract.hh,
* scribo/toolchain/text_in_picture.hh,
diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh
index 46ba720..4def6fe 100644
--- a/scribo/scribo/core/line_info.hh
+++ b/scribo/scribo/core/line_info.hh
@@ -172,7 +172,7 @@ namespace scribo
//
const mln::box2d& ebbox() const;
- const mln::util::array<component_id_t>& components() const;
+ const mln::util::array<component_id_t>& component_ids() const;
unsigned card() const;
int baseline() const;
@@ -481,7 +481,7 @@ namespace scribo
template <typename L>
const mln::util::array<typename line_info<L>::component_id_t>&
- line_info<L>::components() const
+ line_info<L>::component_ids() const
{
return data_->components_;
}
@@ -856,7 +856,7 @@ namespace scribo
// Update bbox and ebbox
update_bbox_and_ebox(other);
- data_->components_.append(other.components());
+ data_->components_.append(other.component_ids());
}
@@ -1023,7 +1023,7 @@ namespace scribo
<< ", type=" << info.type()
<< ", bbox=" << info.bbox()
<< ", ebbox=" << info.ebbox()
- << ", components=" << info.components()
+ << ", components=" << info.component_ids()
<< ", baseline=" << info.baseline()
<< ", meanline=" << info.meanline()
<< ", ascent=" << info.ascent()
diff --git a/scribo/scribo/debug/char_space_image.hh b/scribo/scribo/debug/char_space_image.hh
index 6dc6f8f..53fc303 100644
--- a/scribo/scribo/debug/char_space_image.hh
+++ b/scribo/scribo/debug/char_space_image.hh
@@ -76,16 +76,16 @@ namespace scribo
for_all_lines(l, line)
{
if (! line(l).is_valid() || line(l).is_hidden()
- || line(l).components().size() < 2)
+ || line(l).component_ids().size() < 2)
continue;
- for_all_elements(i, line(l).components())
+ for_all_elements(i, line(l).component_ids())
{
- if (i == line(l).components().nelements() - 1)
+ if (i == line(l).component_ids().nelements() - 1)
continue;
- unsigned c = line(l).components()[i];
+ unsigned c = line(l).component_ids()[i];
point2d
beg = comps(c).bbox().pmax(),
diff --git a/scribo/scribo/io/xml/internal/full_xml_visitor.hh b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
index 8576c27..701c1b7 100644
--- a/scribo/scribo/io/xml/internal/full_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/full_xml_visitor.hh
@@ -447,9 +447,9 @@ namespace scribo
output << " <compid_list>" << std::endl;
- for_all_line_comps(c, line.components())
+ for_all_line_comps(c, line.component_ids())
output << " <compid value=\""
- << line.components()(c) << "\" />" << std::endl;
+ << line.component_ids()(c) << "\" />" << std::endl;
output << " </compid_list>" << std::endl;
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index 3a9742b..1e11a3e 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -144,8 +144,8 @@ namespace scribo
const L& lbl = comp_set.labeled_image();
// Extract each character components to create the line image.
- const mln::util::array<component_id_t>& comps = lines(i).components();
- for_all_elements(e, lines(i).components())
+ const mln::util::array<component_id_t>& comps = lines(i).component_ids();
+ for_all_elements(e, lines(i).component_ids())
{
unsigned comp_id = comps(e);
data::fill(((text_ima | comp_set(comp_id).bbox()).rw() | (pw::value(lbl) == pw::cst(comp_id))).rw(),
diff --git a/scribo/src/debug/show_text_lines.cc b/scribo/src/debug/show_text_lines.cc
index 368f375..d5a5c8f 100644
--- a/scribo/src/debug/show_text_lines.cc
+++ b/scribo/src/debug/show_text_lines.cc
@@ -110,7 +110,7 @@ int main(int argc, char* argv[])
for_all_lines(l, lines)
if (lines(l).is_textline())
{
- const util::array<component_id_t>& comps = lines(l).components();
+ const util::array<component_id_t>& comps = lines(l).component_ids();
const L& lbl = lines.components().labeled_image();
for_all_elements(c, comps)
data::fill((output | lines.components()(comps(c)).bbox()).rw(),
--
1.5.6.5
1
0
14 Mar '11
* scribo/debug/save_bboxes_image.hh,
* scribo/debug/save_linked_bboxes_image.hh: Rename as...
* scribo/debug/bboxes_image.hh,
* scribo/debug/linked_bboxes_image.hh: ... this.
* scribo/debug/links_image.hh: New.
* scribo/debug/several_links_decision_image.hh:
Remove. Deprecated.
* scribo/debug/alignment_decision_image.hh: Make use of
compute_anchor routine.
* scribo/debug/all.hh,
* scribo/table/extract.hh,
* scribo/toolchain/text_in_picture.hh,
* src/debug/show_links_several_right_overlap.cc,
* src/debug/show_links_single_down.cc,
* src/debug/show_links_single_down_left_aligned.cc,
* src/debug/show_links_single_down_right_aligned.cc,
* src/debug/show_links_single_left.cc,
* src/debug/show_links_single_left_dmax_ratio.cc,
* src/debug/show_links_single_right.cc,
* src/debug/show_links_single_right_dmax_ratio.cc,
* src/debug/show_links_single_up.cc,
* src/debug/show_links_single_up_left_aligned.cc,
* src/debug/show_links_single_up_right_aligned.cc,
* src/debug/show_separators.cc,
* src/primitive/group/group_from_double_link.cc,
* src/primitive/group/group_from_double_several_links.cc,
* src/primitive/group/group_from_several_left_links.cc,
* src/primitive/group/group_from_single_link.cc,
* src/text_in_picture.cc,
* src/text_in_picture_neg.cc,
* src/text_recognition_in_picture.cc,
* tests/filter/components_large.cc,
* tests/filter/components_small.cc: Update includes.
---
scribo/ChangeLog | 34 +++
scribo/scribo/debug/alignment_decision_image.hh | 87 ++-------
scribo/scribo/debug/all.hh | 7 +-
.../{save_bboxes_image.hh => bboxes_image.hh} | 82 ++++----
...nked_bboxes_image.hh => linked_bboxes_image.hh} | 213 +++++++++-----------
.../{links_decision_image.hh => links_image.hh} | 77 ++++----
.../scribo/debug/several_links_decision_image.hh | 179 ----------------
scribo/scribo/table/extract.hh | 6 +-
scribo/scribo/toolchain/text_in_picture.hh | 20 +-
.../src/debug/show_links_several_right_overlap.cc | 6 +-
scribo/src/debug/show_links_single_down.cc | 5 +-
.../debug/show_links_single_down_left_aligned.cc | 11 +-
.../debug/show_links_single_down_right_aligned.cc | 14 +-
scribo/src/debug/show_links_single_left.cc | 5 +-
.../src/debug/show_links_single_left_dmax_ratio.cc | 5 +-
scribo/src/debug/show_links_single_right.cc | 5 +-
.../debug/show_links_single_right_dmax_ratio.cc | 5 +-
scribo/src/debug/show_links_single_up.cc | 5 +-
.../src/debug/show_links_single_up_left_aligned.cc | 15 +-
.../debug/show_links_single_up_right_aligned.cc | 15 +-
scribo/src/debug/show_separators.cc | 6 +-
.../src/primitive/group/group_from_double_link.cc | 28 ++--
.../group/group_from_double_several_links.cc | 25 ++-
.../group/group_from_several_left_links.cc | 23 +-
.../src/primitive/group/group_from_single_link.cc | 36 ++--
scribo/src/text_in_picture.cc | 17 +-
scribo/src/text_in_picture_neg.cc | 2 -
scribo/src/text_recognition_in_picture.cc | 2 -
scribo/tests/filter/components_large.cc | 8 +-
scribo/tests/filter/components_small.cc | 8 +-
30 files changed, 357 insertions(+), 594 deletions(-)
rename scribo/scribo/debug/{save_bboxes_image.hh => bboxes_image.hh} (65%)
rename scribo/scribo/debug/{save_linked_bboxes_image.hh => linked_bboxes_image.hh} (54%)
copy scribo/scribo/debug/{links_decision_image.hh => links_image.hh} (58%)
delete mode 100644 scribo/scribo/debug/several_links_decision_image.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 714874c..439db69 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,37 @@
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Rename debug routines.
+
+ * scribo/debug/save_bboxes_image.hh,
+ * scribo/debug/save_linked_bboxes_image.hh: Rename as...
+ * scribo/debug/bboxes_image.hh,
+ * scribo/debug/linked_bboxes_image.hh: ... this.
+
+ * scribo/debug/all.hh,
+ * scribo/table/extract.hh,
+ * scribo/toolchain/text_in_picture.hh,
+ * src/debug/show_links_several_right_overlap.cc,
+ * src/debug/show_links_single_down.cc,
+ * src/debug/show_links_single_down_left_aligned.cc,
+ * src/debug/show_links_single_down_right_aligned.cc,
+ * src/debug/show_links_single_left.cc,
+ * src/debug/show_links_single_left_dmax_ratio.cc,
+ * src/debug/show_links_single_right.cc,
+ * src/debug/show_links_single_right_dmax_ratio.cc,
+ * src/debug/show_links_single_up.cc,
+ * src/debug/show_links_single_up_left_aligned.cc,
+ * src/debug/show_links_single_up_right_aligned.cc,
+ * src/debug/show_separators.cc,
+ * src/primitive/group/group_from_double_link.cc,
+ * src/primitive/group/group_from_double_several_links.cc,
+ * src/primitive/group/group_from_several_left_links.cc,
+ * src/primitive/group/group_from_single_link.cc,
+ * src/text_in_picture.cc,
+ * src/text_in_picture_neg.cc,
+ * src/text_recognition_in_picture.cc,
+ * tests/filter/components_large.cc,
+ * tests/filter/components_small.cc: Update includes.
+
2011-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
Add HAVE_QT guards.
diff --git a/scribo/scribo/debug/alignment_decision_image.hh b/scribo/scribo/debug/alignment_decision_image.hh
index 841bd38..450091d 100644
--- a/scribo/scribo/debug/alignment_decision_image.hh
+++ b/scribo/scribo/debug/alignment_decision_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -36,12 +37,12 @@
# include <mln/literal/colors.hh>
# include <mln/util/array.hh>
# include <mln/util/couple.hh>
-# include <mln/norm/l1.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/object_groups.hh>
# include <scribo/draw/bounding_boxes.hh>
+# include <scribo/primitive/link/internal/compute_anchor.hh>
namespace scribo
{
@@ -51,8 +52,6 @@ namespace scribo
using namespace mln;
- enum Alignment { top, center, bottom };
-
/*! \brief Save a color image showing the difference between to
object links.
@@ -70,54 +69,17 @@ namespace scribo
alignment_decision_image(const Image<I>& input_,
const object_links<L>& links,
const object_links<L>& filtered_links,
- const Alignment& alignment);
+ const anchor::Type& anchor);
# ifndef MLN_INCLUDE_ONLY
-
- namespace internal
- {
-
- template <typename L>
- mln::util::couple<mln_site(L),mln_site(L)>
- find_anchors(const component_set<L>& components,
- unsigned i,
- unsigned link_i,
- const Alignment& alignment)
- {
- mln_site(L)
- a1 = components(i).bbox().pcenter(),
- a2 = components(link_i).bbox().pcenter();
-
- switch (alignment)
- {
- case top:
- a1.row() = components(i).bbox().pmin().row();
- a2.row() = components(link_i).bbox().pmin().row();
- break;
-
- case center:
- break;
-
- case bottom:
- a1.row() = components(i).bbox().pmax().row();
- a2.row() = components(link_i).bbox().pmax().row();
- break;
-
- }
- return make::couple(a1, a2);
- }
-
- }
-
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- alignment_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links,
- const Alignment& alignment,
- unsigned max_link_length)
+ alignment_decision_image(const Image<I>& input_,
+ const object_links<L>& links,
+ const object_links<L>& filtered_links,
+ const anchor::Type& anchor)
{
trace::entering("scribo::debug::alignment_decision_image");
const I& input = exact(input_);
@@ -138,43 +100,26 @@ namespace scribo
typedef mln_site(L) P;
for_all_links(i, links)
- {
if (links(i) != i)
{
value::rgb8 value = literal::green;
+ P
+ anchor_i = primitive::link::internal::compute_anchor(components,
+ i, anchor),
+ anchor_li = primitive::link::internal::compute_anchor(components,
+ links(i),
+ anchor);
+
if (links(i) != filtered_links(i))
value = literal::red;
- mln::util::couple<P,P>
- anchors = internal::find_anchors(components, i, links(i), alignment);
- if (mln::norm::l1_distance(anchors.first().to_vec(), anchors.second().to_vec()) < max_link_length)
- mln::draw::line(decision_image,
- anchors.first(),
- anchors.second(),
- value);
+ mln::draw::line(decision_image, anchor_i, anchor_li, value);
}
- }
trace::exiting("scribo::debug::alignment_decision_image");
return decision_image;
}
-
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- alignment_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links,
- const Alignment& alignment)
- {
- return alignment_decision_image(input_,
- links,
- filtered_links,
- alignment,
- mln_max(unsigned));
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::debug
diff --git a/scribo/scribo/debug/all.hh b/scribo/scribo/debug/all.hh
index f7ffe1c..7181ec1 100644
--- a/scribo/scribo/debug/all.hh
+++ b/scribo/scribo/debug/all.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,9 +42,9 @@ namespace scribo
} // end of namespace scribo
-# include <scribo/debug/save_bboxes_image.hh>
+# include <scribo/debug/bboxes_image.hh>
# include <scribo/debug/save_label_image.hh>
-# include <scribo/debug/save_linked_bboxes_image.hh>
+# include <scribo/debug/linked_bboxes_image.hh>
# include <scribo/debug/save_table_image.hh>
#endif // ! SCRIBO_DEBUG_ALL_HH
diff --git a/scribo/scribo/debug/save_bboxes_image.hh b/scribo/scribo/debug/bboxes_image.hh
similarity index 65%
rename from scribo/scribo/debug/save_bboxes_image.hh
rename to scribo/scribo/debug/bboxes_image.hh
index ee781c1..ca3d646 100644
--- a/scribo/scribo/debug/save_bboxes_image.hh
+++ b/scribo/scribo/debug/bboxes_image.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.
//
@@ -24,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_DEBUG_SAVE_BBOXES_IMAGE_HH
-# define SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
+#ifndef SCRIBO_DEBUG_BBOXES_IMAGE_HH
+# define SCRIBO_DEBUG_BBOXES_IMAGE_HH
/// \file
///
@@ -53,18 +53,16 @@ namespace scribo
/// Draw a list of bounding boxes
template <typename I>
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const mln::util::array< box<mln_site(I)> >& bboxes,
- const std::string& filename,
const value::rgb8& value);
template <typename I, typename L>
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const line_set<L>& lines,
- const std::string& filename,
const value::rgb8& value);
/// \overload
@@ -72,50 +70,46 @@ namespace scribo
//
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const std::string& filename);
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const line_set<L>& lines);
/// \overload.
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const component_set<L>& comps,
- const std::string& filename,
const value::rgb8& value);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const mln::util::array< box<mln_site(I)> >& bboxes,
- const std::string& filename,
- const value::rgb8& value)
+ 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)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
draw::bounding_boxes(tmp, bboxes, value);
- mln::io::ppm::save(tmp, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return tmp;
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const line_set<L>& lines,
- const std::string& filename,
const value::rgb8& value)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I, value::rgb8)
@@ -125,31 +119,29 @@ namespace scribo
if (! lines(l).is_hidden())
mln::draw::box(output, lines(l).bbox(), value);
- mln::io::ppm::save(output, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return output;
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const std::string& filename)
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const line_set<L>& lines)
{
- return save_bboxes_image(input, lines, filename, literal::red);
+ return bboxes_image(input, lines, literal::red);
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const component_set<L>& comps,
- const std::string& filename,
- const value::rgb8& value)
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const component_set<L>& comps,
+ const value::rgb8& value)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I, value::rgb8)
@@ -159,8 +151,8 @@ namespace scribo
if (comps(c).is_valid())
mln::draw::box(output, comps(c).bbox(), value);
- mln::io::ppm::save(output, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return output;
}
@@ -171,4 +163,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_BBOXES_IMAGE_HH
diff --git a/scribo/scribo/debug/save_linked_bboxes_image.hh b/scribo/scribo/debug/linked_bboxes_image.hh
similarity index 54%
rename from scribo/scribo/debug/save_linked_bboxes_image.hh
rename to scribo/scribo/debug/linked_bboxes_image.hh
index d4c940a..2373405 100644
--- a/scribo/scribo/debug/save_linked_bboxes_image.hh
+++ b/scribo/scribo/debug/linked_bboxes_image.hh
@@ -24,12 +24,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
-# define SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
+#ifndef SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
+# define SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
/// \file
///
-/// Save the bounding box links image.
+/// Compute the bounding box links image.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/graph.hh>
@@ -56,54 +56,50 @@ namespace scribo
using namespace mln;
- /// Save the line of components links image.
+ /// Compute the line of components links image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] link_array Lines of components links.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
/// \param[in] anchor Anchor from where the links are drawn.
//
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& array,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& array,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
/// \overload
/// The default anchor type is set to anchor::Center.
//
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& array,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- const std::string& filename);
-
- /// Save the line of components left and right links image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& array,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value);
+
+ /// Compute the line of components left and right links image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] left_link Lines of components left links.
/// \param[in] right_link Lines of components right links.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
-
- /// Save the line of components left and right links image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
+
+ /// Compute the line of components left and right links image.
/// Draw also validated links.
///
/// \param[in,out] input The binary from where the components are extracted.
@@ -113,36 +109,34 @@ namespace scribo
/// \param[in] left_link_value Value used to draw line left links.
/// \param[in] right_link_value Value used to draw line left links.
/// \param[in] validated_link_value Value used to draw line validated links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& left_link_value,
- const value::rgb8& right_link_value,
- const value::rgb8& validated_link_value,
- anchor::Type anchor,
- const std::string& filename);
-
-
- /// Save the line link graph image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& left_link_value,
+ const value::rgb8& right_link_value,
+ const value::rgb8& validated_link_value,
+ anchor::Type anchor);
+
+
+ /// Compute the line link graph image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] g The link graph.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L, typename G>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const Graph<G>& g,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const Graph<G>& g,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
# ifndef MLN_INCLUDE_ONLY
@@ -150,15 +144,14 @@ namespace scribo
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& links,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& links,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
@@ -166,63 +159,58 @@ namespace scribo
draw::bounding_boxes(tmp, links.components(), box_value);
draw::bounding_box_links(tmp, links, link_value, anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& links,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& links,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value)
{
- save_linked_bboxes_image(input, links, box_value,
- link_value, anchor::Center, filename);
+ return linked_bboxes_image(input, links, box_value,
+ link_value, anchor::Center);
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& value,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& value)
{
- save_linked_bboxes_image(input,
- left_link,
- right_link,
- box_value,
- literal::yellow,
- literal::cyan,
- value,
- anchor::Center,
- filename);
+ return linked_bboxes_image(input,
+ left_link,
+ right_link,
+ box_value,
+ literal::yellow,
+ literal::cyan,
+ value,
+ anchor::Center);
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& left_link_value,
- const value::rgb8& right_link_value,
- const value::rgb8& validated_link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& left_link_value,
+ const value::rgb8& right_link_value,
+ const value::rgb8& validated_link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
@@ -234,24 +222,22 @@ namespace scribo
validated_link_value,
anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
template <typename I, typename L, typename G>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const Graph<G>& g,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const Graph<G>& g,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(g).is_valid());
mln_precondition(exact(input).is_valid());
@@ -261,9 +247,8 @@ namespace scribo
draw::bounding_box_links(tmp, exact(g).components(), g, link_value,
anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
@@ -274,4 +259,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
diff --git a/scribo/scribo/debug/links_decision_image.hh b/scribo/scribo/debug/links_image.hh
similarity index 58%
copy from scribo/scribo/debug/links_decision_image.hh
copy to scribo/scribo/debug/links_image.hh
index 387cd7f..76447b7 100644
--- a/scribo/scribo/debug/links_decision_image.hh
+++ b/scribo/scribo/debug/links_image.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,21 +23,23 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
-# define SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
+#ifndef SCRIBO_DEBUG_LINKS_IMAGE_HH
+# define SCRIBO_DEBUG_LINKS_IMAGE_HH
/// \file
///
-/// Save a color image showing the difference between to object groups.
+/// Save a color image showing components links.
# include <mln/core/concept/image.hh>
+# include <mln/accu/center.hh>
# include <mln/data/convert.hh>
# include <mln/value/rgb8.hh>
# include <mln/literal/colors.hh>
-# include <mln/draw/box.hh>
# include <mln/draw/line.hh>
# include <scribo/core/object_links.hh>
+# include <scribo/draw/bounding_boxes.hh>
+# include <scribo/primitive/link/internal/compute_anchor.hh>
namespace scribo
@@ -52,52 +53,46 @@ namespace scribo
/// FIXME: DOC!
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links);
+ links_image(const Image<I>& input_,
+ const object_links<L>& links,
+ anchor::Type anchor);
+
# ifndef MLN_INCLUDE_ONLY
+
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links)
+ links_image(const Image<I>& input_,
+ const object_links<L>& links,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::links_decision_image");
+ trace::entering("scribo::debug::links_image");
const I& input = exact(input_);
- const component_set<L>& comps = links.components();
-
mln_precondition(input.is_valid());
- mln_precondition(comps.is_valid());
mln_precondition(links.is_valid());
- mln_precondition(filtered_links.is_valid());
- mln_precondition(links.size() == filtered_links.size());
- /// Fixme: check that objects has been computed from input.
-
- image2d<value::rgb8>
- links_decision_image = data::convert(value::rgb8(), input);
- for_all_comps(i, comps)
- mln::draw::box(links_decision_image, comps(i).bbox(), literal::blue);
-
- for_all_links(i, links)
- if (links(i) != i)
- {
- value::rgb8 value = literal::green;
- if (links(i) != filtered_links(i))
- value = literal::red;
-
- mln_site(I)
- p1 = comps(i).mass_center(),
- p2 = comps(links(i)).mass_center();
-
- mln::draw::line(links_decision_image, p1, p2, value);
- }
+ const component_set<L>& comps = links.components();
- trace::exiting("scribo::debug::links_decision_image");
- return links_decision_image;
+ image2d<value::rgb8>
+ links_image = data::convert(value::rgb8(), input);
+
+ scribo::draw::bounding_boxes(links_image, comps, literal::blue);
+
+ for_all_links(l, links)
+ if (links(l) != l)
+ mln::draw::line(links_image,
+ primitive::link::internal::compute_anchor(comps,
+ l,
+ anchor),
+ primitive::link::internal::compute_anchor(comps,
+ links(l),
+ anchor),
+ literal::green);
+
+ trace::exiting("scribo::debug::links_image");
+ return links_image;
}
@@ -108,4 +103,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_LINKS_IMAGE_HH
diff --git a/scribo/scribo/debug/several_links_decision_image.hh b/scribo/scribo/debug/several_links_decision_image.hh
deleted file mode 100644
index 73e66a1..0000000
--- a/scribo/scribo/debug/several_links_decision_image.hh
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (C) 2009 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_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
-# define SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
-
-/// \file
-///
-/// Save a color image showing the difference between to object groups.
-
-# include <mln/core/concept/image.hh>
-# include <mln/accu/center.hh>
-# include <mln/data/convert.hh>
-# include <mln/value/rgb8.hh>
-# include <mln/literal/colors.hh>
-# include <mln/util/array.hh>
-
-# include <scribo/core/object_groups.hh>
-# include <scribo/draw/bounding_boxes.hh>
-
-
-namespace scribo
-{
-
- namespace debug
- {
-
- using namespace mln;
-
- /// FIXME: DOC!
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- several_links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
-
- namespace internal
- {
-
- template <typename L, typename I>
- bool
- draw_line(const L& objects, I& output,
- unsigned link,
- const mln_site(L)& p1, const mln_site(L)& p2,
- const mln_value(I)& value)
- {
-
- if (objects.domain().has(p2))
- if (objects(p2) == link)
- {
- mln::draw::line(output, p1, p2, value);
- return true;
- }
- return false;
- }
-
- }
-
-
-
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- several_links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links)
- {
- trace::entering("scribo::debug::several_links_decision_image");
- const I& input = exact(input_);
-
- const component_set<L>& comps = links.components();
-
- mln_precondition(input.is_valid());
- mln_precondition(links.is_valid());
- mln_precondition(filtered_links.is_valid());
-
- /// Fixme: check that objects has been computed from input.
-
- image2d<value::rgb8>
- links_decision_image = data::convert(value::rgb8(), input);
-
- for_all_comps(c, comps)
- mln::draw::box(links_decision_image, comps(c).bbox(), literal::blue);
-
- for_all_links(l, links)
- {
- if (links(l) != l)
- {
- value::rgb8 value = literal::green;
- if (links(l) != filtered_links(l))
- value = literal::red;
-
- mln_site(L) c = comps(l).bbox().pcenter();
-
- // Right link from the top anchor.
- mln_site(L) a1 = c;
- a1.row() = comps(l).bbox().pmin().row()
- + (c.row() - comps(l).bbox().pmin().row()) / 4;
-
- // Right link from the central site
- mln_site(I) p1 = comps(l).mass_center();
-
- // Right link from the bottom anchor.
- mln_site(L) a2 = c;
- a2.row() = comps(l).bbox().pmax().row()
- - (c.row() - comps(l).bbox().pmin().row()) / 4;
-
- mln_site(L)
- a1_bak = a1,
- a2_bak = a2;
-
- const L& lbl_ima = comps.labeled_image();
-
- mln_site(L) tmp;
- while(lbl_ima.domain().has(a1)
- || lbl_ima.domain().has(a2)
- || lbl_ima.domain().has(p1))
- {
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- a1_bak, a1, value))
- break;
- else
- ++a1.col();
-
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- comps(l).mass_center(), p1, value))
- break;
- else
- ++p1.col();
-
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- a2_bak, a2, value))
- break;
- else
- ++a2.col();
-
- }
- }
- }
-
- trace::exiting("scribo::debug::several_links_decision_image");
- return links_decision_image;
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::debug
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
diff --git a/scribo/scribo/table/extract.hh b/scribo/scribo/table/extract.hh
index 49a7d50..a87667f 100644
--- a/scribo/scribo/table/extract.hh
+++ b/scribo/scribo/table/extract.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.
//
@@ -45,8 +45,6 @@
# include <scribo/primitive/extract/lines_v_pattern.hh>
# include <scribo/primitive/extract/components.hh>
-# include <scribo/debug/save_bboxes_image.hh>
-
namespace scribo
{
diff --git a/scribo/scribo/toolchain/text_in_picture.hh b/scribo/scribo/toolchain/text_in_picture.hh
index 9746645..42e69db 100644
--- a/scribo/scribo/toolchain/text_in_picture.hh
+++ b/scribo/scribo/toolchain/text_in_picture.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.
//
@@ -74,7 +74,7 @@
# include <scribo/filter/object_groups_v_thickness.hh>
# include <scribo/debug/decision_image.hh>
-# include <scribo/debug/save_linked_bboxes_image.hh>
+# include <scribo/debug/linked_bboxes_image.hh>
# include <scribo/debug/usage.hh>
@@ -321,13 +321,13 @@ namespace scribo
if (debug)
{
std::cerr << "BEFORE - ncomponents = " << filtered_components.nelements() << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan,
- literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
}
#endif
diff --git a/scribo/src/debug/show_links_several_right_overlap.cc b/scribo/src/debug/show_links_several_right_overlap.cc
index ae27e55..5559fec 100644
--- a/scribo/src/debug/show_links_several_right_overlap.cc
+++ b/scribo/src/debug/show_links_several_right_overlap.cc
@@ -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.
//
@@ -48,8 +48,6 @@
#include <scribo/primitive/link/compute_several.hh>
#include <scribo/draw/bounding_boxes.hh>
-
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_down.cc b/scribo/src/debug/show_links_single_down.cc
index f1ed130..8ea3d6a 100644
--- a/scribo/src/debug/show_links_single_down.cc
+++ b/scribo/src/debug/show_links_single_down.cc
@@ -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.
//
@@ -46,7 +46,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_down_left_aligned.cc b/scribo/src/debug/show_links_single_down_left_aligned.cc
index ea31db7..5804799 100644
--- a/scribo/src/debug/show_links_single_down_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_left_aligned.cc
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -94,8 +94,9 @@ int main(int argc, char* argv[])
down_links = filter::object_links_left_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, down_links,
- literal::blue, literal::green,
- anchor::ActualLeft,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, down_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictLeft),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_down_right_aligned.cc b/scribo/src/debug/show_links_single_down_right_aligned.cc
index d261e5c..38cc335 100644
--- a/scribo/src/debug/show_links_single_down_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_right_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -95,8 +95,8 @@ int main(int argc, char* argv[])
down_links = filter::object_links_right_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, down_links,
- literal::blue, literal::green,
- anchor::ActualRight,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, down_links,
+ literal::blue, literal::green,
+ anchor::StrictRight),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_left.cc b/scribo/src/debug/show_links_single_left.cc
index 2211ce1..dfcb07b 100644
--- a/scribo/src/debug/show_links_single_left.cc
+++ b/scribo/src/debug/show_links_single_left.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_left_dmax_ratio.cc b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
index 9b48a42..c1d6b01 100644
--- a/scribo/src/debug/show_links_single_left_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_right.cc b/scribo/src/debug/show_links_single_right.cc
index 2392e62..9b37c44 100644
--- a/scribo/src/debug/show_links_single_right.cc
+++ b/scribo/src/debug/show_links_single_right.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_right_dmax_ratio.cc b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
index 5b292ed..133fe82 100644
--- a/scribo/src/debug/show_links_single_right_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_up.cc b/scribo/src/debug/show_links_single_up.cc
index db9d3e7..1933af1 100644
--- a/scribo/src/debug/show_links_single_up.cc
+++ b/scribo/src/debug/show_links_single_up.cc
@@ -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.
//
@@ -46,7 +46,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_up_left_aligned.cc b/scribo/src/debug/show_links_single_up_left_aligned.cc
index d0df1e4..839aad8 100644
--- a/scribo/src/debug/show_links_single_up_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_left_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -96,8 +96,9 @@ int main(int argc, char* argv[])
up_links = filter::object_links_left_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, up_links,
- literal::blue, literal::green,
- anchor::ActualLeft,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, up_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictLeft),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_up_right_aligned.cc b/scribo/src/debug/show_links_single_up_right_aligned.cc
index 3f40daf..561fbe9 100644
--- a/scribo/src/debug/show_links_single_up_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_right_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -94,8 +94,9 @@ int main(int argc, char* argv[])
up_links = filter::object_links_right_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, up_links,
- literal::blue, literal::green,
- anchor::ActualRight,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, up_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictRight),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_separators.cc b/scribo/src/debug/show_separators.cc
index ef80da6..40e2fde 100644
--- a/scribo/src/debug/show_separators.cc
+++ b/scribo/src/debug/show_separators.cc
@@ -18,13 +18,15 @@
#include <mln/core/alias/box2d.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/io/pbm/all.hh>
+#include <mln/io/ppm/save.hh>
#include <mln/arith/plus.hh>
#include <mln/labeling/foreground.hh>
+#include <mln/labeling/compute.hh>
#include <scribo/primitive/extract/lines_h_pattern.hh>
#include <scribo/primitive/extract/lines_v_pattern.hh>
#include <scribo/debug/usage.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
const char *args_desc[][2] =
@@ -90,7 +92,7 @@ int main(int argc, char *argv[])
image2d<value::int_u8> lbl = labeling::foreground(v_lines, c4(), nlabels);
mln::util::array<box2d>
bbox = labeling::compute(accu::shape::bbox<point2d>(), lbl, nlabels);
- scribo::debug::save_bboxes_image(input, bbox, argv[4], literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, bbox, literal::red), argv[4]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/group/group_from_double_link.cc b/scribo/src/primitive/group/group_from_double_link.cc
index 39b1bb9..ec4e180 100644
--- a/scribo/src/primitive/group/group_from_double_link.cc
+++ b/scribo/src/primitive/group/group_from_double_link.cc
@@ -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.
//
@@ -41,11 +41,11 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -95,12 +95,14 @@ int main(int argc, char *argv[])
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan, literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red,
+ literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
// With validation.
object_groups<L> groups
@@ -116,8 +118,8 @@ int main(int argc, char *argv[])
std::cout << "AFTER double grouping - nbboxes = "
<< grouped_text.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_text,
- scribo::make::debug_filename("bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_text,
+ literal::red),
+ scribo::make::debug_filename("bboxes.ppm"));
}
diff --git a/scribo/src/primitive/group/group_from_double_several_links.cc b/scribo/src/primitive/group/group_from_double_several_links.cc
index 2a49b33..86b3cf4 100644
--- a/scribo/src/primitive/group/group_from_double_several_links.cc
+++ b/scribo/src/primitive/group/group_from_double_several_links.cc
@@ -41,11 +41,11 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/link/with_several_right_links.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -89,12 +89,15 @@ int main(int argc, char* argv[])
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan, literal::yellow,
- literal::green,
- anchor::Center,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ right_link,
+ literal::red,
+ literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::Center),
+ scribo::make::debug_filename("links.ppm"));
// With validation.
std::cout << "Group from double link" << std::endl;
@@ -111,8 +114,8 @@ int main(int argc, char* argv[])
std::cout << "AFTER double grouping - nbboxes = " << grouped_comps.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("bboxes.ppm"));
}
diff --git a/scribo/src/primitive/group/group_from_several_left_links.cc b/scribo/src/primitive/group/group_from_several_left_links.cc
index ef70a19..42ad98a 100644
--- a/scribo/src/primitive/group/group_from_several_left_links.cc
+++ b/scribo/src/primitive/group/group_from_several_left_links.cc
@@ -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.
//
@@ -46,8 +46,8 @@
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/group/from_single_link.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -80,10 +80,11 @@ int main(int argc, char* argv[])
= primitive::link::with_several_left_links(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("left_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ literal::red,
+ literal::cyan),
+ scribo::make::debug_filename("left_links.ppm"));
object_groups<L>
@@ -96,9 +97,9 @@ int main(int argc, char* argv[])
grouped_comps.labeled_image(),
grouped_comps.nelements()),
scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("left_bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("left_bboxes.ppm"));
}
}
diff --git a/scribo/src/primitive/group/group_from_single_link.cc b/scribo/src/primitive/group/group_from_single_link.cc
index 5b5f710..fc904a0 100644
--- a/scribo/src/primitive/group/group_from_single_link.cc
+++ b/scribo/src/primitive/group/group_from_single_link.cc
@@ -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.
//
@@ -44,8 +44,8 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/primitive/group/apply.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -80,10 +80,11 @@ int main(int argc, char* argv[])
= primitive::link::with_single_left_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("left_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ literal::red,
+ literal::cyan),
+ scribo::make::debug_filename("left_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
// comps,
// comps.nlabels()),
@@ -99,8 +100,9 @@ int main(int argc, char* argv[])
grouped_comps.labeled_image(),
grouped_comps.nelements()),
scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("left_bboxes.ppm"), literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("left_bboxes.ppm"));
}
{
@@ -109,10 +111,10 @@ int main(int argc, char* argv[])
= primitive::link::with_single_right_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- right_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("right_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ right_link,
+ literal::red, literal::cyan),
+ scribo::make::debug_filename("right_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
// comps,
// comps.nlabels()),
@@ -129,9 +131,9 @@ int main(int argc, char* argv[])
scribo::make::debug_filename("right_label_color.ppm"));
std::cout << "AFTER - nbboxes = " << grouped_comps.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("right_bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("right_bboxes.ppm"));
}
diff --git a/scribo/src/text_in_picture.cc b/scribo/src/text_in_picture.cc
index 77cf7b6..af00c4f 100644
--- a/scribo/src/text_in_picture.cc
+++ b/scribo/src/text_in_picture.cc
@@ -75,8 +75,7 @@
#include <scribo/debug/text_areas_image.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -342,13 +341,13 @@ int main(int argc, char* argv[])
if (debug)
{
std::cerr << "BEFORE - ncomponents = " << filtered_components.nelements() << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan,
- literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
}
#endif
diff --git a/scribo/src/text_in_picture_neg.cc b/scribo/src/text_in_picture_neg.cc
index 8d818e0..2b06a72 100644
--- a/scribo/src/text_in_picture_neg.cc
+++ b/scribo/src/text_in_picture_neg.cc
@@ -92,8 +92,6 @@
#include <scribo/debug/text_areas_image.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/text_recognition_in_picture.cc b/scribo/src/text_recognition_in_picture.cc
index 8b76f48..de7a9ed 100644
--- a/scribo/src/text_recognition_in_picture.cc
+++ b/scribo/src/text_recognition_in_picture.cc
@@ -95,8 +95,6 @@
#include <scribo/debug/highlight_text_area.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/tests/filter/components_large.cc b/scribo/tests/filter/components_large.cc
index 543b90d..4a7a10b 100644
--- a/scribo/tests/filter/components_large.cc
+++ b/scribo/tests/filter/components_large.cc
@@ -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.
//
@@ -40,10 +40,6 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/objects_large.hh>
-#include <scribo/make/debug_filename.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
-
#include "tests/data.hh"
int main()
diff --git a/scribo/tests/filter/components_small.cc b/scribo/tests/filter/components_small.cc
index d9b5325..d5d466c 100644
--- a/scribo/tests/filter/components_small.cc
+++ b/scribo/tests/filter/components_small.cc
@@ -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.
//
@@ -40,10 +40,6 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/make/debug_filename.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
-
#include "tests/data.hh"
--
1.5.6.5
1
0
14 Mar '11
* scribo/debug/save_bboxes_image.hh,
* scribo/debug/save_linked_bboxes_image.hh: Rename as...
* scribo/debug/bboxes_image.hh,
* scribo/debug/linked_bboxes_image.hh: ... this.
* scribo/debug/links_image.hh: New.
* scribo/debug/several_links_decision_image.hh:
Remove. Deprecated.
* scribo/debug/alignment_decision_image.hh: Make use of
compute_anchor routine.
* scribo/debug/all.hh,
* scribo/table/extract.hh,
* scribo/toolchain/text_in_picture.hh,
* src/debug/show_links_several_right_overlap.cc,
* src/debug/show_links_single_down.cc,
* src/debug/show_links_single_down_left_aligned.cc,
* src/debug/show_links_single_down_right_aligned.cc,
* src/debug/show_links_single_left.cc,
* src/debug/show_links_single_left_dmax_ratio.cc,
* src/debug/show_links_single_right.cc,
* src/debug/show_links_single_right_dmax_ratio.cc,
* src/debug/show_links_single_up.cc,
* src/debug/show_links_single_up_left_aligned.cc,
* src/debug/show_links_single_up_right_aligned.cc,
* src/debug/show_separators.cc,
* src/primitive/group/group_from_double_link.cc,
* src/primitive/group/group_from_double_several_links.cc,
* src/primitive/group/group_from_several_left_links.cc,
* src/primitive/group/group_from_single_link.cc,
* src/text_in_picture.cc,
* src/text_in_picture_neg.cc,
* src/text_recognition_in_picture.cc,
* tests/filter/components_large.cc,
* tests/filter/components_small.cc: Update includes.
---
scribo/ChangeLog | 34 +++
scribo/scribo/debug/alignment_decision_image.hh | 87 ++-------
scribo/scribo/debug/all.hh | 7 +-
.../{save_bboxes_image.hh => bboxes_image.hh} | 82 ++++----
...nked_bboxes_image.hh => linked_bboxes_image.hh} | 213 +++++++++-----------
.../{links_decision_image.hh => links_image.hh} | 77 ++++----
.../scribo/debug/several_links_decision_image.hh | 179 ----------------
scribo/scribo/table/extract.hh | 6 +-
scribo/scribo/toolchain/text_in_picture.hh | 20 +-
.../src/debug/show_links_several_right_overlap.cc | 6 +-
scribo/src/debug/show_links_single_down.cc | 5 +-
.../debug/show_links_single_down_left_aligned.cc | 11 +-
.../debug/show_links_single_down_right_aligned.cc | 14 +-
scribo/src/debug/show_links_single_left.cc | 5 +-
.../src/debug/show_links_single_left_dmax_ratio.cc | 5 +-
scribo/src/debug/show_links_single_right.cc | 5 +-
.../debug/show_links_single_right_dmax_ratio.cc | 5 +-
scribo/src/debug/show_links_single_up.cc | 5 +-
.../src/debug/show_links_single_up_left_aligned.cc | 15 +-
.../debug/show_links_single_up_right_aligned.cc | 15 +-
scribo/src/debug/show_separators.cc | 6 +-
.../src/primitive/group/group_from_double_link.cc | 28 ++--
.../group/group_from_double_several_links.cc | 25 ++-
.../group/group_from_several_left_links.cc | 23 +-
.../src/primitive/group/group_from_single_link.cc | 36 ++--
scribo/src/text_in_picture.cc | 17 +-
scribo/src/text_in_picture_neg.cc | 2 -
scribo/src/text_recognition_in_picture.cc | 2 -
scribo/tests/filter/components_large.cc | 8 +-
scribo/tests/filter/components_small.cc | 8 +-
30 files changed, 357 insertions(+), 594 deletions(-)
rename scribo/scribo/debug/{save_bboxes_image.hh => bboxes_image.hh} (65%)
rename scribo/scribo/debug/{save_linked_bboxes_image.hh => linked_bboxes_image.hh} (54%)
copy scribo/scribo/debug/{links_decision_image.hh => links_image.hh} (58%)
delete mode 100644 scribo/scribo/debug/several_links_decision_image.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 714874c..439db69 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,37 @@
+2011-03-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Rename debug routines.
+
+ * scribo/debug/save_bboxes_image.hh,
+ * scribo/debug/save_linked_bboxes_image.hh: Rename as...
+ * scribo/debug/bboxes_image.hh,
+ * scribo/debug/linked_bboxes_image.hh: ... this.
+
+ * scribo/debug/all.hh,
+ * scribo/table/extract.hh,
+ * scribo/toolchain/text_in_picture.hh,
+ * src/debug/show_links_several_right_overlap.cc,
+ * src/debug/show_links_single_down.cc,
+ * src/debug/show_links_single_down_left_aligned.cc,
+ * src/debug/show_links_single_down_right_aligned.cc,
+ * src/debug/show_links_single_left.cc,
+ * src/debug/show_links_single_left_dmax_ratio.cc,
+ * src/debug/show_links_single_right.cc,
+ * src/debug/show_links_single_right_dmax_ratio.cc,
+ * src/debug/show_links_single_up.cc,
+ * src/debug/show_links_single_up_left_aligned.cc,
+ * src/debug/show_links_single_up_right_aligned.cc,
+ * src/debug/show_separators.cc,
+ * src/primitive/group/group_from_double_link.cc,
+ * src/primitive/group/group_from_double_several_links.cc,
+ * src/primitive/group/group_from_several_left_links.cc,
+ * src/primitive/group/group_from_single_link.cc,
+ * src/text_in_picture.cc,
+ * src/text_in_picture_neg.cc,
+ * src/text_recognition_in_picture.cc,
+ * tests/filter/components_large.cc,
+ * tests/filter/components_small.cc: Update includes.
+
2011-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
Add HAVE_QT guards.
diff --git a/scribo/scribo/debug/alignment_decision_image.hh b/scribo/scribo/debug/alignment_decision_image.hh
index 841bd38..450091d 100644
--- a/scribo/scribo/debug/alignment_decision_image.hh
+++ b/scribo/scribo/debug/alignment_decision_image.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -36,12 +37,12 @@
# include <mln/literal/colors.hh>
# include <mln/util/array.hh>
# include <mln/util/couple.hh>
-# include <mln/norm/l1.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/object_groups.hh>
# include <scribo/draw/bounding_boxes.hh>
+# include <scribo/primitive/link/internal/compute_anchor.hh>
namespace scribo
{
@@ -51,8 +52,6 @@ namespace scribo
using namespace mln;
- enum Alignment { top, center, bottom };
-
/*! \brief Save a color image showing the difference between to
object links.
@@ -70,54 +69,17 @@ namespace scribo
alignment_decision_image(const Image<I>& input_,
const object_links<L>& links,
const object_links<L>& filtered_links,
- const Alignment& alignment);
+ const anchor::Type& anchor);
# ifndef MLN_INCLUDE_ONLY
-
- namespace internal
- {
-
- template <typename L>
- mln::util::couple<mln_site(L),mln_site(L)>
- find_anchors(const component_set<L>& components,
- unsigned i,
- unsigned link_i,
- const Alignment& alignment)
- {
- mln_site(L)
- a1 = components(i).bbox().pcenter(),
- a2 = components(link_i).bbox().pcenter();
-
- switch (alignment)
- {
- case top:
- a1.row() = components(i).bbox().pmin().row();
- a2.row() = components(link_i).bbox().pmin().row();
- break;
-
- case center:
- break;
-
- case bottom:
- a1.row() = components(i).bbox().pmax().row();
- a2.row() = components(link_i).bbox().pmax().row();
- break;
-
- }
- return make::couple(a1, a2);
- }
-
- }
-
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- alignment_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links,
- const Alignment& alignment,
- unsigned max_link_length)
+ alignment_decision_image(const Image<I>& input_,
+ const object_links<L>& links,
+ const object_links<L>& filtered_links,
+ const anchor::Type& anchor)
{
trace::entering("scribo::debug::alignment_decision_image");
const I& input = exact(input_);
@@ -138,43 +100,26 @@ namespace scribo
typedef mln_site(L) P;
for_all_links(i, links)
- {
if (links(i) != i)
{
value::rgb8 value = literal::green;
+ P
+ anchor_i = primitive::link::internal::compute_anchor(components,
+ i, anchor),
+ anchor_li = primitive::link::internal::compute_anchor(components,
+ links(i),
+ anchor);
+
if (links(i) != filtered_links(i))
value = literal::red;
- mln::util::couple<P,P>
- anchors = internal::find_anchors(components, i, links(i), alignment);
- if (mln::norm::l1_distance(anchors.first().to_vec(), anchors.second().to_vec()) < max_link_length)
- mln::draw::line(decision_image,
- anchors.first(),
- anchors.second(),
- value);
+ mln::draw::line(decision_image, anchor_i, anchor_li, value);
}
- }
trace::exiting("scribo::debug::alignment_decision_image");
return decision_image;
}
-
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- alignment_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links,
- const Alignment& alignment)
- {
- return alignment_decision_image(input_,
- links,
- filtered_links,
- alignment,
- mln_max(unsigned));
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::debug
diff --git a/scribo/scribo/debug/all.hh b/scribo/scribo/debug/all.hh
index f7ffe1c..7181ec1 100644
--- a/scribo/scribo/debug/all.hh
+++ b/scribo/scribo/debug/all.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -41,9 +42,9 @@ namespace scribo
} // end of namespace scribo
-# include <scribo/debug/save_bboxes_image.hh>
+# include <scribo/debug/bboxes_image.hh>
# include <scribo/debug/save_label_image.hh>
-# include <scribo/debug/save_linked_bboxes_image.hh>
+# include <scribo/debug/linked_bboxes_image.hh>
# include <scribo/debug/save_table_image.hh>
#endif // ! SCRIBO_DEBUG_ALL_HH
diff --git a/scribo/scribo/debug/save_bboxes_image.hh b/scribo/scribo/debug/bboxes_image.hh
similarity index 65%
rename from scribo/scribo/debug/save_bboxes_image.hh
rename to scribo/scribo/debug/bboxes_image.hh
index ee781c1..ca3d646 100644
--- a/scribo/scribo/debug/save_bboxes_image.hh
+++ b/scribo/scribo/debug/bboxes_image.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.
//
@@ -24,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_DEBUG_SAVE_BBOXES_IMAGE_HH
-# define SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
+#ifndef SCRIBO_DEBUG_BBOXES_IMAGE_HH
+# define SCRIBO_DEBUG_BBOXES_IMAGE_HH
/// \file
///
@@ -53,18 +53,16 @@ namespace scribo
/// Draw a list of bounding boxes
template <typename I>
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const mln::util::array< box<mln_site(I)> >& bboxes,
- const std::string& filename,
const value::rgb8& value);
template <typename I, typename L>
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const line_set<L>& lines,
- const std::string& filename,
const value::rgb8& value);
/// \overload
@@ -72,50 +70,46 @@ namespace scribo
//
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const std::string& filename);
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const line_set<L>& lines);
/// \overload.
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const component_set<L>& comps,
- const std::string& filename,
const value::rgb8& value);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const mln::util::array< box<mln_site(I)> >& bboxes,
- const std::string& filename,
- const value::rgb8& value)
+ 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)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
draw::bounding_boxes(tmp, bboxes, value);
- mln::io::ppm::save(tmp, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return tmp;
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
const line_set<L>& lines,
- const std::string& filename,
const value::rgb8& value)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I, value::rgb8)
@@ -125,31 +119,29 @@ namespace scribo
if (! lines(l).is_hidden())
mln::draw::box(output, lines(l).bbox(), value);
- mln::io::ppm::save(output, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return output;
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const line_set<L>& lines,
- const std::string& filename)
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const line_set<L>& lines)
{
- return save_bboxes_image(input, lines, filename, literal::red);
+ return bboxes_image(input, lines, literal::red);
}
template <typename I, typename L>
inline
- void
- save_bboxes_image(const Image<I>& input,
- const component_set<L>& comps,
- const std::string& filename,
- const value::rgb8& value)
+ mln_ch_value(I, value::rgb8)
+ bboxes_image(const Image<I>& input,
+ const component_set<L>& comps,
+ const value::rgb8& value)
{
- trace::entering("scribo::debug::save_bboxes_image");
+ trace::entering("scribo::debug::bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I, value::rgb8)
@@ -159,8 +151,8 @@ namespace scribo
if (comps(c).is_valid())
mln::draw::box(output, comps(c).bbox(), value);
- mln::io::ppm::save(output, filename);
- trace::exiting("scribo::debug::save_bboxes_image");
+ trace::exiting("scribo::debug::bboxes_image");
+ return output;
}
@@ -171,4 +163,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_SAVE_BBOXES_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_BBOXES_IMAGE_HH
diff --git a/scribo/scribo/debug/save_linked_bboxes_image.hh b/scribo/scribo/debug/linked_bboxes_image.hh
similarity index 54%
rename from scribo/scribo/debug/save_linked_bboxes_image.hh
rename to scribo/scribo/debug/linked_bboxes_image.hh
index d4c940a..2373405 100644
--- a/scribo/scribo/debug/save_linked_bboxes_image.hh
+++ b/scribo/scribo/debug/linked_bboxes_image.hh
@@ -24,12 +24,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
-# define SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
+#ifndef SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
+# define SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
/// \file
///
-/// Save the bounding box links image.
+/// Compute the bounding box links image.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/graph.hh>
@@ -56,54 +56,50 @@ namespace scribo
using namespace mln;
- /// Save the line of components links image.
+ /// Compute the line of components links image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] link_array Lines of components links.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
/// \param[in] anchor Anchor from where the links are drawn.
//
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& array,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& array,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
/// \overload
/// The default anchor type is set to anchor::Center.
//
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& array,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- const std::string& filename);
-
- /// Save the line of components left and right links image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& array,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value);
+
+ /// Compute the line of components left and right links image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] left_link Lines of components left links.
/// \param[in] right_link Lines of components right links.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
-
- /// Save the line of components left and right links image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
+
+ /// Compute the line of components left and right links image.
/// Draw also validated links.
///
/// \param[in,out] input The binary from where the components are extracted.
@@ -113,36 +109,34 @@ namespace scribo
/// \param[in] left_link_value Value used to draw line left links.
/// \param[in] right_link_value Value used to draw line left links.
/// \param[in] validated_link_value Value used to draw line validated links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& left_link_value,
- const value::rgb8& right_link_value,
- const value::rgb8& validated_link_value,
- anchor::Type anchor,
- const std::string& filename);
-
-
- /// Save the line link graph image.
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& left_link_value,
+ const value::rgb8& right_link_value,
+ const value::rgb8& validated_link_value,
+ anchor::Type anchor);
+
+
+ /// Compute the line link graph image.
///
/// \param[in,out] input The binary from where the components are extracted.
/// \param[in] g The link graph.
/// \param[in] box_value Value used to draw line bounding boxes.
/// \param[in] link_value Value used to draw line links.
- /// \param[in] filename The target file name.
+ //
template <typename I, typename L, typename G>
- void
- save_linked_bboxes_image(const Image<I>& input,
- const Graph<G>& g,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename);
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const Graph<G>& g,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor);
# ifndef MLN_INCLUDE_ONLY
@@ -150,15 +144,14 @@ namespace scribo
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& links,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& links,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
@@ -166,63 +159,58 @@ namespace scribo
draw::bounding_boxes(tmp, links.components(), box_value);
draw::bounding_box_links(tmp, links, link_value, anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& links,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& links,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value)
{
- save_linked_bboxes_image(input, links, box_value,
- link_value, anchor::Center, filename);
+ return linked_bboxes_image(input, links, box_value,
+ link_value, anchor::Center);
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& value,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& value)
{
- save_linked_bboxes_image(input,
- left_link,
- right_link,
- box_value,
- literal::yellow,
- literal::cyan,
- value,
- anchor::Center,
- filename);
+ return linked_bboxes_image(input,
+ left_link,
+ right_link,
+ box_value,
+ literal::yellow,
+ literal::cyan,
+ value,
+ anchor::Center);
}
template <typename I, typename L>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const object_links<L>& left_link,
- const object_links<L>& right_link,
- const value::rgb8& box_value,
- const value::rgb8& left_link_value,
- const value::rgb8& right_link_value,
- const value::rgb8& validated_link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const object_links<L>& left_link,
+ const object_links<L>& right_link,
+ const value::rgb8& box_value,
+ const value::rgb8& left_link_value,
+ const value::rgb8& right_link_value,
+ const value::rgb8& validated_link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(input).is_valid());
mln_ch_value(I,value::rgb8) tmp = data::convert(value::rgb8(), input);
@@ -234,24 +222,22 @@ namespace scribo
validated_link_value,
anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
template <typename I, typename L, typename G>
inline
- void
- save_linked_bboxes_image(const Image<I>& input,
- const Graph<G>& g,
- const value::rgb8& box_value,
- const value::rgb8& link_value,
- anchor::Type anchor,
- const std::string& filename)
+ mln_ch_value(I,value::rgb8)
+ linked_bboxes_image(const Image<I>& input,
+ const Graph<G>& g,
+ const value::rgb8& box_value,
+ const value::rgb8& link_value,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::save_linked_bboxes_image");
+ trace::entering("scribo::debug::linked_bboxes_image");
mln_precondition(exact(g).is_valid());
mln_precondition(exact(input).is_valid());
@@ -261,9 +247,8 @@ namespace scribo
draw::bounding_box_links(tmp, exact(g).components(), g, link_value,
anchor);
- mln::io::ppm::save(tmp, filename);
-
- trace::exiting("scribo::debug::save_linked_bboxes_image");
+ trace::exiting("scribo::debug::linked_bboxes_image");
+ return tmp;
}
@@ -274,4 +259,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_SAVE_LINKED_BBOXES_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_LINKED_BBOXES_IMAGE_HH
diff --git a/scribo/scribo/debug/links_decision_image.hh b/scribo/scribo/debug/links_image.hh
similarity index 58%
copy from scribo/scribo/debug/links_decision_image.hh
copy to scribo/scribo/debug/links_image.hh
index 387cd7f..76447b7 100644
--- a/scribo/scribo/debug/links_decision_image.hh
+++ b/scribo/scribo/debug/links_image.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,21 +23,23 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
-# define SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
+#ifndef SCRIBO_DEBUG_LINKS_IMAGE_HH
+# define SCRIBO_DEBUG_LINKS_IMAGE_HH
/// \file
///
-/// Save a color image showing the difference between to object groups.
+/// Save a color image showing components links.
# include <mln/core/concept/image.hh>
+# include <mln/accu/center.hh>
# include <mln/data/convert.hh>
# include <mln/value/rgb8.hh>
# include <mln/literal/colors.hh>
-# include <mln/draw/box.hh>
# include <mln/draw/line.hh>
# include <scribo/core/object_links.hh>
+# include <scribo/draw/bounding_boxes.hh>
+# include <scribo/primitive/link/internal/compute_anchor.hh>
namespace scribo
@@ -52,52 +53,46 @@ namespace scribo
/// FIXME: DOC!
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links);
+ links_image(const Image<I>& input_,
+ const object_links<L>& links,
+ anchor::Type anchor);
+
# ifndef MLN_INCLUDE_ONLY
+
template <typename I, typename L>
mln_ch_value(I,value::rgb8)
- links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links)
+ links_image(const Image<I>& input_,
+ const object_links<L>& links,
+ anchor::Type anchor)
{
- trace::entering("scribo::debug::links_decision_image");
+ trace::entering("scribo::debug::links_image");
const I& input = exact(input_);
- const component_set<L>& comps = links.components();
-
mln_precondition(input.is_valid());
- mln_precondition(comps.is_valid());
mln_precondition(links.is_valid());
- mln_precondition(filtered_links.is_valid());
- mln_precondition(links.size() == filtered_links.size());
- /// Fixme: check that objects has been computed from input.
-
- image2d<value::rgb8>
- links_decision_image = data::convert(value::rgb8(), input);
- for_all_comps(i, comps)
- mln::draw::box(links_decision_image, comps(i).bbox(), literal::blue);
-
- for_all_links(i, links)
- if (links(i) != i)
- {
- value::rgb8 value = literal::green;
- if (links(i) != filtered_links(i))
- value = literal::red;
-
- mln_site(I)
- p1 = comps(i).mass_center(),
- p2 = comps(links(i)).mass_center();
-
- mln::draw::line(links_decision_image, p1, p2, value);
- }
+ const component_set<L>& comps = links.components();
- trace::exiting("scribo::debug::links_decision_image");
- return links_decision_image;
+ image2d<value::rgb8>
+ links_image = data::convert(value::rgb8(), input);
+
+ scribo::draw::bounding_boxes(links_image, comps, literal::blue);
+
+ for_all_links(l, links)
+ if (links(l) != l)
+ mln::draw::line(links_image,
+ primitive::link::internal::compute_anchor(comps,
+ l,
+ anchor),
+ primitive::link::internal::compute_anchor(comps,
+ links(l),
+ anchor),
+ literal::green);
+
+ trace::exiting("scribo::debug::links_image");
+ return links_image;
}
@@ -108,4 +103,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEBUG_LINKS_DECISION_IMAGE_HH
+#endif // ! SCRIBO_DEBUG_LINKS_IMAGE_HH
diff --git a/scribo/scribo/debug/several_links_decision_image.hh b/scribo/scribo/debug/several_links_decision_image.hh
deleted file mode 100644
index 73e66a1..0000000
--- a/scribo/scribo/debug/several_links_decision_image.hh
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (C) 2009 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_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
-# define SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
-
-/// \file
-///
-/// Save a color image showing the difference between to object groups.
-
-# include <mln/core/concept/image.hh>
-# include <mln/accu/center.hh>
-# include <mln/data/convert.hh>
-# include <mln/value/rgb8.hh>
-# include <mln/literal/colors.hh>
-# include <mln/util/array.hh>
-
-# include <scribo/core/object_groups.hh>
-# include <scribo/draw/bounding_boxes.hh>
-
-
-namespace scribo
-{
-
- namespace debug
- {
-
- using namespace mln;
-
- /// FIXME: DOC!
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- several_links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
-
- namespace internal
- {
-
- template <typename L, typename I>
- bool
- draw_line(const L& objects, I& output,
- unsigned link,
- const mln_site(L)& p1, const mln_site(L)& p2,
- const mln_value(I)& value)
- {
-
- if (objects.domain().has(p2))
- if (objects(p2) == link)
- {
- mln::draw::line(output, p1, p2, value);
- return true;
- }
- return false;
- }
-
- }
-
-
-
- template <typename I, typename L>
- mln_ch_value(I,value::rgb8)
- several_links_decision_image(const Image<I>& input_,
- const object_links<L>& links,
- const object_links<L>& filtered_links)
- {
- trace::entering("scribo::debug::several_links_decision_image");
- const I& input = exact(input_);
-
- const component_set<L>& comps = links.components();
-
- mln_precondition(input.is_valid());
- mln_precondition(links.is_valid());
- mln_precondition(filtered_links.is_valid());
-
- /// Fixme: check that objects has been computed from input.
-
- image2d<value::rgb8>
- links_decision_image = data::convert(value::rgb8(), input);
-
- for_all_comps(c, comps)
- mln::draw::box(links_decision_image, comps(c).bbox(), literal::blue);
-
- for_all_links(l, links)
- {
- if (links(l) != l)
- {
- value::rgb8 value = literal::green;
- if (links(l) != filtered_links(l))
- value = literal::red;
-
- mln_site(L) c = comps(l).bbox().pcenter();
-
- // Right link from the top anchor.
- mln_site(L) a1 = c;
- a1.row() = comps(l).bbox().pmin().row()
- + (c.row() - comps(l).bbox().pmin().row()) / 4;
-
- // Right link from the central site
- mln_site(I) p1 = comps(l).mass_center();
-
- // Right link from the bottom anchor.
- mln_site(L) a2 = c;
- a2.row() = comps(l).bbox().pmax().row()
- - (c.row() - comps(l).bbox().pmin().row()) / 4;
-
- mln_site(L)
- a1_bak = a1,
- a2_bak = a2;
-
- const L& lbl_ima = comps.labeled_image();
-
- mln_site(L) tmp;
- while(lbl_ima.domain().has(a1)
- || lbl_ima.domain().has(a2)
- || lbl_ima.domain().has(p1))
- {
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- a1_bak, a1, value))
- break;
- else
- ++a1.col();
-
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- comps(l).mass_center(), p1, value))
- break;
- else
- ++p1.col();
-
- if (internal::draw_line(lbl_ima, links_decision_image, links(l),
- a2_bak, a2, value))
- break;
- else
- ++a2.col();
-
- }
- }
- }
-
- trace::exiting("scribo::debug::several_links_decision_image");
- return links_decision_image;
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::debug
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_DEBUG_SEVERAL_LINKS_DECISION_IMAGE_HH
diff --git a/scribo/scribo/table/extract.hh b/scribo/scribo/table/extract.hh
index 49a7d50..a87667f 100644
--- a/scribo/scribo/table/extract.hh
+++ b/scribo/scribo/table/extract.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.
//
@@ -45,8 +45,6 @@
# include <scribo/primitive/extract/lines_v_pattern.hh>
# include <scribo/primitive/extract/components.hh>
-# include <scribo/debug/save_bboxes_image.hh>
-
namespace scribo
{
diff --git a/scribo/scribo/toolchain/text_in_picture.hh b/scribo/scribo/toolchain/text_in_picture.hh
index 9746645..42e69db 100644
--- a/scribo/scribo/toolchain/text_in_picture.hh
+++ b/scribo/scribo/toolchain/text_in_picture.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.
//
@@ -74,7 +74,7 @@
# include <scribo/filter/object_groups_v_thickness.hh>
# include <scribo/debug/decision_image.hh>
-# include <scribo/debug/save_linked_bboxes_image.hh>
+# include <scribo/debug/linked_bboxes_image.hh>
# include <scribo/debug/usage.hh>
@@ -321,13 +321,13 @@ namespace scribo
if (debug)
{
std::cerr << "BEFORE - ncomponents = " << filtered_components.nelements() << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan,
- literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
}
#endif
diff --git a/scribo/src/debug/show_links_several_right_overlap.cc b/scribo/src/debug/show_links_several_right_overlap.cc
index ae27e55..5559fec 100644
--- a/scribo/src/debug/show_links_several_right_overlap.cc
+++ b/scribo/src/debug/show_links_several_right_overlap.cc
@@ -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.
//
@@ -48,8 +48,6 @@
#include <scribo/primitive/link/compute_several.hh>
#include <scribo/draw/bounding_boxes.hh>
-
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_down.cc b/scribo/src/debug/show_links_single_down.cc
index f1ed130..8ea3d6a 100644
--- a/scribo/src/debug/show_links_single_down.cc
+++ b/scribo/src/debug/show_links_single_down.cc
@@ -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.
//
@@ -46,7 +46,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_down_left_aligned.cc b/scribo/src/debug/show_links_single_down_left_aligned.cc
index ea31db7..5804799 100644
--- a/scribo/src/debug/show_links_single_down_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_left_aligned.cc
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -94,8 +94,9 @@ int main(int argc, char* argv[])
down_links = filter::object_links_left_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, down_links,
- literal::blue, literal::green,
- anchor::ActualLeft,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, down_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictLeft),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_down_right_aligned.cc b/scribo/src/debug/show_links_single_down_right_aligned.cc
index d261e5c..38cc335 100644
--- a/scribo/src/debug/show_links_single_down_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_right_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -95,8 +95,8 @@ int main(int argc, char* argv[])
down_links = filter::object_links_right_aligned(down_links, 5);
- scribo::debug::save_linked_bboxes_image(input, down_links,
- literal::blue, literal::green,
- anchor::ActualRight,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, down_links,
+ literal::blue, literal::green,
+ anchor::StrictRight),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_left.cc b/scribo/src/debug/show_links_single_left.cc
index 2211ce1..dfcb07b 100644
--- a/scribo/src/debug/show_links_single_left.cc
+++ b/scribo/src/debug/show_links_single_left.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_left_dmax_ratio.cc b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
index 9b48a42..c1d6b01 100644
--- a/scribo/src/debug/show_links_single_left_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_left_dmax_ratio.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_right.cc b/scribo/src/debug/show_links_single_right.cc
index 2392e62..9b37c44 100644
--- a/scribo/src/debug/show_links_single_right.cc
+++ b/scribo/src/debug/show_links_single_right.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_right_dmax_ratio.cc b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
index 5b292ed..133fe82 100644
--- a/scribo/src/debug/show_links_single_right_dmax_ratio.cc
+++ b/scribo/src/debug/show_links_single_right_dmax_ratio.cc
@@ -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.
//
@@ -47,7 +47,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_up.cc b/scribo/src/debug/show_links_single_up.cc
index db9d3e7..1933af1 100644
--- a/scribo/src/debug/show_links_single_up.cc
+++ b/scribo/src/debug/show_links_single_up.cc
@@ -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.
//
@@ -46,7 +46,6 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/debug/show_links_single_up_left_aligned.cc b/scribo/src/debug/show_links_single_up_left_aligned.cc
index d0df1e4..839aad8 100644
--- a/scribo/src/debug/show_links_single_up_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_left_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -96,8 +96,9 @@ int main(int argc, char* argv[])
up_links = filter::object_links_left_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, up_links,
- literal::blue, literal::green,
- anchor::ActualLeft,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, up_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictLeft),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_links_single_up_right_aligned.cc b/scribo/src/debug/show_links_single_up_right_aligned.cc
index 3f40daf..561fbe9 100644
--- a/scribo/src/debug/show_links_single_up_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_right_aligned.cc
@@ -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.
//
@@ -49,7 +49,7 @@
#include <scribo/draw/bounding_boxes.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -94,8 +94,9 @@ int main(int argc, char* argv[])
up_links = filter::object_links_right_aligned(up_links, 5);
- scribo::debug::save_linked_bboxes_image(input, up_links,
- literal::blue, literal::green,
- anchor::ActualRight,
- argv[3]);
+ io::ppm::save(scribo::debug::linked_bboxes_image(input, up_links,
+ literal::blue,
+ literal::green,
+ anchor::StrictRight),
+ argv[3]);
}
diff --git a/scribo/src/debug/show_separators.cc b/scribo/src/debug/show_separators.cc
index ef80da6..40e2fde 100644
--- a/scribo/src/debug/show_separators.cc
+++ b/scribo/src/debug/show_separators.cc
@@ -18,13 +18,15 @@
#include <mln/core/alias/box2d.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/io/pbm/all.hh>
+#include <mln/io/ppm/save.hh>
#include <mln/arith/plus.hh>
#include <mln/labeling/foreground.hh>
+#include <mln/labeling/compute.hh>
#include <scribo/primitive/extract/lines_h_pattern.hh>
#include <scribo/primitive/extract/lines_v_pattern.hh>
#include <scribo/debug/usage.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
const char *args_desc[][2] =
@@ -90,7 +92,7 @@ int main(int argc, char *argv[])
image2d<value::int_u8> lbl = labeling::foreground(v_lines, c4(), nlabels);
mln::util::array<box2d>
bbox = labeling::compute(accu::shape::bbox<point2d>(), lbl, nlabels);
- scribo::debug::save_bboxes_image(input, bbox, argv[4], literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, bbox, literal::red), argv[4]);
trace::exiting("main");
}
diff --git a/scribo/src/primitive/group/group_from_double_link.cc b/scribo/src/primitive/group/group_from_double_link.cc
index 39b1bb9..ec4e180 100644
--- a/scribo/src/primitive/group/group_from_double_link.cc
+++ b/scribo/src/primitive/group/group_from_double_link.cc
@@ -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.
//
@@ -41,11 +41,11 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -95,12 +95,14 @@ int main(int argc, char *argv[])
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan, literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red,
+ literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
// With validation.
object_groups<L> groups
@@ -116,8 +118,8 @@ int main(int argc, char *argv[])
std::cout << "AFTER double grouping - nbboxes = "
<< grouped_text.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_text,
- scribo::make::debug_filename("bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_text,
+ literal::red),
+ scribo::make::debug_filename("bboxes.ppm"));
}
diff --git a/scribo/src/primitive/group/group_from_double_several_links.cc b/scribo/src/primitive/group/group_from_double_several_links.cc
index 2a49b33..86b3cf4 100644
--- a/scribo/src/primitive/group/group_from_double_several_links.cc
+++ b/scribo/src/primitive/group/group_from_double_several_links.cc
@@ -41,11 +41,11 @@
#include <scribo/primitive/group/apply.hh>
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/link/with_several_right_links.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/primitive/group/from_double_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/debug/save_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -89,12 +89,15 @@ int main(int argc, char* argv[])
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan, literal::yellow,
- literal::green,
- anchor::Center,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ right_link,
+ literal::red,
+ literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::Center),
+ scribo::make::debug_filename("links.ppm"));
// With validation.
std::cout << "Group from double link" << std::endl;
@@ -111,8 +114,8 @@ int main(int argc, char* argv[])
std::cout << "AFTER double grouping - nbboxes = " << grouped_comps.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("bboxes.ppm"));
}
diff --git a/scribo/src/primitive/group/group_from_several_left_links.cc b/scribo/src/primitive/group/group_from_several_left_links.cc
index ef70a19..42ad98a 100644
--- a/scribo/src/primitive/group/group_from_several_left_links.cc
+++ b/scribo/src/primitive/group/group_from_several_left_links.cc
@@ -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.
//
@@ -46,8 +46,8 @@
#include <scribo/primitive/link/with_several_left_links.hh>
#include <scribo/primitive/group/from_single_link.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
int usage(const char *name)
@@ -80,10 +80,11 @@ int main(int argc, char* argv[])
= primitive::link::with_several_left_links(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("left_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ literal::red,
+ literal::cyan),
+ scribo::make::debug_filename("left_links.ppm"));
object_groups<L>
@@ -96,9 +97,9 @@ int main(int argc, char* argv[])
grouped_comps.labeled_image(),
grouped_comps.nelements()),
scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("left_bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("left_bboxes.ppm"));
}
}
diff --git a/scribo/src/primitive/group/group_from_single_link.cc b/scribo/src/primitive/group/group_from_single_link.cc
index 5b5f710..fc904a0 100644
--- a/scribo/src/primitive/group/group_from_single_link.cc
+++ b/scribo/src/primitive/group/group_from_single_link.cc
@@ -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.
//
@@ -44,8 +44,8 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/primitive/group/apply.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/make/debug_filename.hh>
@@ -80,10 +80,11 @@ int main(int argc, char* argv[])
= primitive::link::with_single_left_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("left_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link,
+ literal::red,
+ literal::cyan),
+ scribo::make::debug_filename("left_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
// comps,
// comps.nlabels()),
@@ -99,8 +100,9 @@ int main(int argc, char* argv[])
grouped_comps.labeled_image(),
grouped_comps.nelements()),
scribo::make::debug_filename("left_label_color.ppm"));
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("left_bboxes.ppm"), literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("left_bboxes.ppm"));
}
{
@@ -109,10 +111,10 @@ int main(int argc, char* argv[])
= primitive::link::with_single_right_link(comps, 30);
std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- right_link,
- literal::red, literal::cyan,
- scribo::make::debug_filename("right_links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ right_link,
+ literal::red, literal::cyan),
+ scribo::make::debug_filename("right_links.ppm"));
// io::ppm::save(mln::labeling::colorize(value::rgb8(),
// comps,
// comps.nlabels()),
@@ -129,9 +131,9 @@ int main(int argc, char* argv[])
scribo::make::debug_filename("right_label_color.ppm"));
std::cout << "AFTER - nbboxes = " << grouped_comps.nelements() << std::endl;
- scribo::debug::save_bboxes_image(input, grouped_comps,
- scribo::make::debug_filename("right_bboxes.ppm"),
- literal::red);
+ io::ppm::save(scribo::debug::bboxes_image(input, grouped_comps,
+ literal::red),
+ scribo::make::debug_filename("right_bboxes.ppm"));
}
diff --git a/scribo/src/text_in_picture.cc b/scribo/src/text_in_picture.cc
index 77cf7b6..af00c4f 100644
--- a/scribo/src/text_in_picture.cc
+++ b/scribo/src/text_in_picture.cc
@@ -75,8 +75,7 @@
#include <scribo/debug/text_areas_image.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
+#include <scribo/debug/linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
@@ -342,13 +341,13 @@ int main(int argc, char* argv[])
if (debug)
{
std::cerr << "BEFORE - ncomponents = " << filtered_components.nelements() << std::endl;
- scribo::debug::save_linked_bboxes_image(input,
- left_link, right_link,
- literal::red, literal::cyan,
- literal::yellow,
- literal::green,
- anchor::MassCenter,
- scribo::make::debug_filename("links.ppm"));
+ io::ppm::save(scribo::debug::linked_bboxes_image(input,
+ left_link, right_link,
+ literal::red, literal::cyan,
+ literal::yellow,
+ literal::green,
+ anchor::MassCenter),
+ scribo::make::debug_filename("links.ppm"));
}
#endif
diff --git a/scribo/src/text_in_picture_neg.cc b/scribo/src/text_in_picture_neg.cc
index 8d818e0..2b06a72 100644
--- a/scribo/src/text_in_picture_neg.cc
+++ b/scribo/src/text_in_picture_neg.cc
@@ -92,8 +92,6 @@
#include <scribo/debug/text_areas_image.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/src/text_recognition_in_picture.cc b/scribo/src/text_recognition_in_picture.cc
index 8b76f48..de7a9ed 100644
--- a/scribo/src/text_recognition_in_picture.cc
+++ b/scribo/src/text_recognition_in_picture.cc
@@ -95,8 +95,6 @@
#include <scribo/debug/highlight_text_area.hh>
#include <scribo/debug/decision_image.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
#include <scribo/debug/usage.hh>
diff --git a/scribo/tests/filter/components_large.cc b/scribo/tests/filter/components_large.cc
index 543b90d..4a7a10b 100644
--- a/scribo/tests/filter/components_large.cc
+++ b/scribo/tests/filter/components_large.cc
@@ -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.
//
@@ -40,10 +40,6 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/objects_large.hh>
-#include <scribo/make/debug_filename.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
-
#include "tests/data.hh"
int main()
diff --git a/scribo/tests/filter/components_small.cc b/scribo/tests/filter/components_small.cc
index d9b5325..d5d466c 100644
--- a/scribo/tests/filter/components_small.cc
+++ b/scribo/tests/filter/components_small.cc
@@ -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.
//
@@ -40,10 +40,6 @@
#include <scribo/primitive/group/from_single_link.hh>
#include <scribo/filter/objects_small.hh>
-#include <scribo/make/debug_filename.hh>
-#include <scribo/debug/save_bboxes_image.hh>
-#include <scribo/debug/save_linked_bboxes_image.hh>
-
#include "tests/data.hh"
--
1.5.6.5
1
0