* src/text_in_article_preprocess.cc: Fix use of program arguments.
* core/line_set.hh, * text/clean.hh, * text/merging.hh: Fix compilation.
* text/recognition.hh: Update output format. --- scribo/ChangeLog | 13 +++++++++++++ scribo/core/line_set.hh | 3 +++ scribo/src/text_in_article_preprocess.cc | 2 +- scribo/text/clean.hh | 2 ++ scribo/text/merging.hh | 15 +++++++++------ scribo/text/recognition.hh | 20 ++++++++++++++++++-- 6 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 67159ad..e44137e 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,18 @@ 2010-05-04 Guillaume Lazzara z@lrde.epita.fr
+ Small fixes for Nuxeo/XWiki. + + * src/text_in_article_preprocess.cc: Fix use of program + arguments. + + * core/line_set.hh, + * text/clean.hh, + * text/merging.hh: Fix compilation. + + * text/recognition.hh: Update output format. + +2010-05-04 Guillaume Lazzara z@lrde.epita.fr + * text/merging.hh: Disable some debug.
2010-05-04 Guillaume Lazzara z@lrde.epita.fr diff --git a/scribo/core/line_set.hh b/scribo/core/line_set.hh index 80a79b3..5dca629 100644 --- a/scribo/core/line_set.hh +++ b/scribo/core/line_set.hh @@ -57,8 +57,11 @@ namespace scribo
// Forward declaration. template <typename L> struct line_set; + template <typename L> struct line_info;
+ typedef mln::util::object_id<scribo::LineId, unsigned> line_id_t; + namespace internal { /// Data structure for \c scribo::line_set<I>. diff --git a/scribo/src/text_in_article_preprocess.cc b/scribo/src/text_in_article_preprocess.cc index 8cfa82f..bf70c7f 100644 --- a/scribo/src/text_in_article_preprocess.cc +++ b/scribo/src/text_in_article_preprocess.cc @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) lambda = 1.2 * (input_rgb.nrows() + input_rgb.ncols());
// Extract foreground - if (argc == 4 && atoi(argv[3]) == 1) + if (argc >= 4 && atoi(argv[3]) == 1) { std::cout << "Extracting foreground..." << std::endl; input_rgb = preprocessing::split_bg_fg(input_rgb, lambda, 32).second(); diff --git a/scribo/text/clean.hh b/scribo/text/clean.hh index f93bc6f..341d64c 100644 --- a/scribo/text/clean.hh +++ b/scribo/text/clean.hh @@ -31,6 +31,7 @@ /// /// Improve the quality of a text area.
+# include <mln/core/concept/image.hh> # include <mln/core/concept/weighted_window.hh> # include <mln/core/routine/extend.hh>
@@ -65,6 +66,7 @@ #include <mln/value/rgb8.hh> #include <mln/io/pgm/all.hh>
+#include <scribo/core/line_info.hh> #include <scribo/upsampling/bs2x.hh> #include <scribo/subsampling/bilinear.hh>
diff --git a/scribo/text/merging.hh b/scribo/text/merging.hh index 5309b10..7e943ef 100644 --- a/scribo/text/merging.hh +++ b/scribo/text/merging.hh @@ -59,12 +59,15 @@
+ namespace scribo {
namespace text {
+ using namespace mln; +
/// \brief Merge text component in order to reconstruct text lines. /// @@ -161,7 +164,7 @@ namespace scribo
- unsigned my_find_root(util::array<unsigned>& parent, unsigned x) + unsigned my_find_root(mln::util::array<unsigned>& parent, unsigned x) { if (parent[x] == x) return x; @@ -184,7 +187,7 @@ namespace scribo unsigned do_union(scribo::line_set<L>& lines, unsigned l1, unsigned l2, - util::array<unsigned>& parent) + mln::util::array<unsigned>& parent) { l1 = my_find_root(parent, l1); l2 = my_find_root(parent, l2); @@ -514,7 +517,7 @@ namespace scribo const box2d& domain, std::vectorscribo::line_id_t& v, scribo::line_set<L>& lines, - util::array<unsigned>& parent) + mln::util::array<unsigned>& parent) { image2d<unsigned> billboard(domain); data::fill(billboard, 0); @@ -852,7 +855,7 @@ namespace scribo v.reserve(n);
// Union-find parent data, used to merge lines. - util::array<unsigned> parent(n + 1); + mln::util::array<unsigned> parent(n + 1);
// Initialize data parent(0) = 0; @@ -865,7 +868,7 @@ namespace scribo // Sort lines by bbox.nelements() and ids. std::sort(v.begin(), v.end(), func);
- util::timer t; + mln::util::timer t;
// Setting lines as text lines according to specific criterions. @@ -912,7 +915,7 @@ namespace scribo { using namespace mln;
- util::timer t; + mln::util::timer t; t.start();
scribo::line_set<L> output diff --git a/scribo/text/recognition.hh b/scribo/text/recognition.hh index 6f9dac7..fcc83dd 100644 --- a/scribo/text/recognition.hh +++ b/scribo/text/recognition.hh @@ -185,7 +185,15 @@ namespace scribo { std::string str(s); str = str.substr(0, str.length() - 1); - file << lines(i).bbox() << " " << str; + file << lines(i).bbox().pmin().row() + << " " + << lines(i).bbox().pmin().col() + << " " + << lines(i).bbox().pmax().row() + << " " + << lines(i).bbox().pmax().col() + << " " + << str; } }
@@ -248,7 +256,15 @@ namespace scribo { std::string str(s); str = str.substr(0, str.length() - 1); - file << line.domain() << " " << str; + file << line.domain().bbox().pmin().row() + << " " + << line.domain().bbox().pmin().col() + << " " + << line.domain().bbox().pmax().row() + << " " + << line.domain().bbox().pmax().col() + << " " + << str; } }