* tests/core/image/imorph/interpolated-tr_image-composed.cc: New.
* tests/core/image/imorph/interpolated-tr_image.cc:
Rename as...
* tests/core/image/imorph/interpolated-tr_image-rotation.cc:
...this.
Update comments.
* tests/core/image/imorph/Makefile.am (check_PROGRAMS): Update.
---
milena/ChangeLog | 12 +++++++
milena/tests/core/image/imorph/Makefile.am | 3 +-
..._image.cc => interpolated-tr_image-composed.cc} | 34 ++++++++++++++++----
..._image.cc => interpolated-tr_image-rotation.cc} | 2 +-
4 files changed, 42 insertions(+), 9 deletions(-)
copy milena/tests/core/image/imorph/{interpolated-tr_image.cc =>
interpolated-tr_image-composed.cc} (67%)
rename milena/tests/core/image/imorph/{interpolated-tr_image.cc =>
interpolated-tr_image-rotation.cc} (98%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 5496fbf..84cd372 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2013-10-25 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Milena: Exercise mln::interpolated, mln::tr_image and mln::compose.
+
+ * tests/core/image/imorph/interpolated-tr_image-composed.cc: New.
+ * tests/core/image/imorph/interpolated-tr_image.cc:
+ Rename as...
+ * tests/core/image/imorph/interpolated-tr_image-rotation.cc:
+ ...this.
+ Update comments.
+ * tests/core/image/imorph/Makefile.am (check_PROGRAMS): Update.
+
2013-10-15 Armand Leclercq <marman.email(a)gmail.com>
Suppress user warnings from the use of mln_VAR with g++ 4.8.1.
diff --git a/milena/tests/core/image/imorph/Makefile.am
b/milena/tests/core/image/imorph/Makefile.am
index 97a3ce6..ee5a019 100644
--- a/milena/tests/core/image/imorph/Makefile.am
+++ b/milena/tests/core/image/imorph/Makefile.am
@@ -20,7 +20,8 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
decorated_image \
interpolated \
- interpolated-tr_image \
+ interpolated-tr_image-rotation \
+ interpolated-tr_image-composed \
labeled_image \
safe_image \
tr_image
diff --git a/milena/tests/core/image/imorph/interpolated-tr_image.cc
b/milena/tests/core/image/imorph/interpolated-tr_image-composed.cc
similarity index 67%
copy from milena/tests/core/image/imorph/interpolated-tr_image.cc
copy to milena/tests/core/image/imorph/interpolated-tr_image-composed.cc
index e31d75c..a3879fe 100644
--- a/milena/tests/core/image/imorph/interpolated-tr_image.cc
+++ b/milena/tests/core/image/imorph/interpolated-tr_image-composed.cc
@@ -25,7 +25,7 @@
/// \file
/// \brief Exercise the mln::interpolated and mln::tr_image morphers
-/// together.
+/// together, using a composition of a rotation and a translation.
#include <iostream>
@@ -36,8 +36,11 @@
#include <mln/fun/x2v/bilinear.hh>
#include <mln/fun/x2x/rotation.hh>
+#include <mln/fun/x2x/translation.hh>
+#include <mln/fun/x2x/composed.hh>
#include <mln/math/pi.hh>
+#include <mln/math/sqrt.hh>
#include <mln/algebra/vec.hh>
@@ -70,18 +73,35 @@ int main()
B inter(safe);
PRINTLN(inter);
- /// Rotate image on the fly.
+ /// Rotate and translate image on the fly.
float angle = math::pi / 4;
typedef fun::x2x::rotation<2, float> F;
F rotate(angle);
- typedef tr_image<mln_domain_(B), B, F> R;
- R rotated(inter.domain(), inter, rotate);
- PRINTLN(rotated);
+ typedef fun::x2x::translation<2, float> G;
+ /* FIXME: Compute these coordinates automatically from IMA's
+ domain and ANGLE. */
+ G translate(make::vec(1.5f, 1.5f * (1.f - math::sqrt(2.f))));
+ typedef fun::x2x::composed<G, F> H;
+ H move(translate, rotate);
+ typedef tr_image<mln_domain_(B), B, H> M;
+ M moved(inter.domain(), inter, move);
+ PRINTLN(moved);
}
// Equivalent ``one-liner''.
{
- PRINTLN(apply_tr(interpolate<fun::x2v::bilinear>(safe(ima, 0.f).rw()),
- fun::x2x::rotation<2, float>(math::pi / 4)));
+ /* FIXME: mln/fun/x2x/rotation.hh and mln/fun/x2x/translation.hh
+ should provide generators (helpers), as mln/fun/x2x/composed.hh
+ does. */
+ /* FIXME: We could also add a routine perfoming the centered
+ rotation as shortcut. */
+ PRINTLN(apply_tr
+ (interpolate<fun::x2v::bilinear>(safe(ima, 0.f).rw()),
+ /* FIXME: Compute these coordinates automatically from
+ IMA's domain and ANGLE. */
+ compose(fun::x2x::translation<2, float>
+ (make::vec(1.5f,
+ 1.5f * (1.f - math::sqrt(2.f)))),
+ fun::x2x::rotation<2, float>(math::pi / 4))));
}
}
diff --git a/milena/tests/core/image/imorph/interpolated-tr_image.cc
b/milena/tests/core/image/imorph/interpolated-tr_image-rotation.cc
similarity index 98%
rename from milena/tests/core/image/imorph/interpolated-tr_image.cc
rename to milena/tests/core/image/imorph/interpolated-tr_image-rotation.cc
index e31d75c..332cd80 100644
--- a/milena/tests/core/image/imorph/interpolated-tr_image.cc
+++ b/milena/tests/core/image/imorph/interpolated-tr_image-rotation.cc
@@ -25,7 +25,7 @@
/// \file
/// \brief Exercise the mln::interpolated and mln::tr_image morphers
-/// together.
+/// together, using a rotation.
#include <iostream>
--
1.7.10.4