* scribo/text/recognition.hh: Add comments.
* src/debug/show_links_single_right.cc: Fix an invalid
incrementation.
* src/Makefile.am: Add Magickxx flags for pbm_text_in_doc.
* src/binarization/sauvola_ms.cc,
* src/text_in_doc_preprocess.cc,
* src/text_in_picture_neg.cc,
* src/text_recognition_in_picture.cc: Initialize LibMagick++.
---
scribo/ChangeLog | 16 ++++++++++++++++
scribo/scribo/text/recognition.hh | 9 +++++++--
scribo/src/Makefile.am | 7 ++++---
scribo/src/binarization/sauvola_ms.cc | 2 ++
scribo/src/debug/show_links_single_right.cc | 4 ++--
scribo/src/text_in_doc_preprocess.cc | 2 ++
scribo/src/text_in_picture_neg.cc | 2 ++
scribo/src/text_recognition_in_picture.cc | 2 ++
8 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 941fc35..eeaeac1 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,21 @@
2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Small fixes.
+
+ * scribo/text/recognition.hh: Add comments.
+
+ * src/debug/show_links_single_right.cc: Fix an invalid
+ incrementation.
+
+ * src/Makefile.am: Add Magickxx flags for pbm_text_in_doc.
+
+ * src/binarization/sauvola_ms.cc,
+ * src/text_in_doc_preprocess.cc,
+ * src/text_in_picture_neg.cc,
+ * src/text_recognition_in_picture.cc: Initialize LibMagick++.
+
+2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add new options to command lines tools.
* scribo/src/content_in_doc.cc,
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index ab5e3e2..8b243bd 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -148,6 +148,7 @@ namespace scribo
const component_set<L>& comp_set = lines.components();
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())
{
@@ -157,12 +158,16 @@ namespace scribo
}
/// Improve text quality.
-
- /// text_ima_cleaned domain may be larger than text_ima's.
text::clean_inplace(lines(i), text_ima);
// Make sure characters are isolated from the borders.
// Help Tesseract.
+ //
+ // FIXME: can be improved! We need a morpher for a constant
+ // extension set to false (avoid data::fill), a morpher for
+ // translating the domain to (0,0) (avoid the creation of a
+ // new image), change the default border::thickness to 0 and a
+ // morpher to enlarge the domain to a part of the extension.
mln_domain(I) lbox = text_ima.domain();
lbox.enlarge(lines(i).char_space() + 2);
I line_image(lbox, 0); // Make sure there is no border!
diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am
index 2c318a1..d6275fd 100644
--- a/scribo/src/Makefile.am
+++ b/scribo/src/Makefile.am
@@ -35,6 +35,8 @@ SUBDIRS = \
utilexec_PROGRAMS =
+if HAVE_MAGICKXX
+
if HAVE_TESSERACT
utilexec_PROGRAMS += pbm_text_in_doc
@@ -42,17 +44,16 @@ if HAVE_TESSERACT
pbm_text_in_doc_CPPFLAGS = $(AM_CPPFLAGS) \
$(TESSERACT_CPPFLAGS) \
$(TIFF_CPPFLAGS) \
+ $(MAGICKXX_CPPFLAGS) \
-I$(top_builddir)
pbm_text_in_doc_LDFLAGS = $(AM_LDFLAGS) \
$(TESSERACT_LDFLAGS) \
$(TIFF_LDFLAGS) \
+ $(MAGICKXX_LDFLAGS) \
-lpthread
endif HAVE_TESSERACT
-
-if HAVE_MAGICKXX
-
utilexec_PROGRAMS += text_in_doc_preprocess
text_in_doc_preprocess_SOURCES = text_in_doc_preprocess.cc
text_in_doc_preprocess_CPPFLAGS = $(AM_CPPFLAGS) \
diff --git a/scribo/src/binarization/sauvola_ms.cc
b/scribo/src/binarization/sauvola_ms.cc
index 7c3bcf0..0b001f2 100644
--- a/scribo/src/binarization/sauvola_ms.cc
+++ b/scribo/src/binarization/sauvola_ms.cc
@@ -82,6 +82,8 @@ int main(int argc, char *argv[])
"input.* output.pbm <w> <s> <k>",
args_desc);
+ Magick::InitializeMagick(*argv);
+
trace::entering("main");
// Window size
diff --git a/scribo/src/debug/show_links_single_right.cc
b/scribo/src/debug/show_links_single_right.cc
index 632d082..2392e62 100644
--- a/scribo/src/debug/show_links_single_right.cc
+++ b/scribo/src/debug/show_links_single_right.cc
@@ -98,7 +98,7 @@ namespace scribo
else
{
P tmp = p;
- ++tmp.col();
+ --tmp.col();
mln::draw::line(output_, start_point, tmp, literal::red);
}
@@ -109,7 +109,7 @@ namespace scribo
void compute_next_site_(P& p)
{
- --p.col();
+ ++p.col();
}
diff --git a/scribo/src/text_in_doc_preprocess.cc b/scribo/src/text_in_doc_preprocess.cc
index b731272..8dd918c 100644
--- a/scribo/src/text_in_doc_preprocess.cc
+++ b/scribo/src/text_in_doc_preprocess.cc
@@ -60,6 +60,8 @@ int main(int argc, char* argv[])
"input.* output.pbm <enable fg/bg> <lambda>",
args_desc);
+ Magick::InitializeMagick(*argv);
+
image2d<value::rgb8> input_rgb;
io::magick::load(input_rgb, argv[1]);
diff --git a/scribo/src/text_in_picture_neg.cc b/scribo/src/text_in_picture_neg.cc
index 7d6694a..c1a4317 100644
--- a/scribo/src/text_in_picture_neg.cc
+++ b/scribo/src/text_in_picture_neg.cc
@@ -142,6 +142,8 @@ int main(int argc, char* argv[])
trace::entering("main");
+ Magick::InitializeMagick(*argv);
+
image2d<value::rgb8> input_rgb;
io::magick::load(input_rgb, argv[1]);
diff --git a/scribo/src/text_recognition_in_picture.cc
b/scribo/src/text_recognition_in_picture.cc
index b94ed0b..a5f93a7 100644
--- a/scribo/src/text_recognition_in_picture.cc
+++ b/scribo/src/text_recognition_in_picture.cc
@@ -223,6 +223,8 @@ int main(int argc, char* argv[])
trace::entering("main");
+ Magick::InitializeMagick(*argv);
+
image2d<value::rgb8> input_rgb;
mln::io::magick::load(input_rgb, argv[1]);
--
1.5.6.5