olena: olena-2.0-810-g4733be7 Milena: New test exercising fun_image with RGB component functions.

* tests/core/image/vmorph/fun_image_rgb.cc: New. * tests/core/image/vmorph/Makefile.am (check_PROGRAMS): Add fun_image_rgb. --- milena/ChangeLog | 8 ++++ milena/tests/core/image/vmorph/Makefile.am | 6 ++- .../tests/core/image/vmorph/fun_image_rgb.cc | 45 ++++++++++++++------ 3 files changed, 44 insertions(+), 15 deletions(-) copy scribo/tests/primitive/extract/lines_h_pattern.cc => milena/tests/core/image/vmorph/fun_image_rgb.cc (61%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 7e3593b..0cdae57 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,11 @@ +2013-10-07 Roland Levillain <roland@lrde.epita.fr> + + Milena: New test exercising fun_image with RGB component functions. + + * tests/core/image/vmorph/fun_image_rgb.cc: New. + * tests/core/image/vmorph/Makefile.am (check_PROGRAMS): + Add fun_image_rgb. + 2013-09-13 Roland Levillain <roland@lrde.epita.fr> Milena: Factor Makefiles a bit more using file inclusion. diff --git a/milena/tests/core/image/vmorph/Makefile.am b/milena/tests/core/image/vmorph/Makefile.am index 46b5752..b8f782b 100644 --- a/milena/tests/core/image/vmorph/Makefile.am +++ b/milena/tests/core/image/vmorph/Makefile.am @@ -1,4 +1,5 @@ -# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE) +# Copyright (C) 2009, 2010, 2013 EPITA Research and Development +# Laboratory (LRDE) # # This file is part of Olena. # @@ -18,7 +19,8 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ cast_image \ - fun_image + fun_image \ + fun_image_rgb TESTS = $(check_PROGRAMS) diff --git a/scribo/tests/primitive/extract/lines_h_pattern.cc b/milena/tests/core/image/vmorph/fun_image_rgb.cc similarity index 61% copy from scribo/tests/primitive/extract/lines_h_pattern.cc copy to milena/tests/core/image/vmorph/fun_image_rgb.cc index 64c09f8..0b9aadd 100644 --- a/scribo/tests/primitive/extract/lines_h_pattern.cc +++ b/milena/tests/core/image/vmorph/fun_image_rgb.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE). // // This file is part of Olena. // @@ -24,28 +24,47 @@ // executable file might be covered by the GNU General Public License. // \file +// \brief Exercise mln::fun_image with RGB component functions. #include <mln/core/image/image2d.hh> -#include <mln/data/compare.hh> -#include <mln/io/pbm/load.hh> -#include <scribo/primitive/extract/lines_h_pattern.hh> +#include <mln/core/image/vmorph/fun_image.hh> + +#include <mln/value/rgb8.hh> +#include <mln/fun/v2v/component.hh> + +#include <mln/io/ppm/load.hh> #include "tests/data.hh" + int main() { using namespace mln; - using namespace scribo; - image2d<bool> input; - io::pbm::load(input, SCRIBO_IMG_DIR "/lines_discontinued.pbm"); + typedef value::rgb8 V; + typedef image2d<V> I; + I lena; + io::ppm::load(lena, MLN_IMG_DIR "/tiny.ppm"); + + // Red (#0) component. + typedef fun::v2v::component<V, 0> FR; + FR red; + fun_image<FR, I> lena_red = red << lena; - image2d<bool> ref; - io::pbm::load(ref, - SCRIBO_TESTS_DIR "/primitive/extract/lines_h_pattern.ref.pbm"); + // Green (#1) component. + typedef fun::v2v::component<V, 1> FG; + FG green; + fun_image<FG, I> lena_green = green << lena; - image2d<bool> - vlines = primitive::extract::lines_h_pattern(input, 51, 3); + // Blue (#2) component. + typedef fun::v2v::component<V, 2> FB; + FB blue; + fun_image<FB, I> lena_blue = blue << lena; - mln_assertion(vlines == ref); + mln_piter_(I) p(lena.domain()); + for_all(p) + { + V v(lena_red(p), lena_green(p), lena_blue(p)); + mln_assertion(lena(p) == v); + } } -- 1.7.10.4
participants (1)
-
Roland Levillain