
* tests/primitive/extract/Makefile.am: New targets. * tests/primitive/extract/lines_h_pattern.cc, * tests/primitive/extract/lines_h_pattern.ref.pbm, * tests/primitive/extract/lines_v_pattern.cc, * tests/primitive/extract/lines_v_pattern.ref.pbm: New. --- scribo/ChangeLog | 11 ++++++++ scribo/tests/primitive/extract/Makefile.am | 6 +++- .../extract/lines_h_pattern.cc} | 25 +++++++++---------- .../primitive/extract/lines_h_pattern.ref.pbm | Bin 0 -> 5116 bytes .../extract/lines_v_pattern.cc} | 25 +++++++++---------- .../extract/lines_v_pattern.ref.pbm} | Bin 5050 -> 5116 bytes 6 files changed, 39 insertions(+), 28 deletions(-) copy scribo/tests/{binarization/otsu.cc => primitive/extract/lines_h_pattern.cc} (75%) create mode 100644 scribo/tests/primitive/extract/lines_h_pattern.ref.pbm copy scribo/tests/{binarization/otsu.cc => primitive/extract/lines_v_pattern.cc} (75%) copy scribo/tests/{img/lines_discontinued.pbm => primitive/extract/lines_v_pattern.ref.pbm} (91%) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 905d53f..ebfef2f 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,16 @@ 2013-03-06 Guillaume Lazzara <z@lrde.epita.fr> + Add tests for lines_*_pattern routines. + + * tests/primitive/extract/Makefile.am: New targets. + + * tests/primitive/extract/lines_h_pattern.cc, + * tests/primitive/extract/lines_h_pattern.ref.pbm, + * tests/primitive/extract/lines_v_pattern.cc, + * tests/primitive/extract/lines_v_pattern.ref.pbm: New. + +2013-03-06 Guillaume Lazzara <z@lrde.epita.fr> + Fix wrong line reconstruction with lines_*_pattern routines. * scribo/primitive/extract/lines_h_pattern.hh, diff --git a/scribo/tests/primitive/extract/Makefile.am b/scribo/tests/primitive/extract/Makefile.am index 307dcf5..047fdb8 100644 --- a/scribo/tests/primitive/extract/Makefile.am +++ b/scribo/tests/primitive/extract/Makefile.am @@ -22,11 +22,13 @@ EXTRA_DIST = \ alignment_2.ref.pbm \ alignment_3.ref.pbm \ alignment_4.ref.pbm \ - lines_discontinued.pbm + lines_v_pattern.ref.pbm check_PROGRAMS = lines_discontinued \ lines_h_discontinued \ - lines_v_discontinued + lines_v_discontinued \ + lines_v_pattern \ + lines_h_pattern if HAVE_MAGICKXX diff --git a/scribo/tests/binarization/otsu.cc b/scribo/tests/primitive/extract/lines_h_pattern.cc similarity index 75% copy from scribo/tests/binarization/otsu.cc copy to scribo/tests/primitive/extract/lines_h_pattern.cc index fd4c7f2..64c09f8 100644 --- a/scribo/tests/binarization/otsu.cc +++ b/scribo/tests/primitive/extract/lines_h_pattern.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,30 +23,29 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -/// \file +// \file #include <mln/core/image/image2d.hh> #include <mln/data/compare.hh> -#include <mln/value/int_u8.hh> -#include <mln/io/pgm/load.hh> #include <mln/io/pbm/load.hh> -#include <mln/io/pbm/save.hh> - -#include <scribo/binarization/otsu.hh> +#include <scribo/primitive/extract/lines_h_pattern.hh> #include "tests/data.hh" int main() { using namespace mln; + using namespace scribo; - image2d<value::int_u8> input; - io::pgm::load(input, MILENA_IMG_DIR "/lena.pgm"); - - image2d<bool> bin = scribo::binarization::otsu(input); + image2d<bool> input; + io::pbm::load(input, SCRIBO_IMG_DIR "/lines_discontinued.pbm"); image2d<bool> ref; - io::pbm::load(ref, SCRIBO_TESTS_DIR "binarization/otsu.ref.pbm"); + io::pbm::load(ref, + SCRIBO_TESTS_DIR "/primitive/extract/lines_h_pattern.ref.pbm"); + + image2d<bool> + vlines = primitive::extract::lines_h_pattern(input, 51, 3); - mln_assertion(bin == ref); + mln_assertion(vlines == ref); } diff --git a/scribo/tests/primitive/extract/lines_h_pattern.ref.pbm b/scribo/tests/primitive/extract/lines_h_pattern.ref.pbm new file mode 100644 index 0000000..5efb093 Binary files /dev/null and b/scribo/tests/primitive/extract/lines_h_pattern.ref.pbm differ diff --git a/scribo/tests/binarization/otsu.cc b/scribo/tests/primitive/extract/lines_v_pattern.cc similarity index 75% copy from scribo/tests/binarization/otsu.cc copy to scribo/tests/primitive/extract/lines_v_pattern.cc index fd4c7f2..c61c9b9 100644 --- a/scribo/tests/binarization/otsu.cc +++ b/scribo/tests/primitive/extract/lines_v_pattern.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,30 +23,29 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -/// \file +// \file #include <mln/core/image/image2d.hh> #include <mln/data/compare.hh> -#include <mln/value/int_u8.hh> -#include <mln/io/pgm/load.hh> #include <mln/io/pbm/load.hh> -#include <mln/io/pbm/save.hh> - -#include <scribo/binarization/otsu.hh> +#include <scribo/primitive/extract/lines_v_pattern.hh> #include "tests/data.hh" int main() { using namespace mln; + using namespace scribo; - image2d<value::int_u8> input; - io::pgm::load(input, MILENA_IMG_DIR "/lena.pgm"); - - image2d<bool> bin = scribo::binarization::otsu(input); + image2d<bool> input; + io::pbm::load(input, SCRIBO_IMG_DIR "/lines_discontinued.pbm"); image2d<bool> ref; - io::pbm::load(ref, SCRIBO_TESTS_DIR "binarization/otsu.ref.pbm"); + io::pbm::load(ref, + SCRIBO_TESTS_DIR "/primitive/extract/lines_v_pattern.ref.pbm"); + + image2d<bool> + vlines = primitive::extract::lines_v_pattern(input, 51, 5); - mln_assertion(bin == ref); + mln_assertion(vlines == ref); } diff --git a/scribo/tests/img/lines_discontinued.pbm b/scribo/tests/primitive/extract/lines_v_pattern.ref.pbm similarity index 91% copy from scribo/tests/img/lines_discontinued.pbm copy to scribo/tests/primitive/extract/lines_v_pattern.ref.pbm index 799b2da..1ebd904 100644 Binary files a/scribo/tests/img/lines_discontinued.pbm and b/scribo/tests/primitive/extract/lines_v_pattern.ref.pbm differ -- 1.7.2.5