1863: Clean up tests/morpho/dilation a bit.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Clean up tests/morpho/dilation a bit. * tests/morpho/dilation.cc: Reorganize. Disable neigh::image-related tests. Remove outdated tests. * tests/morpho/Makefile.am (CXXFLAGS_SPEED): Remove variable. s/CXXFLAGS_SPEED/TESTS_CXXFLAGS_SPEED/. (dilation_CXXFLAGS): New. Set to $(TESTS_CXXFLAGS_SPEED). Makefile.am | 25 ++++++++++++++++++------- dilation.cc | 55 +++++++++++++++++++++---------------------------------- 2 files changed, 39 insertions(+), 41 deletions(-) Index: tests/morpho/dilation.cc --- tests/morpho/dilation.cc (revision 1862) +++ tests/morpho/dilation.cc (working copy) @@ -48,9 +48,6 @@ #include <mln/pw/cst.hh> #include <mln/fun/ops.hh> -#include <mln/convert/to_p_array.hh> -#include <mln/convert/to_window.hh> - #include <mln/core/neighb2d.hh> #include <mln/neighb/image.hh> @@ -62,18 +59,14 @@ using namespace mln; using value::int_u8; + // FIXME: Do we really need such a high value? border::thickness = 66; - // FIXME: Maybe we should split all these tests cases into severals - // files. Sure it's a pain to create, but we want to be able to - // choose the granularity of the executed test suite (fast, - // comprehensive, etc.). - image2d<int_u8> lena; io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); + win::rectangle2d rec(5, 3); { - win::rectangle2d rec(5, 3); image2d<int_u8> out = morpho::dilation(lena, rec); io::pgm::save(out, "out1.pgm"); } @@ -85,35 +78,29 @@ } { - image2d<int_u8> out = morpho::dilation(lena + c4()); - io::pgm::save(out, "out3.pgm"); + image2d<bool> bin(lena.domain()), out(lena.domain()); + level::fill(bin, pw::value(lena) > pw::cst(127u)); + morpho::dilation(bin, rec, out); + + image2d<int_u8> test(lena.domain()); + image2d<int_u8>::fwd_piter p(lena.domain()); + for_all(p) + test(p) = out(p) ? 255 : 0; + io::pgm::save(test, "out3.pgm"); } + /* FIXME: Re-enable these tests for Olena 1.1, when associated + neighborhoods (i.e., the neighb::image morpher) are supported and + shipped. */ +#if 0 { - image2d<int_u8> out = morpho::dilation(lena + c8()); + image2d<int_u8> out = morpho::dilation(lena + c4()); io::pgm::save(out, "out4.pgm"); } -// { -// p_array<point2d> vec = convert::to_p_array(rec, point2d::zero); -// window2d win = convert::to_window(vec); - -// image2d<int_u8> out(lena.domain()); -// level::ero(lena, win, out); -// morpho::dilation(lena, win, out); -// io::pgm::save(out, "out5.pgm"); -// } - -// { -// image2d<bool> bin(lena.domain()), out(lena.domain()); -// level::fill(bin, pw::value(lena) > pw::cst(127)); -// morpho::dilation(bin, rec, out); - -// image2d<int_u8> test(lena.domain()); -// image2d<int_u8>::fwd_piter p(lena.domain()); -// for_all(p) -// test(p) = out(p) ? 255 : 0; -// io::pgm::save(test, "out6.pgm"); -// } - + { + image2d<int_u8> out = morpho::dilation(lena + c8()); + io::pgm::save(out, "out5.pgm"); + } +#endif } Index: tests/morpho/Makefile.am --- tests/morpho/Makefile.am (revision 1862) +++ tests/morpho/Makefile.am (working copy) @@ -19,7 +19,11 @@ opening_area \ thinning -dilation_SOURCES = dilation.cc +# -------------- # +# Normal tests. # +# -------------- # + +# FIXME: Have erosion and dilation perform symmetric tests. erosion_SOURCES = erosion.cc dilation_max_h_SOURCES = dilation_max_h.cc @@ -36,14 +40,21 @@ meyer_wst_SOURCES = meyer_wst.cc -# FIXME: We should isolate those tests, as they take a long time to -# execute. -CXXFLAGS_SPEED = -O3 -ggdb -DNDEBUG +# --------------- # +# Complex tests. # +# --------------- # + +dilation_SOURCES = dilation.cc +dilation_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) + lena_line_graph_image_wst1_SOURCES = lena_line_graph_image_wst1.cc -lena_line_graph_image_wst1_CXXFLAGS = $(CXXFLAGS_SPEED) +lena_line_graph_image_wst1_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) + lena_line_graph_image_wst2_SOURCES = lena_line_graph_image_wst2.cc -lena_line_graph_image_wst2_CXXFLAGS = $(CXXFLAGS_SPEED) +lena_line_graph_image_wst2_CXXFLAGS = $(TESTSCXXFLAGS_SPEED) + meyer_wst_long_SOURCES = meyer_wst_long.cc -meyer_wst_long_CXXFLAGS = $(CXXFLAGS_SPEED) +meyer_wst_long_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) + TESTS = $(check_PROGRAMS)
participants (1)
-
Roland Levillain