* text/merging.hh: Change merge rules and improve integration with
Scribo line structures.
---
scribo/ChangeLog | 7 +
scribo/text/merging.hh | 550 ++++++++++++++++++++++++++++++------------------
2 files changed, 354 insertions(+), 203 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f0f0ec3..f5deefc 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2010-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Improve text line merging algorithm.
+
+ * text/merging.hh: Change merge rules and improve integration with
+ Scribo line structures.
+
+2010-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add a reconstruction algorithm.
* primitive/internal/rd.hh: New.
diff --git a/scribo/text/merging.hh b/scribo/text/merging.hh
index 2dba26c..e509475 100644
--- a/scribo/text/merging.hh
+++ b/scribo/text/merging.hh
@@ -1,3 +1,36 @@
+// Copyright (C) 2010 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_TEXT_MERGING_HH
+# define SCRIBO_TEXT_MERGING_HH
+
+/// \file
+///
+/// \brief Merge text component in order to reconstruct text lines.
+
+
#include <iostream>
#include <fstream>
#include <sstream>
@@ -16,6 +49,12 @@
#include <mln/make/box2d.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/draw/box.hh>
+#include <mln/data/stretch.hh>
+#include <mln/data/wrap.hh>
#include <mln/util/timer.hh>
@@ -26,6 +65,25 @@ namespace scribo
namespace text
{
+
+ /// \brief Merge text component in order to reconstruct text lines.
+ ///
+ /// \param[in] lines A line set.
+ ///
+ /// \return A new line set. Line ids are preserved and merged
+ /// lines (not valid anymore) are tagged with line::Merged. The
+ /// lines produced with this algorithm (valid lines) are tagged
+ /// with line::None. Line type is also set either with line::Text
+ /// or line::Punctuation.
+ //
+ template <typename L>
+ line_set<L>
+ merging(const scribo::line_set<L>& lines);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
namespace internal
{
@@ -33,13 +91,6 @@ namespace scribo
using value::int_u8;
- template <typename L>
- inline
- int delta_of_line(const scribo::line_info<L>& l)
- {
- return l.char_width() + l.char_space();
- }
-
template <typename L>
inline
@@ -54,58 +105,6 @@ namespace scribo
}
- /*!
-
- */
- template <typename L>
- struct group_data_t
- {
- group_data_t()
- : info(0)
- {
- }
-
- group_data_t(const scribo::line_info<L>& info_)
- : info(&info_)
- {
- finalize();
- }
-
- const scribo::line_info<L>* info;
-
- // deduced:
- int meanline;
- bool looks_like_a_line;
- unsigned delta;
- box2d ebox;
-
- void finalize()
- {
- if (info->x_height() == 0)
- std::cerr << "oops" << std::endl;
-
- meanline = info->baseline() - int(info->x_height()) + 1;
-
- looks_like_a_line = looks_like_a_text_line(*info);
-
- // delta = looks_like_a_line ? char_space + char_width : 0;
- delta = delta_of_line(*info);
- // FIXME: choose between:
- // char_width + char_space
- // 2 * char_width
- // char_width + 2 * char_space
-
- int A = info->a_height() - info->x_height(), D = - info->d_height();
- if (A <= 2 && D > 2)
- A = D;
- if (D <= 2 && A > 2)
- D = A;
- ebox = mln::make::box2d(meanline - A, info->bbox().pmin().col() - delta,
- info->baseline() + D, info->bbox().pmax().col() + delta);
- }
-
- };
-
template <typename T, typename T2>
void draw_box(image2d<T>& input, const box2d& b, T2 l)
{
@@ -126,6 +125,7 @@ namespace scribo
+
template <typename T, typename T2>
void draw_box(image2d<T>& input,
int pmin_row, int pmin_col,
@@ -160,6 +160,7 @@ namespace scribo
+
unsigned my_find_root(util::array<unsigned>& parent, unsigned x)
{
if (parent[x] == x)
@@ -167,6 +168,7 @@ namespace scribo
return parent[x] = my_find_root(parent, parent[x]);
}
+
void swap_ordering(unsigned l1, unsigned l2)
{
if (l2 > l1)
@@ -177,19 +179,9 @@ namespace scribo
}
- box2d union_of(const box2d& b1, const box2d& b2)
- {
- box2d b(point2d(std::min(b1.pmin().row(), b2.pmin().row()),
- std::min(b1.pmin().col(), b2.pmin().col())),
- point2d(std::max(b1.pmax().row(), b2.pmax().row()),
- std::max(b1.pmax().col(), b2.pmax().col())));
- return b;
- }
-
template <typename L>
- unsigned do_union(util::array<group_data_t<L> >& dta,
- scribo::line_set<L>& lines,
+ unsigned do_union(scribo::line_set<L>& lines,
unsigned l1,
unsigned l2,
util::array<unsigned>& parent)
@@ -197,7 +189,10 @@ namespace scribo
l1 = my_find_root(parent, l1);
l2 = my_find_root(parent, l2);
if (l1 == l2)
- return l1;
+ {
+ std::cerr << "what! in'do_union': already merged!!!" << std::endl;
+ return l1;
+ }
swap_ordering(l1, l2);
parent[l2] = l1; // The smallest label value is root.
@@ -213,12 +208,11 @@ namespace scribo
// not used directly in merge process so its tag cannot be
// updated automatically.
lines(l2).update_tag(line::Merged);
+ lines(l2).set_hidden(true);
}
else
lines(l1).fast_merge(lines(l2));
- dta[l1].finalize();
-
// l1's tag is automatically set to line::Needs_Precise_Stats_Update
// l2's tag is automatically set to line::Merged
@@ -226,6 +220,8 @@ namespace scribo
}
+
+
box2d enlarge(const box2d& b, int delta)
{
box2d b_(point2d(b.pmin().row(), b.pmin().col() - delta),
@@ -235,13 +231,34 @@ namespace scribo
template <typename L>
- void draw_enlarged_box(image2d<unsigned>& output,
- const util::array<group_data_t<L> >& dta,
- unsigned l)
+ bool between_separators(const scribo::line_info<L>& l1,
+ const scribo::line_info<L>& l2)
{
- box2d b = dta[l].ebox;
- b.crop_wrt(output.domain());
- draw_box(output, b, l);
+ unsigned
+ col1 = l1.bbox().pcenter().col(),
+ col2 = l2.bbox().pcenter().col();
+ const mln_ch_value(L, bool)&
+ separators = l1.holder().components().separators();
+
+ typedef const bool* sep_ptr_t;
+ sep_ptr_t sep_ptr, end;
+
+ if (col1 < col2)
+ {
+ sep_ptr = &separators(l1.bbox().pcenter());
+ end = sep_ptr + col2 - col1;
+ }
+ else
+ {
+ sep_ptr = &separators(l2.bbox().pcenter());
+ end = sep_ptr + col1 - col2;
+ }
+
+ // If sep_ptr is true, then a separator is reached.
+ while (!*sep_ptr && sep_ptr != end)
+ ++sep_ptr;
+
+ return *sep_ptr;
}
@@ -279,12 +296,25 @@ namespace scribo
col1 = l1.bbox().pcenter().col(),
col2 = l2.bbox().pcenter().col();
if (col1 < col2)
- return col1 + l1.bbox().width() / 4 < col2 - l2.bbox().width() / 4;
+ {
+ if ((col1 + l1.bbox().width() / 4) >= (col2 - l2.bbox().width() / 4))
+ return false;
+ }
else
- return col2 + l2.bbox().width() / 4 < col1 - l1.bbox().width() / 4;
+ if ((col2 + l2.bbox().width() / 4) >= (col1 - l1.bbox().width() / 4))
+ return false;
+
+
+ // Check that there is no separator in between.
+ if (l1.holder().components().has_separators())
+ return ! between_separators(l1, l2);
+
+ return true;
}
+
+
template <typename L>
int horizontal_distance(const scribo::line_info<L>& l1,
const scribo::line_info<L>& l2)
@@ -296,7 +326,9 @@ namespace scribo
}
- /*! \brief Check whether a non line component and a line can merge.
+
+
+ /*! \brief Check whether a non text line and a text line can merge.
Criterions:
- Small height (c.height < l.x_height)
@@ -312,24 +344,24 @@ namespace scribo
*/
template <typename L>
- bool non_line_and_line_can_merge(const scribo::line_info<L>& l_cur,
- const group_data_t<L>& dta_cur, // current
- const scribo::line_info<L>& l_ted,
- const group_data_t<L>& dta_ted) // touched
+ bool non_text_and_text_can_merge(const scribo::line_info<L>& l_cur, // current
+ const scribo::line_info<L>& l_ted) // touched
{
- if (dta_cur.looks_like_a_line || ! dta_ted.looks_like_a_line)
+ if (l_cur.type() == line::Text || l_ted.type() != line::Text)
return false;
// the current object is a NON-textline
// the background (touched) object is a textline
- // FIXME: THERE IS A BUG
- // The second condition should be replaced by the commented one.
- //
+ // Check that there is no separator in between.
+ if (l_cur.holder().components().has_separators()
+ && between_separators(l_cur, l_ted))
+ return false;
+
+
// General case (for tiny components like --> ',:."; <--):
if (l_cur.bbox().height() < l_ted.x_height()
- && float(l_cur.char_width()) / float(l_cur.card()) < l_ted.char_width())
-// && float(l_cur.bbox().width()) / float(l_cur.card()) < l_ted.char_width())
+ && float(l_cur.bbox().width()) / float(l_cur.card()) < l_ted.char_width())
return true;
@@ -339,9 +371,9 @@ namespace scribo
// // not so long width:
&& l_cur.bbox().width() < 5 * l_ted.char_width()
// align with the 'x' center:
- && std::abs((l_ted.baseline() + dta_ted.meanline) / 2 - l_cur.bbox().pcenter().row()) < 7
+ && std::abs((l_ted.baseline() + l_ted.meanline()) / 2 - l_cur.bbox().pcenter().row()) < 7
// tiny spacing:
- && horizontal_distance(l_cur, l_ted) < 5
+ && unsigned(horizontal_distance(l_cur, l_ted)) < l_ted.char_width()
)
{
return true;
@@ -350,30 +382,52 @@ namespace scribo
// Special case
-// // FIXME: Box are aligned; the main problem is that we can have multiple valid box
-// // depending on the presence of descent and/or ascent!
-// if (std::abs(dta_cur.box.pmin().row() - dta_ted.box.pmin().row()) < 5 // top
-// && std::abs(dta_cur.box.pmax().row() - dta_ted.box.pmax().row()) < 5 // bot
-// && ((dta_ted.box.pcenter().col() < dta_cur.box.pcenter().col() && dta_cur.box.pmin().col() - dta_ted.box.pmax().col() < 10) // small distance when cur is at right
-// || (dta_cur.box.pcenter().col() < dta_ted.box.pcenter().col() && dta_ted.box.pmin().col() - dta_cur.box.pmax().col() < 10)) // or when is at left.
-// )
-// return true;
-
+ // Looking for alignement.
+ def::coord
+ top_row = l_cur.bbox().pmin().row(),
+ bot_row = l_cur.bbox().pmax().row();
+
+
+// std::cout << "top_row = " << top_row << " - bot_row = " << bot_row << std::endl;
+// std::cout << std::abs(bot_row - l_ted.baseline())
+// << " - d "
+// << std::abs(bot_row - l_ted.descent())
+// << " - dd "
+// << std::abs(bot_row - l_ted.ebbox().pmax().row())
+// << " - "
+// << std::abs(top_row - l_ted.meanline())
+// << " - a "
+// << std::abs(top_row - l_ted.ascent())
+// << " - aa "
+// << std::abs(top_row - l_ted.ebbox().pmin().row())
+// << " - "
+// << l_ted.ascent()
+// << " - "
+// << l_ted.descent()
+// << std::endl;
+
+ if ((std::abs(bot_row - l_ted.baseline()) < 5
+ || std::abs(bot_row - l_ted.ebbox().pmax().row()) < 5)
+ &&
+ (std::abs(top_row - l_ted.meanline()) < 5
+ || std::abs(top_row - l_ted.ebbox().pmin().row()) < 5))
+ {
+ return true;
+ }
return false;
-
- // The unused criterion below is too restrictive; it does not work
- // for ending '-', and neither for ',' when there's no descent.
- // dta_ted.box.has(dta_cur.box.pcenter())
}
+
+
+
/*! \brief Merge text lines.
This algorithm iterates over all the components ordered by size.
It uses a 2d labeled image, tmp_box, to draw component bounding
boxes and uses that image to check bounding box collisions.
- Depending on that collisions and whether the component looks like
+ Depending on that collisions and whether the lines looks like
a text line or not, bounding boxes are merged.
\verbatim
@@ -396,22 +450,22 @@ namespace scribo
If label.card == 1
l = label.get(0);
If l != background
- If looks_like_a_line(cur)
- If looks_like_a_line(l)
+ If looks_like_a_text_line(cur)
+ If looks_like_a_text_line(l)
// Error case: a line is included in a line.
else
// Line cur is included in a frame or a drawing.
draw_enlarged_box(l)
end
else
- If looks_like_a_line(l)
+ If looks_like_a_text_line(l)
// Component cur is a punctuation overlapping with line l.
l_ <- do_union(cur, l)
draw_enlarged_box(l_)
end
end
else
- If looks_like_a_line(cur)
+ If looks_like_a_text_line(cur)
// Component cur is a new line.
draw_enlarged_box(l)
end
@@ -428,8 +482,8 @@ namespace scribo
continue
end
- If !looks_like_a_line(cur) and looks_like_a_line(l)
- If non_line_and_line_can_merge(cur, l)
+ If !looks_like_a_text_line(cur) and looks_like_a_text_line(l)
+ If non_text_and_text_can_merge(cur, l)
// A punctuation merge with a line
l_ <- do_union(cur, l)
draw_enlarged_box(l_)
@@ -449,27 +503,26 @@ namespace scribo
// Important note: after merging two lines, we draw the
// merged line over the existing one; we have to ensure that we
// cover the previous rectangle (otherwise we have a label in
- // 'output' that is not used anymore! and it can mix up the
+ // 'billboard' that is not used anymore! and it can mix up the
// detection of upcoming merges...) so this delta has to remain
// the same during one pass. Another solution (yet more costly)
// could be of erasing the previous rectangle before re-drawing...
//
template <typename L>
- image2d<unsigned>
+ void
one_merge_pass(unsigned ith_pass,
const box2d& domain,
std::vector<scribo::line_id_t>& v,
scribo::line_set<L>& lines,
- util::array<group_data_t<L> >& dta,
util::array<unsigned>& parent)
{
- image2d<unsigned> output(domain);
- data::fill(output, 0);
+ image2d<unsigned> billboard(domain);
+ data::fill(billboard, 0);
image2d<value::int_u8> log(domain);
data::fill(log, 0);
- const unsigned n = dta.nelements() - 1;
+ const unsigned n = v.size();
unsigned l_;
unsigned
@@ -493,11 +546,7 @@ namespace scribo
unsigned tl, tr, ml, mc, mr, bl, br;
{
- box2d b_;
-
- b_ = enlarge(lines(l).bbox(), dta[l].delta);
- b_.crop_wrt(output.domain());
-
+ box2d b_ = lines(l).ebbox();
/*
tl tr
@@ -513,13 +562,13 @@ namespace scribo
*/
- tl = output(b_.pmin());
- tr = output.at_(b_.pmin().row(), b_.pmax().col());
- ml = output.at_(b_.pcenter().row(), b_.pmin().col());
- mc = output.at_(b_.pcenter().row(), b_.pcenter().col());
- mr = output.at_(b_.pcenter().row(), b_.pmax().col());
- bl = output.at_(b_.pmax().row(), b_.pmin().col());
- br = output(b_.pmax());
+ tl = billboard(b_.pmin());
+ tr = billboard.at_(b_.pmin().row(), b_.pmax().col());
+ ml = billboard.at_(b_.pcenter().row(), b_.pmin().col());
+ mc = billboard.at_(b_.pcenter().row(), b_.pcenter().col());
+ mr = billboard.at_(b_.pcenter().row(), b_.pmax().col());
+ bl = billboard.at_(b_.pmax().row(), b_.pmin().col());
+ br = billboard(b_.pmax());
}
typedef std::set<unsigned> set_t;
@@ -534,56 +583,103 @@ namespace scribo
labels.insert(br);
- if (labels.size() == 1) // Same behavior for all ancors.
+ for (set_t::const_iterator it = labels.begin();
+ it != labels.end();
+ ++it)
+ {
+ if (*it == 0)
+ continue;
+
+ if (lines(*it).type() != line::Text)
+ std::cerr << "outch: we have hit, so drawn, a non-text..." << std::endl;
+ }
+
+
+ if (labels.size() == 1) // Same behavior for all anchors.
{
if (mc != 0)
{
// Main case: it is an "included" box (falling in an already drawn box)
- if (dta[l].looks_like_a_line)
+ if (lines(l).type() == line::Text) // the current object IS a text line
{
- if (dta[mc].looks_like_a_line)
+ if (lines(mc).type() == line::Text) // included in a text line => weird
{
++count_txtline_IN_txtline;
std::cout << "weird: inclusion of a txt_line in a txt_line!" << std::endl;
+
+ /// Merge is perform if the current line is a
+ /// petouille considered as a line.
+// if ((std::abs(lines(l).ascent() - lines(mc).ascent()) >= 5)
+// || (std::abs(lines(l).descent() - lines(mc).descent()) >= 5))
+// continue;
+
+// // FIXME: Is it valid?
+// // A text line is included in another text line.
+// // They are merged.
+// //
+// l_ = do_union(lines, mc, l, parent);
+// draw_box(billboard, lines(l_).ebbox(), l_);
+
+ // Log:
+ draw_box(log, b, 126);
+
}
- else
+
+ else // FIXME: Remove! since included in a non-text-line, so not drawn, so inclusion impossible!!!!!!!!!!
{
+ std::cout << "error: should NOT happen (a text line included in a NON-text-line (so not drawn!!!)" << std::endl;
++count_txtline_IN_junk;
- // a non-line (probably a drawing or a frame) includes a line
- draw_enlarged_box(output, dta, l);
+ // a non-text-line (probably a drawing or a frame) includes a text line
+ draw_box(billboard, lines(l).ebbox(), l);
// Log:
draw_box(log, b, 100);
}
+
}
- else // the current object is NOT a line
+ else // the current object is NOT a text line
{
- if (dta[mc].looks_like_a_line)
+ if (lines(mc).type() == line::Text) // included in a text line
{
++count_comp_IN_txtline;
- // FIXME: critere petouille a ajouter ici
- // Merge non-line #l into line #mc.
- l_ = do_union(dta, lines, mc, l, parent);
- // We have to re-draw the original largest line since
+ // The current object is supposed to be punctuation
+ // since it is fully included in the bbox of a line
+ // of text, so we always want to merge this object
+ // with the line.
+ //
+ // However, in case of a bad quality document, we
+ // may not always want to merge since this object
+ // could be noise or garbage... So adding new
+ // criterions could fix this issue.
+ //
+ //if (!non_text_and_text_can_merge(lines(l), lines(mc)))
+ // continue;
+
+ // Mark current line as punctuation.
+ lines(l).update_type(line::Punctuation);
+
+ // Merge non-text-line #l into text line #mc.
+ l_ = do_union(lines, mc, l, parent);
+ // We have to re-draw the original largest text line since
// it may change of label (take the one of the included line).
- draw_enlarged_box(output, dta, l_);
+ draw_box(billboard, lines(l_).ebbox(), l_);
// Log:
draw_box(log, b, 128);
}
}
}
- else
+ else // mc == 0
{
// Main case: it is a "new" box, that might be drawn in the background.
// we only draw this box if it is a text-line!!!
- if (dta[l].looks_like_a_line)
+ if (lines(l).type() == line::Text)
{
++count_new_txtline;
- draw_enlarged_box(output, dta, l);
+ draw_box(billboard, lines(l).ebbox(), l);
// Log:
draw_box(log, b, 127);
}
@@ -593,6 +689,8 @@ namespace scribo
}
else
{
+ l_ = l; // current label.
+
// Particular cases.
for (set_t::const_iterator it = labels.begin();
it != labels.end();
@@ -603,26 +701,44 @@ namespace scribo
if (lcand == 0) // Skip background.
continue;
- if (lines_can_merge(lines(l), lines(lcand)))
+ if (lines(lcand).type() != line::Text)
+ std::cerr << "again!" << std::endl;
+
+
+ if (lines(l_).type() == line::Text)
{
- ++count_two_lines_merge;
- l_ = do_union(dta, lines, l, lcand, parent);
- draw_enlarged_box(output, dta, l_);
- // Log:
- draw_box(log, b, 151);
- continue;
- }
+ // l_ and lcand look like text line chunks.
+ if (lines_can_merge(lines(l_), lines(lcand)))
+ {
+ ++count_two_lines_merge;
+ l_ = do_union(lines, l_, lcand, parent);
+ draw_box(billboard, lines(l_).ebbox(), l_);
+ // Log:
+ draw_box(log, b, 151);
+ continue;
+ }
+ else
+ {
+ ++count_WTF;
+ // Log:
+ draw_box(log, b, 255);
- if (! dta[l].looks_like_a_line && dta[lcand].looks_like_a_line)
+ // (*) SEE BELOW
+ draw_box(billboard, lines(l_).ebbox(), l_);
+ }
+ }
+ else
{
+ // l_ does NOT looks like a text line chunk.
++count_comp_HITS_txtline;
- if (non_line_and_line_can_merge(lines(l), dta[l], lines(lcand), dta[lcand]))
+ if (non_text_and_text_can_merge(lines(l_), lines(lcand)))
// a petouille merges with a text line?
{
++count_comp_HITS_txtline;
- l_ = do_union(dta, lines, l, lcand, parent);
- draw_enlarged_box(output, dta, l_);
+ l_ = do_union(lines, l_, lcand, parent);
+ draw_box(billboard, lines(l_).ebbox(), l_);
+
// Log:
draw_box(log, b, 169);
continue;
@@ -633,12 +749,39 @@ namespace scribo
draw_box(log, b, 254);
}
}
- else
- {
- ++count_WTF;
- // Log:
- draw_box(log, b, 255);
- }
+
+
+ /* (*) Text lines verticaly overlap.
+
+ --------------------------
+ | l |
+ | |
+ --------------------------
+ | lcand |
+ | |
+ --------------------------
+
+ or
+
+ --------------------------
+ | l |
+ | |
+ |---------------------------
+ |------------------------- |
+ | lcand |
+ ----------------------------
+
+ or
+
+ --------------------------
+ | lcand |
+ | |
+ |---------------------------
+ |------------------------- |
+ | l |
+ ----------------------------
+
+ */
}
}
@@ -657,28 +800,26 @@ namespace scribo
(void) ith_pass;
-// if (ith_pass == 1)
-// {
-// mln::io::pgm::save(log, "log_1.pgm");
-// mln::io::pgm::save(data::wrap(int_u8(), output), "log_1e.pgm");
-// }
-// else if (ith_pass == 2)
-// {
-// mln::io::pgm::save(log, "log_2.pgm");
-// mln::io::pgm::save(data::wrap(int_u8(), output), "log_2e.pgm");
-// }
-// else if (ith_pass == 3)
-// {
-// mln::io::pgm::save(log, "log_3.pgm");
-// mln::io::pgm::save(data::wrap(int_u8(), output), "log_3e.pgm");
-// }
-
- return output;
-
+ if (ith_pass == 1)
+ {
+ mln::io::pgm::save(log, "log_1.pgm");
+ mln::io::pgm::save(data::wrap(int_u8(), billboard), "log_1e.pgm");
+ }
+ else if (ith_pass == 2)
+ {
+ mln::io::pgm::save(log, "log_2.pgm");
+ mln::io::pgm::save(data::wrap(int_u8(), billboard), "log_2e.pgm");
+ }
+ else if (ith_pass == 3)
+ {
+ mln::io::pgm::save(log, "log_3.pgm");
+ mln::io::pgm::save(data::wrap(int_u8(), billboard), "log_3e.pgm");
+ }
}
+
template <typename L>
struct order_lines_id
{
@@ -698,7 +839,6 @@ namespace scribo
};
-
template <typename L>
scribo::line_set<L>
draw_boxes(const box2d& input_domain,
@@ -725,37 +865,37 @@ namespace scribo
// Sort lines by bbox.nelements() and ids.
std::sort(v.begin(), v.end(), func);
- image2d<unsigned> canvas;
util::timer t;
- // Caching line temporary data.
- util::array<group_data_t<L> >
- dta;
- dta.reserve(unsigned(lines.nelements()) + 1);
- dta.append(group_data_t<L>());
+ // Setting lines as text lines according to specific criterions.
for_all_lines(l, lines)
- dta.append(group_data_t<L>(lines(l)));
+ if (looks_like_a_text_line(lines(l)))
+ lines(l).update_type(line::Text);
+
// First pass
t.start();
- one_merge_pass(1, input_domain, v, lines, dta, parent);
+ one_merge_pass(1, input_domain, v, lines, parent);
float ts = t.stop();
std::cout << "time " << ts << std::endl;
+
+// lines.force_stats_update();
+
+ // Sort lines by bbox.nelements() and ids again!
+ // line may have grown differently since the first pass.
+ std::sort(v.begin(), v.end(), func);
+
+
// Second pass
t.start();
- canvas = one_merge_pass(2, input_domain, v, lines, dta, parent); // <- last pass
+ one_merge_pass(2, input_domain, v, lines, parent); // <- last pass
ts = t.stop();
std::cout << "time " << ts << std::endl;
-// using value::int_u8;
- //io::pgm::save(data::wrap(int_u8(), canvas), "merge_result.pgm");
-
-// mln::io::ppm::save(labeling::colorize(value::rgb8(), canvas),
-// "merge_result.ppm");
-
+ lines.force_stats_update();
return lines;
}
@@ -768,22 +908,26 @@ namespace scribo
template <typename L>
line_set<L>
- merging(const box2d& input_domain,
- const scribo::line_set<L>& lines)
+ merging(const scribo::line_set<L>& lines)
{
using namespace mln;
util::timer t;
t.start();
- scribo::line_set<L> output = internal::draw_boxes(input_domain, lines);
+ scribo::line_set<L> output
+ = internal::draw_boxes(lines.components().labeled_image().domain(),
+ lines);
float ts = t.stop();
std::cout << ts << std::endl;
return output;
}
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::text
} // end of namespace scribo
+
+#endif // ! SCRIBO_TEXT_MERGING_HH
--
1.5.6.5
* debug/bboxes_enlarged_image.hh,
* debug/looks_like_a_text_line_image.hh,
* debug/mean_and_base_lines_image.hh: New routines.
* debug/alignment_decision_image.hh,
* debug/decision_image.hh,
* debug/save_bboxes_image.hh: Update code according to last
changes in core classes.
* debug/usage.hh: Make the description optional.
---
scribo/ChangeLog | 15 +++
scribo/debug/alignment_decision_image.hh | 37 +++----
scribo/debug/bboxes_enlarged_image.hh | 136 ++++++++++++++++++++++++
scribo/debug/decision_image.hh | 12 +-
scribo/debug/looks_like_a_text_line_image.hh | 130 +++++++++++++++++++++++
scribo/debug/mean_and_base_lines_image.hh | 147 ++++++++++++++++++++++++++
scribo/debug/save_bboxes_image.hh | 60 ++++++++++-
scribo/debug/usage.hh | 9 +-
8 files changed, 513 insertions(+), 33 deletions(-)
create mode 100644 scribo/debug/bboxes_enlarged_image.hh
create mode 100644 scribo/debug/looks_like_a_text_line_image.hh
create mode 100644 scribo/debug/mean_and_base_lines_image.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index a24406b..54d5f0d 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,20 @@
2010-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Improve debug routines in Scribo.
+
+ * debug/bboxes_enlarged_image.hh,
+ * debug/looks_like_a_text_line_image.hh,
+ * debug/mean_and_base_lines_image.hh: New routines.
+
+ * debug/alignment_decision_image.hh,
+ * debug/decision_image.hh,
+ * debug/save_bboxes_image.hh: Update code according to last
+ changes in core classes.
+
+ * debug/usage.hh: Make the description optional.
+
+2010-03-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Improve core classes in Scribo.
* core/component_info.hh,
diff --git a/scribo/debug/alignment_decision_image.hh b/scribo/debug/alignment_decision_image.hh
index e3b6163..841bd38 100644
--- a/scribo/debug/alignment_decision_image.hh
+++ b/scribo/debug/alignment_decision_image.hh
@@ -36,7 +36,9 @@
# 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>
@@ -79,28 +81,28 @@ namespace scribo
template <typename L>
mln::util::couple<mln_site(L),mln_site(L)>
- find_anchors(const object_image(L)& objects,
+ find_anchors(const component_set<L>& components,
unsigned i,
unsigned link_i,
const Alignment& alignment)
{
mln_site(L)
- a1 = objects.bbox(i).center(),
- a2 = objects.bbox(link_i).center();
+ a1 = components(i).bbox().pcenter(),
+ a2 = components(link_i).bbox().pcenter();
switch (alignment)
{
case top:
- a1.row() = objects.bbox(i).pmin().row();
- a2.row() = objects.bbox(link_i).pmin().row();
+ a1.row() = components(i).bbox().pmin().row();
+ a2.row() = components(link_i).bbox().pmin().row();
break;
case center:
break;
case bottom:
- a1.row() = objects.bbox(i).pmax().row();
- a2.row() = objects.bbox(link_i).pmax().row();
+ a1.row() = components(i).bbox().pmax().row();
+ a2.row() = components(link_i).bbox().pmax().row();
break;
}
@@ -120,35 +122,32 @@ namespace scribo
trace::entering("scribo::debug::alignment_decision_image");
const I& input = exact(input_);
- const object_image(L)& objects = links.object_image_();
+ const component_set<L>& components = links.components();
mln_precondition(input.is_valid());
mln_precondition(links.is_valid());
mln_precondition(filtered_links.is_valid());
- mln_precondition(links.size() == filtered_links.size());
- mln_precondition(links.object_image_() != filtered_links.object_image_());
- /// Fixme: check that objects has been computed from input.
+ /// Fixme: check that components has been computed from input.
image2d<value::rgb8>
decision_image = data::convert(value::rgb8(), input);
- for_all_components(i, objects.bboxes())
- mln::draw::box(decision_image, objects.bbox(i), literal::blue);
+ for_all_comps(i, components)
+ mln::draw::box(decision_image, components(i).bbox(), literal::blue);
typedef mln_site(L) P;
- for (unsigned i = 1; i < links.size(); ++i)
+ for_all_links(i, links)
{
-
- if (links[i] != i)
+ if (links(i) != i)
{
value::rgb8 value = literal::green;
- if (links[i] != filtered_links[i])
+ if (links(i) != filtered_links(i))
value = literal::red;
mln::util::couple<P,P>
- anchors = internal::find_anchors(objects, i, links[i], alignment);
- if (norm::l1_distance(anchors.first(), anchors.second()) < max_link_length)
+ 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(),
diff --git a/scribo/debug/bboxes_enlarged_image.hh b/scribo/debug/bboxes_enlarged_image.hh
new file mode 100644
index 0000000..edd6d7a
--- /dev/null
+++ b/scribo/debug/bboxes_enlarged_image.hh
@@ -0,0 +1,136 @@
+// Copyright (C) 2010 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_BBOXES_ENLARGED_IMAGE_HH
+# define SCRIBO_DEBUG_BBOXES_ENLARGED_IMAGE_HH
+
+/// \file
+///
+/// \brief Compute an image of enlarged component bounding boxes.
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/data/convert.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/literal/colors.hh>
+# include <mln/draw/box.hh>
+
+# include <scribo/core/line_set.hh>
+
+// Declares internal::looks_like_a_text_line.
+# include <scribo/text/merging.hh>
+
+
+namespace scribo
+{
+
+ namespace debug
+ {
+
+ using namespace mln;
+
+
+ /// \brief Compute an image of enlarged component bounding boxes.
+ ///
+ /// This check whether each line looks like a text line. If it is
+ /// a text line, its extended bounding box is drawn, otherwise, it
+ /// is normal bounding box.
+ ///
+ /// This rountine uses scribo::internal::looks_like_a_text_line to
+ /// check if a component looks like a text line.
+ ///
+ ///
+ /// \param[in] input An image convertible towards a color image.
+ /// \param[in] lines A line set.
+ /// \param[in] text_value The color used to draw bounding boxes
+ /// of components looking like a text line.
+ /// \param[in] non_text_value The color used to draw bounding
+ /// boxes of components NOT looking like
+ /// a text line.
+ ///
+ /// \return A color image.
+ //
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ bboxes_enlarged_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& text_value,
+ const value::rgb8& non_text_value);
+
+ /// \overload
+ /// text_value is set to literal::green.
+ /// non_text_value is set to literal::red.
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ bboxes_enlarged_image(const Image<I>& input,
+ const line_set<L>& lines);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ bboxes_enlarged_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& text_value,
+ const value::rgb8& non_text_value)
+ {
+ trace::entering("scribo::debug::bboxes_enlarged_image");
+ mln_precondition(exact(input).is_valid());
+
+ image2d<value::rgb8> output = data::convert(value::rgb8(), input);
+
+ for_all_lines(l, lines)
+ if (! lines(l).hidden())
+ {
+ if (text::internal::looks_like_a_text_line(lines(l)))
+ mln::draw::box(output, lines(l).ebbox(), text_value);
+ else
+ mln::draw::box(output, lines(l).bbox(), non_text_value);
+ }
+
+ trace::exiting("scribo::debug::bboxes_enlarged_image");
+ return output;
+ }
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ bboxes_enlarged_image(const Image<I>& input,
+ const line_set<L>& lines)
+ {
+ return bboxes_enlarged_image(input, lines,
+ literal::green, literal::red);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::debug
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_DEBUG_BBOXES_ENLARGED_IMAGE_HH
diff --git a/scribo/debug/decision_image.hh b/scribo/debug/decision_image.hh
index 011dbfa..cc3f0f0 100644
--- a/scribo/debug/decision_image.hh
+++ b/scribo/debug/decision_image.hh
@@ -130,7 +130,7 @@ namespace scribo
trace::entering("scribo::debug::decision_image");
const I& input = exact(input_);
- const component_set<L>& components = links.component_set_();
+ const component_set<L>& components = links.components();
mln_precondition(input.is_valid());
mln_precondition(links.is_valid());
@@ -142,20 +142,20 @@ namespace scribo
image2d<value::rgb8>
decision_image = data::convert(value::rgb8(), input);
- for_all_components(i, components)
+ for_all_comps(i, components)
mln::draw::box(decision_image, components(i).bbox(), literal::blue);
- for (unsigned i = 1; i < links.size(); ++i)
+ for (unsigned i = 1; i < links.nelements(); ++i)
{
- if (links[i] != i)
+ if (links(i) != i)
{
value::rgb8 value = literal::green;
- if (links[i] != filtered_links[i])
+ if (links(i) != filtered_links(i))
value = literal::red;
mln::draw::line(decision_image,
components(i).bbox().pcenter(),
- components(links[i]).bbox().pcenter(),
+ components(links(i)).bbox().pcenter(),
value);
}
}
diff --git a/scribo/debug/looks_like_a_text_line_image.hh b/scribo/debug/looks_like_a_text_line_image.hh
new file mode 100644
index 0000000..a40c7d6
--- /dev/null
+++ b/scribo/debug/looks_like_a_text_line_image.hh
@@ -0,0 +1,130 @@
+// Copyright (C) 2010 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_LOOKS_LIKE_A_TEXT_LINE_IMAGE_HH
+# define SCRIBO_DEBUG_LOOKS_LIKE_A_TEXT_LINE_IMAGE_HH
+
+/// \file
+///
+/// Compute an image where components are drawn differently whether
+/// they look like a line or not.
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/data/convert.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/literal/colors.hh>
+# include <mln/draw/box.hh>
+
+# include <scribo/core/line_set.hh>
+
+// Declares internal::looks_like_a_text_line.
+# include <scribo/text/merging.hh>
+
+
+namespace scribo
+{
+
+ namespace debug
+ {
+
+ using namespace mln;
+
+
+ /// \brief Compute an image where components are drawn differently
+ /// whether they look like a line or not.
+ ///
+ /// \param[in] input An image convertible towards a color image.
+ /// \param[in] lines A line set.
+ /// \param[in] text_value The color used to draw bounding boxes
+ /// of components looking like a text line.
+ /// \param[in] non_text_value The color used to draw bounding
+ /// boxes of components NOT looking like
+ /// a text line.
+ ///
+ /// \return A color image.
+ //
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ looks_like_a_text_line_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& text_value,
+ const value::rgb8& non_text_value);
+
+ /// \overload
+ /// text_value is set to literal::green.
+ /// non_text_value is set to literal::red.
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ looks_like_a_text_line_image(const Image<I>& input,
+ const line_set<L>& lines);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ looks_like_a_text_line_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& text_value,
+ const value::rgb8& non_text_value)
+ {
+ trace::entering("scribo::debug::looks_like_a_text_line_image");
+ mln_precondition(exact(input).is_valid());
+
+ image2d<value::rgb8> output = data::convert(value::rgb8(), input);
+
+ for_all_lines(l, lines)
+ if (! lines(l).hidden())
+ {
+ if (text::internal::looks_like_a_text_line(lines(l)))
+ mln::draw::box(output, lines(l).bbox(), text_value);
+ else
+ mln::draw::box(output, lines(l).bbox(), non_text_value);
+ }
+
+ trace::exiting("scribo::debug::looks_like_a_text_line_image");
+ return output;
+ }
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ looks_like_a_text_line_image(const Image<I>& input,
+ const line_set<L>& lines)
+ {
+ return looks_like_a_text_line_image(input, lines,
+ literal::green, literal::red);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::debug
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_DEBUG_LOOKS_LIKE_A_TEXT_LINE_IMAGE_HH
diff --git a/scribo/debug/mean_and_base_lines_image.hh b/scribo/debug/mean_and_base_lines_image.hh
new file mode 100644
index 0000000..c4517c7
--- /dev/null
+++ b/scribo/debug/mean_and_base_lines_image.hh
@@ -0,0 +1,147 @@
+// Copyright (C) 2010 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_MEAN_AND_BASE_LINES_IMAGE_HH
+# define SCRIBO_DEBUG_MEAN_AND_BASE_LINES_IMAGE_HH
+
+/// \file
+///
+/// \brief Compute a color image showing the mean and the base lines
+/// of the text lines.
+
+# include <mln/core/concept/image.hh>
+# include <mln/data/convert.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/literal/colors.hh>
+
+# include <mln/draw/box.hh>
+# include <mln/draw/dashed_line.hh>
+
+# include <scribo/core/line_set.hh>
+
+
+namespace scribo
+{
+
+ namespace debug
+ {
+
+ using namespace mln;
+
+
+ /// \brief Compute a color image showing the mean and the base lines
+ /// of the text lines.
+ ///
+ /// The mean line is drawn with a dashed line.
+ /// The base line is drawn with a plain line.
+ ///
+ /// \param[in] input An image convertible towards a color image.
+ /// \param[in] lines A line set.
+ /// \param[in] bbox_value Value used to draw lines bounding boxes.
+ /// \param[in] meanline_value Value used to draw mean lines.
+ /// \param[in] baseline_value Value used to draw base lines.
+ ///
+ /// \return A color image.
+ //
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ mean_and_base_lines_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& bbox_value,
+ const value::rgb8& meanline_value,
+ const value::rgb8& baseline_value);
+
+ /// \overload
+ /// text_value is set to literal::green.
+ /// non_text_value is set to literal::red.
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ mean_and_base_lines_image(const Image<I>& input,
+ const line_set<L>& lines);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ mean_and_base_lines_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const value::rgb8& bbox_value,
+ const value::rgb8& meanline_value,
+ const value::rgb8& baseline_value)
+ {
+ trace::entering("scribo::debug::mean_and_base_lines_image");
+ mln_precondition(exact(input).is_valid());
+
+ image2d<value::rgb8> output = data::convert(value::rgb8(), input);
+
+ for_all_lines(l, lines)
+ {
+ if (! lines(l).hidden())
+ {
+ mln::draw::box(output, lines(l).bbox(), bbox_value);
+
+ if (! (lines(l).type() == line::Text
+ || (lines(l).type() == line::Undefined
+ && lines(l).tag() == line::None
+ && lines(l).card() > 2)))
+ continue;
+
+ point2d
+ b_top(lines(l).meanline(), lines(l).bbox().pmin().col()),
+ e_top(lines(l).meanline(), lines(l).bbox().pmax().col()),
+ b_bot(lines(l).baseline(), lines(l).bbox().pmin().col()),
+ e_bot(lines(l).baseline(), lines(l).bbox().pmax().col());
+
+ mln::draw::line(output, b_bot, e_bot, baseline_value);
+ mln::draw::dashed_line(output, b_top, e_top, meanline_value);
+
+ }
+ }
+
+ trace::exiting("scribo::debug::mean_and_base_lines_image");
+ return output;
+ }
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ mean_and_base_lines_image(const Image<I>& input,
+ const line_set<L>& lines)
+ {
+ return mean_and_base_lines_image(input, lines,
+ literal::purple, literal::blue,
+ literal::cyan);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::debug
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_DEBUG_MEAN_AND_BASE_LINES_IMAGE_HH
diff --git a/scribo/debug/save_bboxes_image.hh b/scribo/debug/save_bboxes_image.hh
index 0265ee4..60f2c8d 100644
--- a/scribo/debug/save_bboxes_image.hh
+++ b/scribo/debug/save_bboxes_image.hh
@@ -48,12 +48,30 @@ namespace scribo
using namespace mln;
- /// Draw a list of bounding boxes and their associated mass center.
+ /// Draw a list of bounding boxes
template <typename I>
void
save_bboxes_image(const Image<I>& input,
const mln::util::array< box<mln_site(I)> >& bboxes,
- const value::rgb8& value,
+ const std::string& filename,
+ const value::rgb8& value);
+
+
+ template <typename I, typename L>
+ void
+ save_bboxes_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const std::string& filename,
+ const value::rgb8& value);
+
+ /// \overload
+ /// value is set to literal::red.
+ //
+ template <typename I, typename L>
+ inline
+ void
+ save_bboxes_image(const Image<I>& input,
+ const line_set<L>& lines,
const std::string& filename);
@@ -64,8 +82,8 @@ namespace scribo
void
save_bboxes_image(const Image<I>& input,
const mln::util::array< box<mln_site(I)> >& bboxes,
- const value::rgb8& value,
- const std::string& filename)
+ const std::string& filename,
+ const value::rgb8& value)
{
trace::entering("scribo::debug::save_bboxes_image");
mln_precondition(exact(input).is_valid());
@@ -77,6 +95,40 @@ namespace scribo
trace::exiting("scribo::debug::save_bboxes_image");
}
+
+ template <typename I, typename L>
+ inline
+ void
+ save_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");
+ mln_precondition(exact(input).is_valid());
+
+ image2d<value::rgb8> output = data::convert(value::rgb8(), input);
+
+ for_all_lines(l, lines)
+ if (! lines(l).hidden())
+ mln::draw::box(output, lines(l).bbox(), value);
+
+ io::ppm::save(output, filename);
+ trace::exiting("scribo::debug::save_bboxes_image");
+ }
+
+
+ template <typename I, typename L>
+ inline
+ void
+ save_bboxes_image(const Image<I>& input,
+ const line_set<L>& lines,
+ const std::string& filename)
+ {
+ return save_bboxes_image(input, lines, filename, literal::red);
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::debug
diff --git a/scribo/debug/usage.hh b/scribo/debug/usage.hh
index e3872a9..6b6c9b7 100644
--- a/scribo/debug/usage.hh
+++ b/scribo/debug/usage.hh
@@ -53,21 +53,22 @@ namespace scribo
inline
int
usage(char* argv[], const char *desc, const char* args,
- const char*args_desc[][2], const char *out_desc)
+ const char*args_desc[][2], const char *out_desc = 0)
{
std::cout << "Usage: " << argv[0] << " " << args
<< std::endl
<< std::endl;
std::cout << "-----------" << std::endl;
- std::cout << std::endl
- << desc << std::endl
+ std::cout << desc << std::endl
<< std::endl;
for (unsigned i = 0; args_desc[i][0] != 0; ++i)
std::cout << " " << args_desc[i][0] << ": " << args_desc[i][1]
<< std::endl;
- std::cout << std::endl << "Output: " << out_desc << std::endl;
+ if (out_desc)
+ std::cout << std::endl << "Output: " << out_desc << std::endl;
+
std::cout << "-----------" << std::endl;
std::cout << "EPITA/LRDE - Scribo 2009" << std::endl;
return 1;
--
1.5.6.5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch revamp-doc-build has been created
at 13af895daaeda0e5c287eb221453bcf1ac5db581 (commit)
- Log -----------------------------------------------------------------
13af895 Update the documentation's copyright header.
9716b84 Have Doxygen generate its outputs in the build directory.
52239ab Require Doxygen 1.5.6 at bootstrapping time.
42f2b71 bootstrap: Fix a typo in an error message.
bd915de Reorganize doc/Makefile.am.
121d1e6 Have Doxyfile.in generate the user documentation.
443d804 Generate the HTML and LaTeX Doxygen documentation in a single pass.
074db67 Shorten the list of files visited by Doxygen.
6095c47 apps/graph-morpho/morpho.hh: Help Doxygen compile LaTeX formulas.
8f46c4a Clean up Doxygen-related Make rules in milena/doc/.
9391217 configure.ac: Do not configure milena/doc/examples/Makefile.
7bc6643 Stop make from recurring in doc/examples.
cde21c2 Tell Git to ignore files generated in milena/doc/white_paper/figures/.
32e9532 configure.ac: Do not configure milena/doc/white_paper/Makefile.
3fbbba2 Stop make from recurring in doc/white_paper.
203f31e Tell Git to ignore files generated in milena/doc/technical/.
8c6dd29 configure.ac: Do not configure milena/doc/technical/Makefile.
7ef9ac2 Stop make from recurring in doc/technical.
1b2886b configure.ac: Do not configure milena/doc/tutorial/Makefile.
37fc180 Stop make from recurring in doc/tutorial.
d52b4eb configure.ac: Do not configure milena/doc/ref_guide/Makefile.
e4a2af5 Stop make from recurring in doc/ref_guide.
c663f70 Stop pruning Makefiles under milena/doc/.
0964a88 Get rid of Make targets `fake-doc' and `void-doc'.
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
* doc/Makefile.am (DOXYFILE)
(DOXYFILE_USER_PDF, DOXYFILE_USER_HTML)
(DOXYFILE_DEVEL_PDF, DOXYFILE_DEVEL_HTML):
New variables.
(USER_REFMAN_LATEX)
(DEVEL_REFMAN_PDF, DEVEL_REFMAN_LATEX, DEVEL_REFMAN_HTML):
New variables.
(all-local): Depend on $(srcdir)/$(USER_REFMAN_PDF),
$(srcdir)/user-refman-html.stamp.
($(srcdir)/$(USER_REFMAN_PDF)): Split these targets and move the
generation of the LaTeX sources...
($(srcdir)/user-refman-latex.stamp)
($(srcdir)/$(USER_REFMAN_LATEX))
($(srcdir)/devel-refman-latex.stamp)
($(srcdir)/$(DEVEL_REFMAN_LATEX)):
...here (new targets).
($(srcdir)/$(USER_REFMAN_HTML))
($(srcdir)/$(DEVEL_REFMAN_HTML)):
Delegate the actions to...
($(srcdir)/user-refman-html.stamp)
($(srcdir)/devel-refman-html.stamp):
...these (new) targets.
(clean-user-refman-latex, clean-user-refman-html)
(clean-devel-refman-latex, clean-devel-refman-html):
New (phony) targets.
(maintainer-clean-local): Depend on clean-user-refman-latex,
clean-user-refman-html, clean-devel-refman-latex and
clean-devel-refman-html.
(EXTRA_DIST): Disable Doxyfile_devel_html, Doxyfile_devel_pdf,
Doxyfile_user_html and Doxyfile_user_pdf.
Add $(DOXYFILE).in.
($(srcdir)/Doxyfile_user, $(srcdir)/Doxyfile_user_pdf)
($(srcdir)/Doxyfile_devel, $(srcdir)/Doxyfile_devel_pdf):
Rename targets as...
($(DOXYFILE_USER_HTML), $(DOXYFILE_USER_PDF))
($(DOXYFILE_DEVEL_HTML), $(DOXYFILE_DEVEL_PDF)):
...these.
---
milena/ChangeLog | 42 ++++++++
milena/doc/Makefile.am | 269 ++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 267 insertions(+), 44 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 0657f50..aed1cb8 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,45 @@
+2010-03-04 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Clean up Doxygen-related Make rules in milena/doc/.
+
+ * doc/Makefile.am (DOXYFILE)
+ (DOXYFILE_USER_PDF, DOXYFILE_USER_HTML)
+ (DOXYFILE_DEVEL_PDF, DOXYFILE_DEVEL_HTML):
+ New variables.
+ (USER_REFMAN_LATEX)
+ (DEVEL_REFMAN_PDF, DEVEL_REFMAN_LATEX, DEVEL_REFMAN_HTML):
+ New variables.
+ (all-local): Depend on $(srcdir)/$(USER_REFMAN_PDF),
+ $(srcdir)/user-refman-html.stamp.
+ ($(srcdir)/$(USER_REFMAN_PDF)): Split these targets and move the
+ generation of the LaTeX sources...
+ ($(srcdir)/user-refman-latex.stamp)
+ ($(srcdir)/$(USER_REFMAN_LATEX))
+ ($(srcdir)/devel-refman-latex.stamp)
+ ($(srcdir)/$(DEVEL_REFMAN_LATEX)):
+ ...here (new targets).
+ ($(srcdir)/$(USER_REFMAN_HTML))
+ ($(srcdir)/$(DEVEL_REFMAN_HTML)):
+ Delegate the actions to...
+ ($(srcdir)/user-refman-html.stamp)
+ ($(srcdir)/devel-refman-html.stamp):
+ ...these (new) targets.
+ (clean-user-refman-latex, clean-user-refman-html)
+ (clean-devel-refman-latex, clean-devel-refman-html):
+ New (phony) targets.
+ (maintainer-clean-local): Depend on clean-user-refman-latex,
+ clean-user-refman-html, clean-devel-refman-latex and
+ clean-devel-refman-html.
+ (EXTRA_DIST): Disable Doxyfile_devel_html, Doxyfile_devel_pdf,
+ Doxyfile_user_html and Doxyfile_user_pdf.
+ Add $(DOXYFILE).in.
+ ($(srcdir)/Doxyfile_user, $(srcdir)/Doxyfile_user_pdf)
+ ($(srcdir)/Doxyfile_devel, $(srcdir)/Doxyfile_devel_pdf):
+ Rename targets as...
+ ($(DOXYFILE_USER_HTML), $(DOXYFILE_USER_PDF))
+ ($(DOXYFILE_DEVEL_HTML), $(DOXYFILE_DEVEL_PDF)):
+ ...these.
+
2010-03-03 Roland Levillain <roland(a)lrde.epita.fr>
Stop make from recurring in doc/examples.
diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am
index 52e1851..3d5f4d9 100644
--- a/milena/doc/Makefile.am
+++ b/milena/doc/Makefile.am
@@ -22,11 +22,15 @@ include $(top_srcdir)/milena/doc/doc.mk
DOXYGEN = doxygen
+DOXYFILE = Doxyfile
+
# Initialiaze variables.
EXTRA_DIST =
dist_doc_DATA =
CLEANFILES =
+# FIXME: Simplify all of this. ``Devel'' targets are really
+# secondary. And we probably don't need so much target aliases!
.PHONY: doc \
doc-user doc-devel \
@@ -66,45 +70,199 @@ EXTRA_DEPS = $(srcdir)/tutorial/tutorial.hh $(srcdir)/ref_guide/ref_guide.hh
## directory of the _source_ tree. See how this is implemented in
## Vaucanson's doc build system. (Do not forget to adjust Doxyfiles.)
-# Doxygen PDF documentation outputs.
+# ----------------------------- #
+# User reference manual (PDF). #
+# ----------------------------- #
+
+# FIXME: Keep it or throw it away?
+all-local: $(srcdir)/$(USER_REFMAN_PDF)
+
+DOXYFILE_USER_PDF = Doxyfile_user_pdf
+
+## FIXME: Rename USER_REFMAN_PDF to something else?
USER_REFMAN_PDF = user-refman.pdf
+## FIXME: Likewise?
+USER_REFMAN_LATEX = user-refman-latex
+
ref-doc-pdf: $(srcdir)/$(USER_REFMAN_PDF)
-# FIXME: Split in two rules: one generating the LaTeX file from the
-# Doxyfile, and another one generating the PDF from the LaTeX source.
-# Moreover, the LaTeX to PDF rule could be factored using a suffix
-# rule (as in LRDE's share/).
-$(srcdir)/$(USER_REFMAN_PDF): $(srcdir)/Doxyfile_user_pdf $(srcdir)/figures.stamp $(EXTRA_DEPS)
- $(DOXYGEN) $< \
- && cd $(srcdir)/user/latex \
- && $(MAKE) pdf \
- && cp -f refman.pdf ../../$(USER_REFMAN_PDF)
-
-# FIXME: Careful, `user-refman-pdf' is a directory, and this make rule
-# depends on its timestamp, which is wrong.
+
+# FIXME: Use texi2dvi instead of Doxygen's generated Makefile?
+# (The LaTeX to PDF rule could be factored using a suffix rule, as in
+# LRDE's share/).
+$(srcdir)/$(USER_REFMAN_PDF): $(srcdir)/$(USER_REFMAN_LATEX)
+ cd $(srcdir)/$(USER_REFMAN_LATEX) && $(MAKE) $(AM_MAKEFLAGS) pdf
+ cp -f $(srcdir)/$(USER_REFMAN_LATEX)/refman.pdf $@
+
+## FIXME: Use a variable instead of `$(srcdir)/user/latex'.
+##
+## FIXME: Are dependencies $(srcdir)/figures.stamp $(EXTRA_DEPS) set
+## on the right rule? Does Doxygen make a copy of figures, or does it
+## generate LaTeX inputs relying on the existence of such figures in
+## the initial location? Investigate.
+$(srcdir)/user-refman-latex.stamp: $(srcdir)/$(DOXYFILE).in $(srcdir)/figures.stamp $(EXTRA_DEPS)
+ @rm -f $@.tmp
+ @touch $@.tmp
+ -rm -rf $(srcdir)/user/latex
+ $(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_USER_PDF)
+ $(DOXYGEN) $(DOXYFILE_USER_PDF)
+## Doxygen may generate an incomplete output and exit with success!
+## Check some files before deeming the output as acceptable.
+ test -f $(srcdir)/user/latex/refman.tex
+ -rm -rf $(srcdir)/$(USER_REFMAN_LATEX)
+## FIXME: moving directories between file systems is not portable.
+ mv $(srcdir)/user/latex $(srcdir)/$(USER_REFMAN_LATEX)
+ @mv -f $@.tmp $@
+
+# FIXME: Probably superfluous. Should vanish when HTML and LaTeX
+# genarations are merged.
+$(srcdir)/$(USER_REFMAN_LATEX): $(srcdir)/user-refman-latex.stamp
+## Recover from the removal of $@
+ @if test -d $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
+
+# Clean Doxygen products.
+.PHONY: clean-user-refman-latex
+clean-user-refman-latex:
+ rm -rf $(srcdir)/user/latex $(srcdir)/$(USER_REFMAN_LATEX)
+
+# ------------------------------ #
+# User reference manual (HTML). #
+# ------------------------------ #
+
+# FIXME: Keep it or throw it away?
+all-local: $(srcdir)/user-refman-html.stamp
+
+# FIXME: Rename USER_REFMAN_HTML as DOCDIR_USER_HTML?
USER_REFMAN_HTML = user-refman-html
+
+DOXYFILE_USER_HTML = Doxyfile_user_html
+
ref-doc-html: $(srcdir)/$(USER_REFMAN_HTML)
-$(srcdir)/$(USER_REFMAN_HTML): $(srcdir)/Doxyfile_user $(srcdir)/figures.stamp $(EXTRA_DEPS)
- $(DOXYGEN) $< \
- && rm -fr $(srcdir)/$(USER_REFMAN_HTML) \
- && mv $(srcdir)/user/html $(srcdir)/$(USER_REFMAN_HTML)
-# Doxygen HTML documentation output directories.
-DEVEL_REFMAN_PDF = devel/latex/refman.pdf
+# FIXME: Use `$(USER_REFMAN_HTML).tmp' instead of `$(srcdir)/user/html'.
+$(srcdir)/user-refman-html.stamp: $(srcdir)/$(DOXYFILE).in $(srcdir)/figures.stamp $(EXTRA_DEPS)
+ @rm -f $@.tmp
+ @touch $@.tmp
+ -rm -rf $(srcdir)/user/html
+ $(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_USER_HTML)
+ $(DOXYGEN) $(DOXYFILE_USER_HTML)
+ -rm -rf $(srcdir)/$(USER_REFMAN_HTML)
+## FIXME: moving directories between file systems is not portable.
+ mv $(srcdir)/user/html $(srcdir)/$(USER_REFMAN_HTML)
+ @mv -f $@.tmp $@
+
+$(srcdir)/$(USER_REFMAN_HTML): $(srcdir)/user-refman-html.stamp
+## Recover from the removal of $@
+ @if test -d $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
+
+# Clean Doxygen products.
+.PHONY: clean-user-refman-html
+clean-user-refman-html:
+ rm -rf $(srcdir)/user/html $(srcdir)/$(USER_REFMAN_HTML)
+
+# ---------------------------------- #
+# Developer reference manual (PDF). #
+# ---------------------------------- #
+
+DOXYFILE_DEVEL_PDF = Doxyfile_devel_pdf
+
+## FIXME: Rename DEVEL_REFMAN_PDF to something else?
+DEVEL_REFMAN_PDF = devel-refman-pdf
+## FIXME: Likewise?
+DEVEL_REFMAN_LATEX = devel-refman-latex
+
ref-doc-devel-pdf: $(srcdir)/$(DEVEL_REFMAN_PDF)
-# FIXME: Split in two rules: one generating the LaTeX file from the
-# Doxyfile, and another one generating the PDF from the LaTeX source.
-# Moreover, the LaTeX to PDF rule could be factored using a suffix
-# rule (as in LRDE's share/).
-$(srcdir)/$(DEVEL_REFMAN_PDF): $(srcdir)/Doxyfile_devel_pdf $(srcdir)/figures.stamp $(EXTRA_DEPS)
- $(DOXYGEN) $<
- cd $(srcdir)/devel/latex && $(MAKE) $(AM_MAKEFLAGS)
-
-# FIXME: Careful, `devel/html' is a directory, and this make rule
-# depends on its timestamp, which is wrong.
-DEVEL_REFMAN_HTML = devel/html
+
+## FIXME: Use texi2dvi instead of Doxygen's generated Makefile? (The
+## LaTeX to PDF rule could be factored using a suffix rule, as in
+## LRDE's share/).
+$(srcdir)/$(DEVEL_REFMAN_PDF): $(srcdir)/$(DEVEL_REFMAN_LATEX)
+ cd $(srcdir)/$(DEVEL_REFMAN_LATEX) && $(MAKE) $(AM_MAKEFLAGS) pdf
+ cp -f $(srcdir)/$(DEVEL_REFMAN_LATEX)/refman.pdf $@
+
+## FIXME: Use a variable instead of `$(srcdir)/devel/latex'.
+##
+## FIXME: Are dependencies $(srcdir)/figures.stamp $(EXTRA_DEPS) set
+## on the right rule? Does Doxygen make a copy of figures, or does it
+## generate LaTeX inputs relying on the existence of such figures in
+## the initial location? Investigate.
+$(srcdir)/devel-refman-latex.stamp: $(srcdir)/$(DOXYFILE).in $(srcdir)/figures.stamp $(EXTRA_DEPS)
+ @rm -f $@.tmp
+ @touch $@.tmp
+ -rm -rf $(srcdir)/devel/latex
+ $(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_DEVEL_PDF)
+ $(DOXYGEN) $(DOXYFILE_DEVEL_PDF)
+## Doxygen may generate an incomplete output and exit with success!
+## Check some files before deeming the output as acceptable.
+ test -f $(srcdir)/devel/latex/refman.tex
+ -rm -rf $(srcdir)/$(DEVEL_REFMAN_LATEX)
+## FIXME: moving directories between file systems is not portable.
+ mv $(srcdir)/devel/latex $(srcdir)/$(DEVEL_REFMAN_LATEX)
+ @mv -f $@.tmp $@
+
+# FIXME: Probably superfluous. Should vanish when HTML and LaTeX
+# genarations are merged.
+$(srcdir)/$(DEVEL_REFMAN_LATEX): $(srcdir)/devel-refman-latex.stamp
+## Recover from the removal of $@
+ @if test -d $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
+
+# Clean Doxygen products.
+.PHONY: clean-devel-refman-latex
+clean-devel-refman-latex:
+ rm -rf $(srcdir)/devel/latex $(srcdir)/$(DEVEL_REFMAN_LATEX)
+
+# ----------------------------------- #
+# Developer reference manual (HTML). #
+# ----------------------------------- #
+
+# FIXME: Rename DEVEL_REFMAN_HTML as DOCDIR_DEVEL_HTML?
+DEVEL_REFMAN_HTML = devel-refman-html
+
+DOXYFILE_DEVEL_HTML = Doxyfile_devel_html
+
ref-doc-devel-html: $(srcdir)/$(DEVEL_REFMAN_HTML)
-$(srcdir)/$(DEVEL_REFMAN_HTML): $(srcdir)/Doxyfile_devel $(srcdir)/figures.stamp $(EXTRA_DEPS)
- $(DOXYGEN) $<
+
+# FIXME: Use `$(DEVEL_REFMAN_HTML).tmp' instead of `$(srcdir)/devel/html'.
+$(srcdir)/devel-refman-html.stamp: $(srcdir)/$(DOXYFILE).in $(srcdir)/figures.stamp $(EXTRA_DEPS)
+ @rm -f $@.tmp
+ @touch $@.tmp
+ -rm -rf $(srcdir)/devel/html
+ $(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_DEVEL_HTML)
+ $(DOXYGEN) $(DOXYFILE_DEVEL_HTML)
+ -rm -rf $(srcdir)/$(DEVEL_REFMAN_HTML)
+## FIXME: moving directories between file systems is not portable.
+ mv $(srcdir)/devel/html $(srcdir)/$(DEVEL_REFMAN_HTML)
+ @mv -f $@.tmp $@
+
+$(srcdir)/$(DEVEL_REFMAN_HTML): $(srcdir)/devel-refman-html.stamp
+## Recover from the removal of $@
+ @if test -d $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
+
+# Clean Doxygen products.
+.PHONY: clean-devel-refman-html
+clean-devel-refman-html:
+ rm -rf $(srcdir)/devel/html $(srcdir)/$(DEVEL_REFMAN_HTML)
+
+# ---------- #
+# Cleaning. #
+# ---------- #
+
+maintainer-clean-local: clean-user-refman-latex clean-user-refman-html
+maintainer-clean-local: clean-devel-refman-latex clean-devel-refman-html
+maintainer-clean-local:
+ rm -rf $(srcdir)/user
+ rm -rf $(srcdir)/devel
## ------------------------- ##
## Technical Documentation. ##
@@ -165,12 +323,14 @@ edit = sed -e "s|@ID@|$$Id|" \
-e 's,@srcdir\@,$(srcdir),g' \
-e 's,@builddir\@,$(builddir),g'
+## FIXME: Instead of generating HTML and PDF (LaTeX actualy) output in
+## two passes, do it in a row. It will save us a lot of time.
edit_pdf = sed -e 's,GENERATE_LATEX = NO,GENERATE_LATEX = YES,g' \
-e 's,GENERATE_HTML = YES,GENERATE_HTML = NO,g'
# FIXME: This is not good. We should set these parameters for both
# documentation (devel and user) using @VARIABLES@. Don't generate
-# Doxyfile_user from Doxyfile_devel! Both should be a product
+# Doxyfile_user_html from Doxyfile_devel_html! Both should be a product
# derived from a single source, Doxyfile.in.
edit_user = sed \
-e 's,OUTPUT_DIRECTORY = @srcdir@/devel/,OUTPUT_DIRECTORY = @srcdir@/user/,g' \
@@ -249,13 +409,15 @@ uninstall-local:
chmod -R 700 $(DESTDIR)$(htmldir)/$(USER_REFMAN_HTML)
rm -rf $(DESTDIR)$(htmldir)/$(USER_REFMAN_HTML)
+## FIXME: These are now generated in the build directory.
+# EXTRA_DIST += \
+# Doxyfile_devel_html \
+# Doxyfile_devel_pdf \
+# Doxyfile_user_html \
+# Doxyfile_user_pdf
EXTRA_DIST += \
- Doxyfile.in \
- Doxyfile_devel \
- Doxyfile_devel_pdf \
- Doxyfile_user \
- Doxyfile_user_pdf \
+ $(DOXYFILE).in \
groups/accu.hh \
groups/graph.hh \
groups/images.hh \
@@ -273,6 +435,13 @@ EXTRA_DIST += \
tools/split_sample.sh \
tools/todoxygen.sh
+## FIXME: Unsure about this. If the directory of the generated
+## documentation is to be removed during `maintainer-clean' (see
+## Vaucanson's doc/Makefile.am), then the source Doxyfiles should not
+## be removed earlier (i.e. at `clean') !
+##
+## Note: if configure is used to generate Doxyfiles (see below), these
+## files should be (and will be automatically) remove by `distclean'.
CLEANFILES += \
Doxyfile_user \
Doxyfile_user_pdf \
@@ -283,16 +452,28 @@ CLEANFILES += \
# Sed is used to generate Doxyfile from Doxyfile.in instead of
# configure, because the former is way faster than the latter.
-$(srcdir)/Doxyfile_user: Doxyfile_devel
+#
+## FIXME: This is because, as in TC, we depend on $Id$ from the
+## ChangeLog. Maybe we should depend from something less prone to
+## change.
+##
+## FIXME: Move these rules higher, closer to their use sites.
+##
+## FIXME: There are too many indirect generations here. Simplify.
+
+# FIXME: Directly depend on $(DOXYFILE).in instead.
+$(DOXYFILE_USER_PDF): $(DOXYFILE_USER_HTML)
+ $(edit_pdf) $< >$@
+
+# FIXME: Directly depend on $(DOXYFILE).in instead.
+$(DOXYFILE_USER_HTML): $(DOXYFILE_DEVEL_HTML)
$(edit_user) $< >$@
-$(srcdir)/Doxyfile_user_pdf: Doxyfile_user
+# FIXME: Directly depend on $(DOXYFILE).in instead.
+$(DOXYFILE_DEVEL_PDF): $(DOXYFILE_DEVEL_HTML)
$(edit_pdf) $< >$@
-$(srcdir)/Doxyfile_devel: $(srcdir)/Doxyfile.in
+$(DOXYFILE_DEVEL_HTML): $(srcdir)/$(DOXYFILE).in
Id=`grep '^\$$Id' $(top_srcdir)/milena/ChangeLog \
| sed -e 's/\\\$$//g'`; \
$(edit) $< >$@
-
-$(srcdir)/Doxyfile_devel_pdf: Doxyfile_devel
- $(edit_pdf) $< >$@
--
1.5.6.5