* scribo/toolchain/text_in_doc_preprocess.hh,
* src/content_in_doc.cc: Make unskew an option.
---
scribo/ChangeLog | 7 +++++++
scribo/scribo/toolchain/text_in_doc_preprocess.hh | 13 +++++++------
scribo/src/content_in_doc.cc | 4 +++-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index df9d036..3dbe7db 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Make unskew an option in content_in_doc.
+
+ * scribo/toolchain/text_in_doc_preprocess.hh,
+ * src/content_in_doc.cc: Make unskew an option.
+
2011-12-12 Guillaume Lazzara <z(a)lrde.epita.fr>
* scribo/subsampling/integral_single_image.hh: Fix forward
diff --git a/scribo/scribo/toolchain/text_in_doc_preprocess.hh
b/scribo/scribo/toolchain/text_in_doc_preprocess.hh
index 0a99487..efa03dd 100644
--- a/scribo/scribo/toolchain/text_in_doc_preprocess.hh
+++ b/scribo/scribo/toolchain/text_in_doc_preprocess.hh
@@ -65,7 +65,7 @@ namespace scribo
template <typename I>
mln_ch_value(I,bool)
text_in_doc_preprocess(const Image<I>& input, bool enable_fg_bg,
- unsigned lambda, double K,
+ unsigned lambda, double K, bool enable_deskew,
bool verbose = false);
/*! \overload
@@ -108,7 +108,7 @@ namespace scribo
mln_ch_value(I,bool)
text_in_doc_preprocess(const Image<I>& input, unsigned lambda,
double K, bool enable_fg_bg, Image<I>& fg,
- bool verbose = false);
+ bool enable_deskew, bool verbose = false);
# ifndef MLN_INCLUDE_ONLY
@@ -126,7 +126,7 @@ namespace scribo
template <typename I>
mln_ch_value(I,bool)
text_in_doc_preprocess(const Image<I>& input_, bool enable_fg_bg,
- unsigned lambda, double K,
+ unsigned lambda, double K, bool enable_deskew = false,
bool verbose = false)
{
const I& input = exact(input_);
@@ -138,7 +138,7 @@ namespace scribo
mln_concrete(I) tmp_fg;
mln_ch_value(I,bool)
output = text_in_doc_preprocess(input, lambda, K,
- enable_fg_bg, tmp_fg, verbose);
+ enable_fg_bg, tmp_fg, enable_deskew, verbose);
return output;
}
@@ -149,7 +149,7 @@ namespace scribo
bool verbose = false)
{
I tmp;
- return text_in_doc_preprocess(input, lambda, 0.34, true, tmp, verbose);
+ return text_in_doc_preprocess(input, lambda, 0.34, true, tmp, false, verbose);
}
@@ -157,7 +157,7 @@ namespace scribo
mln_ch_value(I,bool)
text_in_doc_preprocess(const Image<I>& input_, unsigned lambda,
double K, bool enable_fg_bg, Image<I>& fg,
- bool verbose)
+ bool enable_deskew, bool verbose)
{
trace::entering("scribo::toolchain::text_in_doc_preprocess");
@@ -170,6 +170,7 @@ namespace scribo
f.sauvola_K = K;
f.enable_fg_extraction = enable_fg_bg;
f.lambda = lambda;
+ f.enable_deskew = enable_deskew;
f.verbose = verbose;
// Get results.
diff --git a/scribo/src/content_in_doc.cc b/scribo/src/content_in_doc.cc
index bd1109d..4d3c50e 100644
--- a/scribo/src/content_in_doc.cc
+++ b/scribo/src/content_in_doc.cc
@@ -67,6 +67,7 @@ static const scribo::debug::toggle_data toggle_desc[] =
"to improve layout detection. (default: enabled)", true },
{ "find-seps", "Find separators in document (default: enabled)",
true },
{ "ocr", "Performs character recognition (default: enabled)", true
},
+ { "deskew", "Deskew image (default: disabled)", false},
{0, 0, false}
};
@@ -117,10 +118,11 @@ int main(int argc, char* argv[])
image2d<value::rgb8> input;
mln::io::magick::load(input, options.arg("input.*"));
+ bool enable_deskew = options.is_enabled("deskew");
// Preprocess document
image2d<bool>
input_preproc = toolchain::text_in_doc_preprocess(input, false, 0,
- 0.34, verbose);
+ 0.34, enable_deskew, verbose);
// Optional Cropping
point2d crop_shift = literal::origin;
--
1.7.2.5