Commit 04aef4bf authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

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.
parent 3b8335a1
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.
......
......@@ -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>.
......
......@@ -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();
......
......@@ -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>
......
......@@ -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::vector<scribo::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
......
......@@ -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;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment