* mln/arith/minus.hh,
* tests/core/image/imorph/interpolated.cc:
Here.
---
milena/ChangeLog | 8 ++++
milena/mln/arith/minus.hh | 54 ++++++++++++++----------
milena/tests/core/image/imorph/interpolated.cc | 35 +++++++--------
3 files changed, 57 insertions(+), 40 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 0cdae57..52f9172 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,11 @@
+2013-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Milena: Aesthetic changes.
+
+ * mln/arith/minus.hh,
+ * tests/core/image/imorph/interpolated.cc:
+ Here.
+
2013-10-07 Roland Levillain <roland(a)lrde.epita.fr>
Milena: New test exercising fun_image with RGB component functions.
diff --git a/milena/mln/arith/minus.hh b/milena/mln/arith/minus.hh
index ddec735..bd3b09d 100644
--- a/milena/mln/arith/minus.hh
+++ b/milena/mln/arith/minus.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
+// Laboratory (LRDE).
//
// This file is part of Olena.
//
@@ -108,7 +109,8 @@ namespace mln
*/
template <typename L, typename R, typename F>
mln_ch_value(L, mln_result(F))
- minus(const Image<L>& lhs, const Image<R>& rhs, const
Function_v2v<F>& f);
+ minus(const Image<L>& lhs, const Image<R>& rhs,
+ const Function_v2v<F>& f);
/// Point-wise addition of images \p lhs and \p rhs.
@@ -166,7 +168,8 @@ namespace mln
*/
template <typename I, typename V, typename F>
mln_ch_value(I, mln_result(F))
- minus_cst(const Image<I>& input, const V& val, const
Function_v2v<F>& f);
+ minus_cst(const Image<I>& input, const V& val,
+ const Function_v2v<F>& f);
/// Point-wise addition of the value \p val to image \p input.
@@ -253,27 +256,19 @@ namespace mln
template <typename L, typename R, typename O>
inline
void minus_(trait::image::speed::any, const L& lhs,
- trait::image::speed::any, const R& rhs, O& output)
+ trait::image::speed::any, const R& rhs,
+ O& output)
{
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) - rhs(p);
}
- template <typename L, typename R, typename F, typename O>
- inline
- void minus_(trait::image::speed::any, const L& lhs,
- trait::image::speed::any, const R& rhs, const F& f, O& output)
- {
- mln_piter(L) p(lhs.domain());
- for_all(p)
- output(p) = f(lhs(p) - rhs(p));
- }
-
template <typename L, typename R, typename O>
inline
void minus_(trait::image::speed::fastest, const L& lhs,
- trait::image::speed::fastest, const R& rhs, O& output)
+ trait::image::speed::fastest, const R& rhs,
+ O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -282,10 +277,23 @@ namespace mln
op.val() = lp.val() - rp.val();
}
+
+ template <typename L, typename R, typename F, typename O>
+ inline
+ void minus_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ const F& f, O& output)
+ {
+ mln_piter(L) p(lhs.domain());
+ for_all(p)
+ output(p) = f(lhs(p) - rhs(p));
+ }
+
template <typename L, typename R, typename F, typename O>
inline
void minus_(trait::image::speed::fastest, const L& lhs,
- trait::image::speed::fastest, const R& rhs, const F& f, O& output)
+ trait::image::speed::fastest, const R& rhs,
+ const F& f, O& output)
{
mln_pixter(const L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -294,10 +302,11 @@ namespace mln
op.val() = f(lp.val() - rp.val());
}
+
template <typename L, typename R>
inline
void minus_inplace_(trait::image::speed::any, L& lhs,
- trait::image::speed::any, const R& rhs)
+ trait::image::speed::any, const R& rhs)
{
mln_piter(L) p(lhs.domain());
for_all(p)
@@ -307,7 +316,7 @@ namespace mln
template <typename L, typename R>
inline
void minus_inplace_(trait::image::speed::fastest, L& lhs,
- trait::image::speed::fastest, const R& rhs)
+ trait::image::speed::fastest, const R& rhs)
{
mln_pixter(L) lp(lhs);
mln_pixter(const R) rp(rhs);
@@ -384,8 +393,8 @@ namespace mln
mln_precondition(exact(input).is_valid());
// Calls the previous version.
- mln_trait_op_minus(I, V) output = minus(input,
- pw::cst(val) | exact(input).domain());
+ mln_trait_op_minus(I, V) output =
+ minus(input, pw::cst(val) | exact(input).domain());
return output;
}
@@ -401,9 +410,8 @@ namespace mln
mln_precondition(exact(input).is_valid());
// Calls the previous version.
- mln_ch_value(I, mln_result(F)) output = minus(input,
- pw::cst(val) | exact(input).domain(),
- f);
+ mln_ch_value(I, mln_result(F)) output =
+ minus(input, pw::cst(val) | exact(input).domain(), f);
return output;
}
diff --git a/milena/tests/core/image/imorph/interpolated.cc
b/milena/tests/core/image/imorph/interpolated.cc
index 0088879..0ed5b16 100644
--- a/milena/tests/core/image/imorph/interpolated.cc
+++ b/milena/tests/core/image/imorph/interpolated.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2013 EPITA Research and Development
+// Laboratory (LRDE).
//
// This file is part of Olena.
//
@@ -23,37 +24,37 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+/// \brief Exercise mln::interpolated using mln::fun::x2v::bilinear.
+
#include <iostream>
+
#include <mln/core/image/image2d.hh>
#include <mln/core/image/imorph/interpolated.hh>
+#include <mln/fun/x2v/bilinear.hh>
#include <mln/algebra/vec.hh>
-#include <mln/data/fill.hh>
-
#include <mln/debug/println.hh>
-#include <mln/fun/x2v/bilinear.hh>
-
-
int main()
{
using namespace mln;
- float tab[] = {1., 3., 5., 7.,
- 4., 7., 10., 13.,
- 7., 11., 15., 19.,
- 10., 15., 20., 25.};
- image2d<float> f = make::image2d(tab);
+ float tab[] = {1.f, 3.f, 5.f, 7.f,
+ 4.f, 7.f, 10.f, 13.f,
+ 7.f, 11.f, 15.f, 19.f,
+ 10.f, 15.f, 20.f, 25.f};
+ image2d<float> ima = make::image2d(tab);
- interpolated<image2d<float>, fun::x2v::bilinear> inter(f);
+ interpolated<image2d<float>, fun::x2v::bilinear> inter(ima);
- algebra::vec<2, float> v1 = make::vec(2.3, 0.6);
- algebra::vec<2, float> v2 = make::vec(3.2, 1.8);
+ algebra::vec<2, float> v1 = make::vec(2.3f, 0.6f);
+ algebra::vec<2, float> v2 = make::vec(3.2f, 1.8f);
- debug::println(f);
+ debug::println(ima);
- std::cout << v1 << " : " << inter(v1) << std::endl;
- std::cout << v2 << " : " << inter(v2) << std::endl;
+ std::cout << "inter(" << v1 << ") = " <<
inter(v1) << std::endl;
+ std::cout << "inter(" << v2 << ") = " <<
inter(v2) << std::endl;
}
--
1.7.10.4