
* 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 ++- .../image/vmorph/fun_image_rgb.cc} | 49 +++++++++++++------- 3 files changed, 43 insertions(+), 20 deletions(-) copy milena/tests/{convert/to_qimage_nocopy.cc => core/image/vmorph/fun_image_rgb.cc} (62%) 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/milena/tests/convert/to_qimage_nocopy.cc b/milena/tests/core/image/vmorph/fun_image_rgb.cc similarity index 62% copy from milena/tests/convert/to_qimage_nocopy.cc copy to milena/tests/core/image/vmorph/fun_image_rgb.cc index 506e601..5e4e100 100644 --- a/milena/tests/convert/to_qimage_nocopy.cc +++ b/milena/tests/core/image/vmorph/fun_image_rgb.cc @@ -1,5 +1,4 @@ -// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE). // // This file is part of Olena. // @@ -25,33 +24,47 @@ // executable file might be covered by the GNU General Public License. /// \file -/// -/// Test of mln::convert::to_qimage - -#include <QtGui/QtGui> - -#include "tests/data.hh" +/// \brief Exercise mln::fun_image with RGB component functions. #include <mln/core/image/image2d.hh> +#include <mln/core/image/vmorph/fun_image.hh> + #include <mln/value/rgb8.hh> -#include <mln/value/int_u8.hh> +#include <mln/fun/v2v/component.hh> + #include <mln/io/ppm/load.hh> -#include <mln/io/pgm/load.hh> -#include <mln/data/convert.hh> -#include <mln/convert/to_qimage_nocopy.hh> +#include "tests/data.hh" int main() { using namespace mln; - { - image2d<value::rgb8> input; - io::ppm::load(input, MLN_IMG_DIR "/picasso.ppm"); - QImage test = convert::to_qimage_nocopy(input); - QImage refpix(MLN_IMG_DIR "/picasso.ppm"); + 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; + + // Green (#1) component. + typedef fun::v2v::component<V, 1> FG; + FG green; + fun_image<FG, I> lena_green = green << lena; - mln_assertion(refpix == test.convertToFormat(refpix.format())); + // Blue (#2) component. + typedef fun::v2v::component<V, 2> FB; + FB blue; + fun_image<FB, I> lena_blue = blue << lena; + + 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