last-svn-commit-755-g845cc75 Small fixes

* scribo/binarization/sauvola_ms.hh: Add comments. * scribo/toolchain/internal/content_in_doc_functor.hh: Initialize a local variable. * src/content_in_doc.cc, * src/pbm_text_in_doc.cc: Fix option processing. * tests/unit_test/Makefile.am, * tests/unit_test/cond_tests_magickxx_tesseract_tiff, * tests/unit_test/cond_tests_tesseract_tiff: Change test condition. --- scribo/ChangeLog | 17 +++++++++++++++++ scribo/scribo/binarization/sauvola_ms.hh | 6 ++++-- .../toolchain/internal/content_in_doc_functor.hh | 7 +++++-- scribo/src/content_in_doc.cc | 10 ++++++++-- scribo/src/pbm_text_in_doc.cc | 20 ++++++++++++-------- scribo/tests/unit_test/Makefile.am | 7 ++++--- .../unit_test/cond_tests_magickxx_tesseract_tiff | 1 + scribo/tests/unit_test/cond_tests_tesseract_tiff | 1 - 8 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 scribo/tests/unit_test/cond_tests_magickxx_tesseract_tiff diff --git a/scribo/ChangeLog b/scribo/ChangeLog index eba5cb3..d6a4b3d 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,22 @@ 2011-01-28 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes + + * scribo/binarization/sauvola_ms.hh: Add comments. + + * scribo/toolchain/internal/content_in_doc_functor.hh: Initialize + a local variable. + + * src/content_in_doc.cc, + * src/pbm_text_in_doc.cc: Fix option processing. + + * tests/unit_test/Makefile.am, + * tests/unit_test/cond_tests_magickxx_tesseract_tiff, + * tests/unit_test/cond_tests_tesseract_tiff: Change test + condition. + +2011-01-28 Guillaume Lazzara <z@lrde.epita.fr> + * src/scribo-cli.in: Add content_in_doc entry. 2011-01-27 Guillaume Lazzara <z@lrde.epita.fr> diff --git a/scribo/scribo/binarization/sauvola_ms.hh b/scribo/scribo/binarization/sauvola_ms.hh index 1233d1c..e8eb2c2 100644 --- a/scribo/scribo/binarization/sauvola_ms.hh +++ b/scribo/scribo/binarization/sauvola_ms.hh @@ -280,6 +280,8 @@ namespace scribo typedef const mln_value(K)* ptr_type; + // Warning: if there are pixels with value different from 2, 3 + // or 4 in e2, it will crash because of that array... ptr_type ptr_t[5]; ptr_t[2] = & t_ima[2].at_(0, 0); ptr_t[3] = & t_ima[3].at_(0, 0); @@ -301,8 +303,8 @@ namespace scribo more_offset = 0; // No offset needed. const int - nrows4 = t_ima[4].nrows(), ncols4 = t_ima[4].ncols(), - + nrows4 = t_ima[4].nrows(), + ncols4 = t_ima[4].ncols(), delta1 = in.delta_index(dpoint2d(+1, -(s - 1))), delta1b = in.delta_index(dpoint2d(+1, -(s + s - 1))), diff --git a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh index 7c665e5..fb7cd7c 100644 --- a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh +++ b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -162,7 +163,9 @@ namespace scribo doc.set_image(exact(original_image)); // Remove separators - mln_ch_value(I,bool) separators, input_cleaned; + mln_ch_value(I,bool) + separators, + input_cleaned = exact(processed_image); if (enable_line_seps) { on_new_progress_label("Find vertical separators..."); diff --git a/scribo/src/content_in_doc.cc b/scribo/src/content_in_doc.cc index 8cd262b..9748b28 100644 --- a/scribo/src/content_in_doc.cc +++ b/scribo/src/content_in_doc.cc @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) image2d<bool> input_preproc; { double K = 0.34; - if (argc == 8 || argc == 12 || argc >= 12) + if (argc == 8 || argc >= 12) { if (argc == 8) K = atof(argv[7]); @@ -140,14 +140,20 @@ int main(int argc, char* argv[]) std::string language = "eng"; if (argc >= 5 && argc < 13) language = argv[4]; + else if (argc >= 12) + language = argv[8]; bool find_line_seps = true; if (argc >= 6 && argc < 13) find_line_seps = (atoi(argv[5]) != 0); + else if (argc >= 12) + find_line_seps = (atoi(argv[9]) != 0); bool find_whitespace_seps = true; if (argc >= 7 && argc < 13) - find_line_seps = (atoi(argv[6]) != 0); + find_whitespace_seps = (atoi(argv[6]) != 0); + else if (argc >= 12) + find_whitespace_seps = (atoi(argv[10]) != 0); std::cout << "Running with the following options :" << " ocr_language = " << language diff --git a/scribo/src/pbm_text_in_doc.cc b/scribo/src/pbm_text_in_doc.cc index 721ff47..2726ead 100644 --- a/scribo/src/pbm_text_in_doc.cc +++ b/scribo/src/pbm_text_in_doc.cc @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) // Optional Cropping point2d crop_shift = literal::origin; - if (argc >= 12) + if (argc >= 9) { mln::def::coord minr = atoi(argv[4]), @@ -109,6 +109,9 @@ int main(int argc, char* argv[]) maxr = atoi(argv[6]), maxc = atoi(argv[7]); + std::cout << "> Image cropped from (" << minr << "," << minc << ")" + << " to (" << maxr << "," << maxc << ")" << std::endl; + box2d roi = mln::make::box2d(minr, minc, maxr, maxc); input = preprocessing::crop_without_localization(input, roi); crop_shift = point2d(minr, minc); @@ -121,26 +124,27 @@ int main(int argc, char* argv[]) bool denoise = (argc > 3 && atoi(argv[3]) != 0); std::string language = "eng"; - if (argc > 4 && argc < 12) + if (argc > 4 && argc < 10) language = argv[4]; - else if (argc == 12) + else if (argc >= 9) language = argv[8]; bool find_line_seps = true; - if (argc > 5 && argc < 12) + if (argc > 5 && argc < 10) find_line_seps = (atoi(argv[5]) != 0); - else if (argc == 12) + else if (argc >= 10) find_line_seps = (atoi(argv[9]) != 0); bool find_whitespace_seps = true; - if (argc > 6 && argc < 12) + if (argc > 6 && argc < 10) find_whitespace_seps = (atoi(argv[6]) != 0); - else if (argc == 12) + else if (argc >= 11) find_whitespace_seps = (atoi(argv[10]) != 0); std::cout << "Running with the following options :" - << "find_lines_seps = " << find_line_seps + << " ocr language = " << language + << " | find_lines_seps = " << find_line_seps << " | find_whitespace_seps = " << find_whitespace_seps << " | debug = " << debug << std::endl; diff --git a/scribo/tests/unit_test/Makefile.am b/scribo/tests/unit_test/Makefile.am index b150824..c88f553 100644 --- a/scribo/tests/unit_test/Makefile.am +++ b/scribo/tests/unit_test/Makefile.am @@ -1,5 +1,5 @@ -# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -# (LRDE). +# Copyright (C) 2009, 2010, 2011 EPITA Research and Development +# Laboratory (LRDE). # # This file is part of Olena. # @@ -17,7 +17,8 @@ include $(top_srcdir)/scribo/tests/tests.mk -COND_TESTS = cond_tests_qt \ +COND_TESTS = cond_tests_magickxx_tesseract_tiff \ + cond_tests_qt \ cond_tests_qt_tesseract_tiff \ cond_tests_tesseract_tiff diff --git a/scribo/tests/unit_test/cond_tests_magickxx_tesseract_tiff b/scribo/tests/unit_test/cond_tests_magickxx_tesseract_tiff new file mode 100644 index 0000000..3f1c2fb --- /dev/null +++ b/scribo/tests/unit_test/cond_tests_magickxx_tesseract_tiff @@ -0,0 +1 @@ +scribo/toolchain/internal/content_in_doc_functor.hh diff --git a/scribo/tests/unit_test/cond_tests_tesseract_tiff b/scribo/tests/unit_test/cond_tests_tesseract_tiff index 1324f06..ee10868 100644 --- a/scribo/tests/unit_test/cond_tests_tesseract_tiff +++ b/scribo/tests/unit_test/cond_tests_tesseract_tiff @@ -1,5 +1,4 @@ scribo/text/recognition.hh -scribo/toolchain/internal/content_in_doc_functor.hh scribo/toolchain/internal/text_in_doc_functor.hh scribo/toolchain/content_in_doc.hh scribo/toolchain/text_in_doc.hh -- 1.5.6.5
participants (1)
-
Guillaume Lazzara