* tests/core/image/vmorph/fun_image_rgb.cc: New.
* tests/core/image/vmorph/Makefile.am (check_PROGRAMS):
Add fun_image_rgb.
---
milena/tests/core/image/vmorph/Makefile.am | 6 ++-
.../tests/core/image/vmorph/fun_image_rgb.cc | 45 ++++++++++++++------
2 files changed, 36 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/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
Show replies by date